File tree 7 files changed +109
-14
lines changed
7 files changed +109
-14
lines changed Original file line number Diff line number Diff line change 17
17
os :
18
18
- registry.fedoraproject.org/fedora:latest
19
19
- registry.fedoraproject.org/fedora:rawhide
20
- - docker.io/almalinux:8
21
- - quay.io/centos/centos:stream9
22
20
steps :
23
21
- uses : actions/checkout@v4
24
22
- name : Set the right OS in the Dockerfile
27
25
run : docker build -t python-libssh -f tests/Dockerfile .
28
26
- name : Run container
29
27
run : docker run --name python-libssh --rm -d python-libssh
30
- - name : Run tests in the container
31
- run : docker exec python-libssh python3 setup .py test
32
- - name : Run tests with installed rpm
28
+ - name : Run tests with unittest discover
29
+ run : docker exec python-libssh python3 -m unittest discover -v -s tests -p 't*_* .py'
30
+ - name : Run tests manually
33
31
run : docker exec python-libssh bash -c 'cp -rp tests /tmp/tests && cd /tmp/tests && for i in *.py ; do python3 -Werror $i ; done'
Original file line number Diff line number Diff line change 1
1
2
+ NAME = python-$(shell eval echo $$( awk '/^name/ { print $$NF }' pyproject.toml ) )
3
+ VERSION = $(shell eval echo $$( awk '/^version/ { print $$NF }' pyproject.toml ) )
4
+ DIST = dist
5
+ SPECFILE = $(NAME ) .spec
6
+
7
+ tar-gz :
8
+ rm -rf $(DIST ) /$(NAME ) -$(VERSION )
9
+ mkdir -p $(DIST ) /$(NAME ) -$(VERSION )
10
+ cp -rp -t dist/$(NAME ) -$(VERSION ) $(shell ls | grep -v dist)
11
+ for i in $( shell cat .gitignore) ; do rm -rf $( DIST) /$$ i ; done
12
+ tar -C $(DIST ) -cvzf $(DIST ) /$(NAME ) -$(VERSION ) .tar.gz $(NAME ) -$(VERSION )
13
+ rm -rf $(DIST ) /$(NAME ) -$(VERSION )
14
+ ls -l $(DIST ) /* .tar.gz
15
+
16
+ srpm : tar-gz
17
+ rpmbuild -D ' _srcrpmdir $(DIST)' -D ' _sourcedir $(DIST)' -bs $(SPECFILE )
18
+ ls -l $(DIST ) /* .src.rpm
19
+
20
+ dynamic-build-requires : tar-gz
21
+ rpmbuild -D ' _srcrpmdir $(DIST)' -D ' _sourcedir $(PWD)/$(DIST)' -br $(SPECFILE )
22
+
23
+ rpm : tar-gz
24
+ rpmbuild -D ' _rpmdir $(DIST)' -D ' _sourcedir $(PWD)/$(DIST)' -bb $(SPECFILE )
25
+ mv $(DIST ) /$$(uname -m ) /* .$$(uname -m ) .rpm $(DIST )
26
+ ls -l $(DIST ) /* .$$(uname -m ) .rpm
27
+ # rpm -qlp $(DIST)/*.$$(uname -m).rpm
28
+ # rpm -q --requires -p $(DIST)/*.$$(uname -m).rpm
29
+
30
+ test :
31
+ ./test.sh
32
+
33
+ test-pylint :
34
+ pylint-3 --disable=R --disable=C --indent-string=" \t" --extension-pkg-whitelist=rpm,lxml libssh.pyx
35
+
2
36
clean :
3
37
rm -rf $(shell cat .gitignore)
4
38
39
+ .PHONY : tar-gz srpm rpm test test-pylint clean
40
+
Original file line number Diff line number Diff line change 5
5
6
6
Build the extension with
7
7
```
8
+ make rpm
9
+ rpm -Uvh dist/python-libssh*.rpm
10
+ ```
11
+ or
12
+ ```
8
13
python3 setup.py build_ext --inplace
9
14
```
10
15
@@ -16,12 +21,16 @@ In other words, `ssh localhost true` needs to work.
16
21
17
22
Test it with
18
23
```
24
+ python3 -m unittest discover -v -s tests -p 't*_*.py'
25
+ ```
26
+ or
27
+ ```
19
28
python3 setup.py test
20
29
```
21
30
22
31
## Author
23
32
24
- Written by Jan Pazdziora, 2019
33
+ Written by Jan Pazdziora, 2019--2024
25
34
26
35
## License
27
36
Original file line number Diff line number Diff line change
1
+
2
+ [project ]
3
+ name = " libssh"
4
+ version = " 0.0.1"
5
+ authors = [{name = " Jan Pazdziora" }]
6
+ license = {text = " GNU Lesser General Public License v2 (LGPLv2)" }
7
+ description = " Python bindings to client functionality of libssh"
8
+ classifiers = [
9
+ " Development Status :: 2 - Pre-Alpha" ,
10
+ " License :: OSI Approved :: GNU Lesser General Public License v2 (LGPLv2)" ,
11
+ " Topic :: Security" ,
12
+ ]
13
+
14
+ [build-system ]
15
+ requires = [" setuptools" , " Cython" ]
16
+ build-backend = " setuptools.build_meta"
17
+
18
+ [tool .setuptools ]
19
+ packages = [" libssh" ]
20
+ package-dir = {"libssh" = " ." }
21
+
Original file line number Diff line number Diff line change
1
+
2
+ Name: python-libssh
3
+ Version: 0.0.1
4
+ Release: 1%{?dist }
5
+
6
+ Summary: Python bindings to client functionality of libssh
7
+ License: LGPLv2
8
+ URL: https://github.com/adelton/python-libssh
9
+ Source0: %{name }-%{version }.tar.gz
10
+
11
+ BuildRequires: libssh-devel
12
+ BuildRequires: python3-devel
13
+ BuildRequires: python3-wheel
14
+
15
+ %description
16
+ Python bindings to client functionality of libssh.
17
+
18
+ %prep
19
+ %autosetup
20
+
21
+ %generate_buildrequires
22
+ %pyproject_buildrequires -p
23
+
24
+ %build
25
+ %pyproject_wheel
26
+
27
+ %install
28
+ %pyproject_install
29
+
30
+ %pyproject_save_files -l libssh
31
+
32
+ %files -f %{pyproject_files }
33
+
Original file line number Diff line number Diff line change 8
8
from setuptools .extension import Extension
9
9
from Cython .Build import cythonize
10
10
11
- import unittest
12
- def get_tests ():
13
- return unittest .TestLoader ().discover ("tests" , pattern = "*.py" )
14
-
15
11
setup (
16
12
name = "python-libssh" ,
17
13
version = "0.0.1" ,
@@ -24,6 +20,5 @@ def get_tests():
24
20
"License :: OSI Approved :: GNU Lesser General Public License v2 (LGPLv2)" ,
25
21
"Topic :: Security" ,
26
22
],
27
- test_suite = "setup.get_tests" ,
28
23
)
29
24
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ RUN if test -f /etc/almalinux-release && grep 'AlmaLinux release 8' /etc/almalin
4
4
dnf config-manager --set-enabled powertools ; fi
5
5
RUN if test -f /etc/centos-release && grep 'CentOS Stream release 9' /etc/centos-release ; then \
6
6
dnf config-manager --set-enabled crb ; fi
7
- RUN dnf install -y --setopt=install_weak_deps=False python3-devel python3-setuptools python3-Cython make gcc libssh-devel openssh-server openssh-clients rpm-build
7
+ RUN dnf install -y --setopt=install_weak_deps=False openssh-server openssh-clients make rpm-build gcc
8
8
RUN if test -f /etc/nsswitch.conf ; then grep hosts: /etc/nsswitch.conf && sed -i 's/^hosts:.*/hosts: files dns myhostname/' /etc/nsswitch.conf ; fi
9
9
RUN echo 'set enable-bracketed-paste off' >> ~root/.inputrc
10
10
RUN for i in rsa ecdsa ed25519 ; do /usr/libexec/openssh/sshd-keygen $i ; done
@@ -16,7 +16,10 @@ RUN yes | ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa
16
16
RUN cp ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys && chmod 400 ~/.ssh/authorized_keys
17
17
COPY . /src/
18
18
WORKDIR /src
19
- RUN python3 setup.py build_ext --inplace
20
- RUN python3 setup.py bdist_rpm
19
+ RUN if ! dnf --version | grep '^dnf5' ; then dnf install -y 'dnf-command(builddep)' ; fi
20
+ RUN dnf builddep -y python-libssh.spec
21
+ RUN make dynamic-build-requires || dnf builddep -y dist/*.buildreqs.nosrc.rpm
22
+ RUN make rpm
23
+ # RUN dnf install -y dist/python-libssh*.rpm
21
24
RUN rpm -Uvh dist/python-libssh*.rpm
22
25
ENTRYPOINT [ "/usr/sbin/sshd" , "-D" ]
You can’t perform that action at this time.
0 commit comments