From 882ddfd0b8908fb06cca6c595139b992ef48aa4e Mon Sep 17 00:00:00 2001 From: Kishi85 Date: Wed, 19 Feb 2020 10:35:31 +0100 Subject: [PATCH] Generate proper dependencies on deb Packages --- .github/workflows/release.yml | 11 ++++- setup.py | 81 ++++++++++++++++------------------- 2 files changed, 47 insertions(+), 45 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ca8d0bb..ef48d52 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,6 +6,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + with: + fetch-depth: 0 - name: Install dependencies run: | sudo apt update -qq -y @@ -26,11 +28,18 @@ jobs: python3 setup.py bdist_wheel - name: Prepare stdeb build process + id: stdebprep run: | + # Patch setup.py to allow stdeb proper debian style builds sed "s/=determine_version()/='$(python3 setup.py --version)'/gi" -i setup.py sed "s@('readme'@('share/doc/python3-acertmgr'@" -i setup.py + # Determine recommended dependencies for deb package + echo "::set-output name=recommends3::$(echo "python3-pkg-resources")" + # Find optional dependencies to suggest in deb package + echo "::set-output name=suggests3::$(python3 -c "from setup import extra_requirements; print('\n'.join(['\n'.join(x) for x in extra_requirements.values()]))" | grep -v cryptography | sed 's/PyYAML/yaml/gi' | awk '{ printf("python3-%s, ",$1)};' | awk '{$1=$1; print}')" + - name: Build debian package using setuptools and stdeb - run: python3 setup.py --command-packages=stdeb.command bdist_deb + run: python3 setup.py --command-packages=stdeb.command sdist_dsc --with-python2=False --with-python3=True --recommends3="${{ steps.stdebprep.outputs.recommends3 }}" --suggests3="${{ steps.stdebprep.outputs.suggests3 }}" bdist_deb - name: Create a changelog from git log since last non-pre/rc tag run: | diff --git a/setup.py b/setup.py index 538eb80..c19bafa 100644 --- a/setup.py +++ b/setup.py @@ -45,49 +45,42 @@ def determine_version(): return version -setup( - name="acertmgr", - version=determine_version(), - author="Markus Hauschild", - author_email="moepman@binary-kitchen.de", - description="An automated certificate manager using ACME/letsencrypt", - license="ISC", - keywords="acme letsencrypt", - url="https://github.com/moepman/acertmgr", - packages=find_packages(), - long_description=read('README.md'), - long_description_content_type="text/markdown", - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Programming Language :: Python", - "Environment :: Console", - "Topic :: Security :: Cryptography", - "License :: OSI Approved :: ISC License (ISCL)", - ], - install_requires=[ - "cryptography>=0.6", - ], - extras_require={ - "dns": [ - "dnspython", +extra_requirements = { + "dns": ["dnspython"], + "yaml": ["PyYAML"], + "idna": ["idna"], + "ocsp-must-staple": ["cryptography>=2.1"], + "ed25519": ["cryptography>=2.6"], +} + +if __name__ == "__main__": + setup( + name="acertmgr", + version=determine_version(), + author="Markus Hauschild", + author_email="moepman@binary-kitchen.de", + description="An automated certificate manager using ACME/letsencrypt", + license="ISC", + keywords="acme letsencrypt", + url="https://github.com/moepman/acertmgr", + packages=find_packages(), + long_description=read('README.md'), + long_description_content_type="text/markdown", + classifiers=[ + "Development Status :: 5 - Production/Stable", + "Programming Language :: Python", + "Environment :: Console", + "Topic :: Security :: Cryptography", + "License :: OSI Approved :: ISC License (ISCL)", ], - "yaml": [ - "PyYAML", + install_requires=[ + "cryptography>=0.6", ], - "idna": [ - "idna", - ], - "ocsp-must-staple": [ - "cryptography>=2.1", - ], - "ed25519": [ - "cryptography>=2.6", - ], - }, - entry_points={ - 'console_scripts': [ - 'acertmgr=acertmgr:main', - ], - }, - data_files=[('readme', ['README.md'])] -) + extras_require=extra_requirements, + entry_points={ + 'console_scripts': [ + 'acertmgr=acertmgr:main', + ], + }, + data_files=[('readme', ['README.md'])] + )