[packages/python-paramiko] - updated to 2.12.0

qboosh qboosh at pld-linux.org
Fri Oct 27 18:28:28 CEST 2023


commit c97cac555ef120d9f5cb2f145dae6e82ee353f25
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Fri Oct 27 18:30:31 2023 +0200

    - updated to 2.12.0

 paramiko-mock.patch  | 95 +++++++++++++++++++++++++++++++++++++++++++++++++
 python-paramiko.spec | 99 ++++++++++++++++++++++++++++++----------------------
 2 files changed, 153 insertions(+), 41 deletions(-)
---
diff --git a/python-paramiko.spec b/python-paramiko.spec
index 4d03685..6a1a141 100644
--- a/python-paramiko.spec
+++ b/python-paramiko.spec
@@ -1,6 +1,6 @@
 #
 # Conditional build:
-%bcond_with	apidocs	# API docs packaging   # Docs gone since 2.0.1 ?
+%bcond_without	doc	# API documentation
 %bcond_with	tests	# unit tests
 %bcond_without	python2 # CPython 2.x module
 %bcond_without	python3 # CPython 3.x module
@@ -9,38 +9,48 @@
 Summary:	SSH2 protocol for Python 2
 Summary(pl.UTF-8):	Obsługa protokołu SSH2 w Pythonie 2
 Name:		python-%{module}
-Version:	2.6.0
-Release:	5
+# keep 2.x here for python2 support
+Version:	2.12.0
+Release:	1
 License:	LGPL v2.1+
 Group:		Libraries/Python
-#Source0Download: https://pypi.python.org/simple/paramiko/
-
-Source0:	https://github.com/paramiko/paramiko/archive/%{version}.tar.gz
-# Source0-md5:	161c71e27076eb1f2fc2fb2705d95a45
+#Source0Download: https://pypi.org/simple/paramiko/
+Source0:	https://github.com/paramiko/paramiko/archive/%{version}/%{module}-%{version}.tar.gz
+# Source0-md5:	9fed2b771bf8afa91b74a5536de3c670
+Patch0:		paramiko-mock.patch
 URL:		https://github.com/paramiko/paramiko/
 BuildRequires:	rpm-pythonprov
-BuildRequires:	rpmbuild(macros) >= 1.710
+BuildRequires:	rpmbuild(macros) >= 1.714
 %if %{with python2}
+BuildRequires:	python-devel >= 1:2.7
+BuildRequires:	python-setuptools
+%if %{with tests}
 BuildRequires:	python-PyNaCl >= 1.0.1
 BuildRequires:	python-bcrypt >= 3.1.3
-BuildRequires:	python-cryptography >= 1.5
-BuildRequires:	python-devel >= 1:2.6
+BuildRequires:	python-cryptography >= 2.5
+BuildRequires:	python-mock
 BuildRequires:	python-pyasn1 >= 0.1.7
-%{?with_tests:BuildRequires:	python-pytest}
+BuildRequires:	python-pytest >= 4.4.2
+BuildRequires:	python-six
+%endif
 %endif
 %if %{with python3}
+BuildRequires:	python3-devel >= 1:3.4
+BuildRequires:	python3-setuptools
+%if %{with tests}
 BuildRequires:	python3-PyNaCl >= 1.0.1
 BuildRequires:	python3-bcrypt >= 3.1.3
-BuildRequires:	python3-cryptography >= 1.5
-BuildRequires:	python3-devel >= 1:3.2
+BuildRequires:	python3-cryptography >= 2.5
 BuildRequires:	python3-pyasn1 >= 0.1.7
-%{?with_tests:BuildRequires:	python3-pytest}
+BuildRequires:	python3-pytest >= 4.4.2
+BuildRequires:	python3-six
 %endif
-Requires:	python-PyNaCl >= 1.0.1
-Requires:	python-bcrypt >= 3.1.3
-Requires:	python-cryptography >= 1.5
-Requires:	python-pyasn1 >= 0.1.7
-
+%endif
+%if %{with doc}
+BuildRequires:	python3-alabaster >= 0.7.12
+BuildRequires:	sphinx-pdg-3 >= 1.4
+%endif
+Requires:	python-modules >= 1:2.7
 BuildArch:	noarch
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
@@ -58,11 +68,7 @@ połączeń ze zdalnymi maszynami.
 Summary:	SSH2 protocol for Python 3
 Summary(pl.UTF-8):	Obsługa protokołu SSH2 w Pythonie 3
 Group:		Libraries/Python
-Requires:	python3-PyNaCl >= 1.0.1
-Requires:	python3-bcrypt >= 3.1.3
-Requires:	python3-cryptography >= 1.1
-Requires:	python3-modules >= 1:3.2
-Requires:	python3-pyasn1 >= 0.1.7
+Requires:	python3-modules >= 1:3.4
 
 %description -n python3-%{module}
 A module for Python 3.2 (or higher) that implements the SSH2 protocol
@@ -87,19 +93,33 @@ Dokumentacja API modułu paramiko.
 
 %prep
 %setup -q -n %{module}-%{version}
-
-find demos -name '*.py' -type f | xargs sed -i -e '1s|#!.*python.*|#!%{__python}|'
+%patch0 -p1
 
 # Windows-specific modules, break tests by using Windows-specific ctypes API
 %{__rm} paramiko/{win_pageant,_winapi}.py
 
 %build
 %if %{with python2}
-%py_build %{?with_tests:test}
+%py_build
+
+%if %{with tests}
+# note: slow tests are broken
+PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
+%{__python} -m pytest tests -m 'not slow'
+%endif
 %endif
 
 %if %{with python3}
-%py3_build %{?with_tests:test}
+%py3_build
+
+%if %{with tests}
+PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
+%{__python} -m pytest tests -m 'not slow'
+%endif
+%endif
+
+%if %{with doc}
+sphinx-build-3 -b html sites/docs sites/docs/_build/html
 %endif
 
 %install
@@ -108,22 +128,19 @@ rm -rf $RPM_BUILD_ROOT
 %if %{with python2}
 %py_install
 
+install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
+cp -a demos/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
+%{__sed} -i -e '1s,/usr/bin/env python$,%{__python},' $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}/*.py
+
 %py_postclean
 %endif
 
 %if %{with python3}
 %py3_install
-%endif
 
-%if %{with python2}
-install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
-cp -a demos/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
-%endif
-%if %{with python3}
 install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}
 cp -a demos/* $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}
-find $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} -name '*.py' \
-	| xargs sed -i '1s|^#!.*python\b|#!%{__python3}|'
+%{__sed} -i -e '1s,/usr/bin/env python$,%{__python3},' $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}/*.py
 %endif
 
 %clean
@@ -132,23 +149,23 @@ rm -rf $RPM_BUILD_ROOT
 %if %{with python2}
 %files
 %defattr(644,root,root,755)
-%doc README.rst
+%doc NEWS NOTES README.rst TODO sites/www/changelog.rst
 %{py_sitescriptdir}/%{module}
-%{py_sitescriptdir}/%{module}-*.egg-info
+%{py_sitescriptdir}/%{module}-%{version}-py*.egg-info
 %{_examplesdir}/%{name}-%{version}
 %endif
 
 %if %{with python3}
 %files -n python3-%{module}
 %defattr(644,root,root,755)
-%doc README.rst
+%doc NEWS NOTES README.rst TODO sites/www/changelog.rst
 %{py3_sitescriptdir}/%{module}
 %{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info
 %{_examplesdir}/python3-%{module}-%{version}
 %endif
 
-%if %{with apidocs}
+%if %{with doc}
 %files apidocs
 %defattr(644,root,root,755)
-%doc docs/{_static,api,*.html,*.js}
+%doc sites/docs/_build/html/{_static,api,*.html,*.js}
 %endif
diff --git a/paramiko-mock.patch b/paramiko-mock.patch
new file mode 100644
index 0000000..943dcfb
--- /dev/null
+++ b/paramiko-mock.patch
@@ -0,0 +1,95 @@
+--- paramiko-2.12.0/tests/test_channelfile.py.orig	2022-11-04 23:32:40.000000000 +0100
++++ paramiko-2.12.0/tests/test_channelfile.py	2023-10-27 16:44:41.043917943 +0200
+@@ -1,4 +1,7 @@
+-from mock import patch, MagicMock
++try:
++    from unittest.mock import patch, MagicMock
++except ImportError:
++    from mock import patch, MagicMock
+ 
+ from paramiko import Channel, ChannelFile, ChannelStderrFile, ChannelStdinFile
+ 
+--- paramiko-2.12.0/tests/test_client.py.orig	2022-11-04 23:32:40.000000000 +0100
++++ paramiko-2.12.0/tests/test_client.py	2023-10-27 16:45:19.653708776 +0200
+@@ -35,7 +35,10 @@ from tempfile import mkstemp
+ 
+ import pytest
+ from pytest_relaxed import raises
+-from mock import patch, Mock
++try:
++    from unittest.mock import patch, Mock
++except ImportError:
++    from mock import patch, Mock
+ 
+ import paramiko
+ from paramiko import SSHClient
+--- paramiko-2.12.0/tests/test_config.py.orig	2022-11-04 23:32:40.000000000 +0100
++++ paramiko-2.12.0/tests/test_config.py	2023-10-27 16:45:46.530229840 +0200
+@@ -11,7 +11,10 @@ try:
+ except ImportError:
+     Result = None
+ 
+-from mock import patch
++try:
++    from unittest.mock import patch
++except ImportError:
++    from mock import patch
+ from pytest import raises, mark, fixture
+ 
+ from paramiko import (
+--- paramiko-2.12.0/tests/test_kex.py.orig	2022-11-04 23:32:40.000000000 +0100
++++ paramiko-2.12.0/tests/test_kex.py	2023-10-27 16:47:26.926352615 +0200
+@@ -24,7 +24,10 @@ from binascii import hexlify, unhexlify
+ import os
+ import unittest
+ 
+-from mock import Mock, patch
++try:
++    from unittest.mock import Mock, patch
++except ImportError:
++    from mock import Mock, patch
+ import pytest
+ 
+ from cryptography.hazmat.backends import default_backend
+--- paramiko-2.12.0/tests/test_pkey.py.orig	2022-11-04 23:32:40.000000000 +0100
++++ paramiko-2.12.0/tests/test_pkey.py	2023-10-27 16:47:52.792879150 +0200
+@@ -41,7 +41,10 @@ from paramiko.common import o600
+ 
+ from cryptography.exceptions import UnsupportedAlgorithm
+ from cryptography.hazmat.primitives.asymmetric.rsa import RSAPrivateNumbers
+-from mock import patch, Mock
++try:
++    from unittest.mock import patch, Mock
++except ImportError:
++    from mock import patch, Mock
+ import pytest
+ 
+ from .util import _support, is_low_entropy, requires_sha1_signing
+--- paramiko-2.12.0/tests/test_proxy.py.orig	2022-11-04 23:32:40.000000000 +0100
++++ paramiko-2.12.0/tests/test_proxy.py	2023-10-27 16:48:22.616050918 +0200
+@@ -1,7 +1,10 @@
+ import signal
+ import socket
+ 
+-from mock import patch
++try:
++    from unittest.mock import patch
++except ImportError:
++    from mock import patch
+ from pytest import raises
+ 
+ from paramiko import ProxyCommand, ProxyCommandFailure
+--- paramiko-2.12.0/tests/test_transport.py.orig	2022-11-04 23:32:40.000000000 +0100
++++ paramiko-2.12.0/tests/test_transport.py	2023-10-27 16:48:44.662598148 +0200
+@@ -30,7 +30,10 @@ import time
+ import threading
+ import random
+ import unittest
+-from mock import Mock
++try:
++    from unittest.mock import Mock
++except ImportError:
++    from mock import Mock
+ 
+ from paramiko import (
+     AuthHandler,
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/python-paramiko.git/commitdiff/c97cac555ef120d9f5cb2f145dae6e82ee353f25



More information about the pld-cvs-commit mailing list