Skip to content

Commit

Permalink
user/python-ssh2: new package
Browse files Browse the repository at this point in the history
  • Loading branch information
z-erica committed Oct 8, 2024
1 parent 64547e0 commit ca322ea
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 0 deletions.
27 changes: 27 additions & 0 deletions user/python-ssh2/patches/no-versioneer.patch
Original file line number Diff line number Diff line change
@@ -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',
85 changes: 85 additions & 0 deletions user/python-ssh2/template.py
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"
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],
)
4 changes: 4 additions & 0 deletions user/python-ssh2/update.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# this isn't ssh2 on pypi
pkgname = "ssh2-python"
# ignore release candidates
ignore = ["*rc*"]

0 comments on commit ca322ea

Please sign in to comment.