Skip to content

Commit ea47675

Browse files
committed
Remove "versioneer", replace with setuptools_scm.
1 parent 47250db commit ea47675

File tree

8 files changed

+24
-2230
lines changed

8 files changed

+24
-2230
lines changed

building/build-wheels.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ set -e -u -x
99
# add builder user and su to build to avoid creating root-owned files in host side.
1010
groupadd --gid $GROUP_ID builder
1111
useradd --no-create-home --comment 'Builder' --uid $USER_ID --gid $GROUP_ID builder
12+
git config --global --add safe.directory /io
1213

13-
apt install -y libssl-dev
14-
apt install -y zlib1g-dev
14+
# apt install -y libssl-dev
15+
# apt install -y zlib1g-dev
1516

1617
export PYTHONDONTWRITEBYTECODE=1
1718

@@ -45,6 +46,7 @@ pushd /io
4546
for PY in ${PYTHONS[@]} ; do
4647
PYBIN=/opt/python/${PY}/bin
4748
"${PYBIN}/pip" install -r requirements_dev.txt
49+
rm -f ssh2/*.c
4850
su builder -c "\"${PYBIN}/python\" setup.py bdist_wheel --plat-name $PLAT"
4951
whl=$(echo dist/*-${PY}-${PLAT}.whl)
5052
su builder -c "\"${PYBIN}/python\" -m auditwheel repair --plat \"$PLAT\" --wheel-dir /io/wheelhouse/ \"$whl\""

doc/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
# The theme to use for HTML and HTML Help pages. See the documentation for
8888
# a list of builtin themes.
8989
#
90-
html_theme = 'sphinx_rtd_theme'
90+
html_theme = 'alabaster'
9191

9292
# Theme options are theme-specific and customize the look and feel of a theme
9393
# further. For a list of options available for each theme, see the

requirements_dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ Cython
22
flake8
33
jinja2
44
sphinx
5-
sphinx_rtd_theme
65
pytest
6+
setuptools_scm

setup.cfg

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
[versioneer]
2-
VCS = git
3-
style = pep440
4-
versionfile_source = ssh2/_version.py
5-
tag_prefix = ''
6-
71
[aliases]
82
test=pytest
93

setup.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import os
44
from glob import glob
55

6-
import versioneer
76
from setuptools import setup, find_packages
87

98
from Cython.Distutils.extension import Extension
@@ -52,20 +51,20 @@
5251

5352
package_data = {'ssh2': ['*.pxd']}
5453

55-
cmdclass = versioneer.get_cmdclass()
56-
cmdclass['build_ext'] = build_ext
5754

5855
setup(
5956
name='ssh2-python3',
60-
version=versioneer.get_version(),
61-
cmdclass=cmdclass,
57+
version="1.0", # not used when setuptools_scm is used.
58+
cmdclass={"build_ext": build_ext},
6259
packages=find_packages(
6360
'.', exclude=('embedded_server', 'embedded_server.*',
6461
'tests', 'tests.*',
6562
'*.tests', '*.tests.*')),
6663
zip_safe=False,
6764
include_package_data=True,
6865
tests_require=['pytest'],
66+
setup_requires=['setuptools_scm'],
67+
use_scm_version=True,
6968
python_requires='~=3.8',
7069
license='LGPLv2',
7170
author='Panos Kittenis',

ssh2/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def get_config():
4444
cfg = VersioneerConfig()
4545
cfg.VCS = "git"
4646
cfg.style = "pep440"
47-
cfg.tag_prefix = ""
47+
cfg.tag_prefix = "'v'"
4848
cfg.parentdir_prefix = "None"
4949
cfg.versionfile_source = "ssh2/_version.py"
5050
cfg.verbose = False

tasks.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,8 @@
4545
@task
4646
def info(ctx):
4747
"""Show information about the current Python and environment."""
48-
import versioneer
4948
suffix = get_suffix()
50-
version = versioneer.get_version()
49+
version = ctx.run(f"{PYTHONBIN} setup.py --version", hide="out").stdout.strip()
5150
print(f"Project version: {version}")
5251
print(f"Python being used: {PYTHONBIN}")
5352
print(f"Python extension suffix: {suffix}")
@@ -63,7 +62,8 @@ def build(ctx):
6362
@task
6463
def dev_requirements(ctx):
6564
"""Install development requirements."""
66-
ctx.run(f"{PYTHONBIN} -m pip install -r requirements_dev.txt --user")
65+
user = "" if os.environ.get("VIRTUAL_ENV") else "--user"
66+
ctx.run(f"{PYTHONBIN} -m pip install -r requirements_dev.txt {user}")
6767

6868

6969
@task
@@ -121,7 +121,7 @@ def wheels(ctx):
121121
f'-e USER_ID={uid} -e GROUP_ID={gid} '
122122
f'--mount type=bind,source={cwd},target=/io '
123123
f'wheel_builder /io/building/build-wheels.sh')
124-
ctx.run(cmd)
124+
ctx.run(cmd, hide=False, pty=True)
125125

126126

127127
@task
@@ -187,14 +187,18 @@ def publish(ctx, wheels=False):
187187

188188

189189
@task(pre=[dev_requirements, build_libssh2])
190-
def develop(ctx):
190+
def develop(ctx, uninstall=False):
191191
"""Start developing in developer mode.
192192
That means setting import paths to use this workspace.
193193
"""
194-
copy2(os.path.join(os.environ["LD_LIBRARY_PATH"], "libssh2.so.1.0.1"), "ssh2/libssh2.so.1")
195-
ctx.run(f'{PYTHONBIN} setup.py develop --user')
196-
for shared in glob("ssh2/*.so"):
197-
ctx.run(f"patchelf --set-rpath '$ORIGIN' {shared}")
194+
user = "" if os.environ.get("VIRTUAL_ENV") else "--user"
195+
if uninstall:
196+
ctx.run(f"{PYTHONBIN} setup.py develop --uninstall {user}")
197+
else:
198+
copy2(os.path.join(os.environ["LD_LIBRARY_PATH"], "libssh2.so.1.0.1"), "ssh2/libssh2.so.1")
199+
ctx.run(f'{PYTHONBIN} setup.py develop {user}')
200+
for shared in glob("ssh2/*.so"):
201+
ctx.run(f"patchelf --set-rpath '$ORIGIN' {shared}")
198202

199203

200204
@task(pre=[clean])

0 commit comments

Comments
 (0)