Skip to content

Commit

Permalink
Remove "versioneer", replace with setuptools_scm.
Browse files Browse the repository at this point in the history
  • Loading branch information
kdart-brt committed Mar 14, 2023
1 parent 47250db commit ea47675
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 2,230 deletions.
6 changes: 4 additions & 2 deletions building/build-wheels.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ set -e -u -x
# add builder user and su to build to avoid creating root-owned files in host side.
groupadd --gid $GROUP_ID builder
useradd --no-create-home --comment 'Builder' --uid $USER_ID --gid $GROUP_ID builder
git config --global --add safe.directory /io

apt install -y libssl-dev
apt install -y zlib1g-dev
# apt install -y libssl-dev
# apt install -y zlib1g-dev

export PYTHONDONTWRITEBYTECODE=1

Expand Down Expand Up @@ -45,6 +46,7 @@ pushd /io
for PY in ${PYTHONS[@]} ; do
PYBIN=/opt/python/${PY}/bin
"${PYBIN}/pip" install -r requirements_dev.txt
rm -f ssh2/*.c
su builder -c "\"${PYBIN}/python\" setup.py bdist_wheel --plat-name $PLAT"
whl=$(echo dist/*-${PY}-${PLAT}.whl)
su builder -c "\"${PYBIN}/python\" -m auditwheel repair --plat \"$PLAT\" --wheel-dir /io/wheelhouse/ \"$whl\""
Expand Down
2 changes: 1 addition & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'
html_theme = 'alabaster'

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand Down
2 changes: 1 addition & 1 deletion requirements_dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ Cython
flake8
jinja2
sphinx
sphinx_rtd_theme
pytest
setuptools_scm
6 changes: 0 additions & 6 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
[versioneer]
VCS = git
style = pep440
versionfile_source = ssh2/_version.py
tag_prefix = ''

[aliases]
test=pytest

Expand Down
9 changes: 4 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import os
from glob import glob

import versioneer
from setuptools import setup, find_packages

from Cython.Distutils.extension import Extension
Expand Down Expand Up @@ -52,20 +51,20 @@

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

cmdclass = versioneer.get_cmdclass()
cmdclass['build_ext'] = build_ext

setup(
name='ssh2-python3',
version=versioneer.get_version(),
cmdclass=cmdclass,
version="1.0", # not used when setuptools_scm is used.
cmdclass={"build_ext": build_ext},
packages=find_packages(
'.', exclude=('embedded_server', 'embedded_server.*',
'tests', 'tests.*',
'*.tests', '*.tests.*')),
zip_safe=False,
include_package_data=True,
tests_require=['pytest'],
setup_requires=['setuptools_scm'],
use_scm_version=True,
python_requires='~=3.8',
license='LGPLv2',
author='Panos Kittenis',
Expand Down
2 changes: 1 addition & 1 deletion ssh2/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def get_config():
cfg = VersioneerConfig()
cfg.VCS = "git"
cfg.style = "pep440"
cfg.tag_prefix = ""
cfg.tag_prefix = "'v'"
cfg.parentdir_prefix = "None"
cfg.versionfile_source = "ssh2/_version.py"
cfg.verbose = False
Expand Down
22 changes: 13 additions & 9 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@
@task
def info(ctx):
"""Show information about the current Python and environment."""
import versioneer
suffix = get_suffix()
version = versioneer.get_version()
version = ctx.run(f"{PYTHONBIN} setup.py --version", hide="out").stdout.strip()
print(f"Project version: {version}")
print(f"Python being used: {PYTHONBIN}")
print(f"Python extension suffix: {suffix}")
Expand All @@ -63,7 +62,8 @@ def build(ctx):
@task
def dev_requirements(ctx):
"""Install development requirements."""
ctx.run(f"{PYTHONBIN} -m pip install -r requirements_dev.txt --user")
user = "" if os.environ.get("VIRTUAL_ENV") else "--user"
ctx.run(f"{PYTHONBIN} -m pip install -r requirements_dev.txt {user}")


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


@task
Expand Down Expand Up @@ -187,14 +187,18 @@ def publish(ctx, wheels=False):


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


@task(pre=[clean])
Expand Down
Loading

0 comments on commit ea47675

Please sign in to comment.