From ca322eaa916a25ea67597ce7bfd42374c562ee6e Mon Sep 17 00:00:00 2001 From: Erica Z Date: Mon, 7 Oct 2024 12:16:33 +0200 Subject: [PATCH] user/python-ssh2: new package --- user/python-ssh2/patches/no-versioneer.patch | 27 +++++++ user/python-ssh2/template.py | 85 ++++++++++++++++++++ user/python-ssh2/update.py | 4 + 3 files changed, 116 insertions(+) create mode 100644 user/python-ssh2/patches/no-versioneer.patch create mode 100644 user/python-ssh2/template.py create mode 100644 user/python-ssh2/update.py diff --git a/user/python-ssh2/patches/no-versioneer.patch b/user/python-ssh2/patches/no-versioneer.patch new file mode 100644 index 0000000000..f6c7839515 --- /dev/null +++ b/user/python-ssh2/patches/no-versioneer.patch @@ -0,0 +1,27 @@ +diff -ruN a/setup.py b/setup.py +--- a/setup.py 2022-07-31 15:40:32.000000000 +0200 ++++ b/setup.py 2024-10-07 12:08:37.338347135 +0200 +@@ -5,7 +5,6 @@ + + from _setup_libssh2 import build_ssh2 + +-import versioneer + from setuptools import setup, find_packages + + cpython = platform.python_implementation() == 'CPython' +@@ -87,13 +86,13 @@ + 'msvc*.dll', 'vcruntime*.dll', + ]) + +-cmdclass = versioneer.get_cmdclass() ++cmdclass = {} + if USING_CYTHON: + cmdclass['build_ext'] = build_ext + + setup( + name='ssh2-python', +- version=versioneer.get_version(), ++ version=os.getenv('SSH2_PYTHON_VERSION'), + cmdclass=cmdclass, + url='https://github.com/ParallelSSH/ssh2-python', + license='LGPLv2', diff --git a/user/python-ssh2/template.py b/user/python-ssh2/template.py new file mode 100644 index 0000000000..777e18b84b --- /dev/null +++ b/user/python-ssh2/template.py @@ -0,0 +1,85 @@ +pkgname = "python-ssh2" +pkgver = "1.0.0" +pkgrel = 0 +build_style = "python_pep517" +make_build_env = { + "SSH2_PYTHON_VERSION": pkgver, + "SYSTEM_LIBSSH2": "1", +} +hostmakedepends = [ + "python-build", + "python-cython", + "python-installer", + "python-setuptools", +] +makedepends = [ + "libssh2-devel", + "python-devel", +] +checkdepends = [ + "openssh", + "python-jinja2", + "python-pytest", +] +pkgdesc = "Python bindings for libssh2" +maintainer = "Erica Z " +license = "LGPL-2.1-only" +url = "https://github.com/ParallelSSH/ssh2-python" +source = f"{url}/archive/refs/tags/{pkgver}.tar.gz" +sha256 = "70c6b6efd8ca9f8de9c2d77e7cb1d5859542588347ea426d6822b0ffd9889af3" + + +# this is identical to the default check, we just have to change cwd +def check(self): + whl = list( + map( + lambda p: str(p.relative_to(self.cwd)), + self.cwd.glob("dist/*.whl"), + ) + ) + + self.rm(".cbuild-checkenv", recursive=True, force=True) + self.do( + "python3", + "-m", + "venv", + "--without-pip", + "--system-site-packages", + "--clear", + ".cbuild-checkenv", + ) + + envpy = self.chroot_cwd / ".cbuild-checkenv/bin/python3" + + self.do(envpy, "-m", "installer", *whl) + self.do( + envpy, + "-m", + "pytest", + # use installed ssh2 module + "--import-mode=append", + "-k", + # these require an ssh agent + "not test_agent_get_identities" + + " and not test_agent_id_path" + + " and not test_agent" + + " and not test_failed_agent_auth" + # ssh2.exceptions.SocketRecvError + + " and not test_sftp_symlink_realpath_lstat" + + " and not test_sftp_write" + + " and not test_statvfs" + + " and not SessionTestCase" + # ssh2.exceptions.AuthenticationError + + " and not test_direct_tcpip" + + " and not ChannelTestCase" + + " and not KnownHostTestCase" + + " and not SFTPTestCase" + # ssh2.exceptions.SocketDisconnectError + + " and not test_non_blocking" + + " and not test_pubkey_auth" + + " and not test_scp_recv" + + " and not test_publickey_frommemory", + # can't run from source directory + wrksrc=f"{self.chroot_cwd}/tests", + path=[envpy.parent], + ) diff --git a/user/python-ssh2/update.py b/user/python-ssh2/update.py new file mode 100644 index 0000000000..ddf5c55b44 --- /dev/null +++ b/user/python-ssh2/update.py @@ -0,0 +1,4 @@ +# this isn't ssh2 on pypi +pkgname = "ssh2-python" +# ignore release candidates +ignore = ["*rc*"]