From ad71fd6530cf45e8e4623214444633838459a115 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Thu, 28 Oct 2021 07:53:11 -0600 Subject: Packaging: don't call setup.py directly, use build [skip appveyor] Signed-off-by: Mats Wichmann --- .github/workflows/scons-package.yml | 2 +- SConstruct | 26 +++++++++++++++++--------- setup.cfg | 6 +++--- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/.github/workflows/scons-package.yml b/.github/workflows/scons-package.yml index 4c0a148..c0c4e52 100644 --- a/.github/workflows/scons-package.yml +++ b/.github/workflows/scons-package.yml @@ -23,7 +23,7 @@ jobs: - name: Install dependencies run: | - python -m pip install --upgrade pip setuptools wheel + python -m pip install --upgrade pip setuptools wheel build #python -m pip install flake8 pytest if [ -f requirements-pkg.txt ]; then pip install -r requirements-pkg.txt; elif [ -f requirements.txt ]; then pip install -r requirements.txt; fi sudo apt-get update diff --git a/SConstruct b/SConstruct index 1f44ea4..bd090d5 100644 --- a/SConstruct +++ b/SConstruct @@ -196,20 +196,28 @@ Export('command_line', 'env', 'whereis', 'revaction') SConscript('doc/SConscript') -# Copy manpage's into base dir for inclusion in pypi packages +# Copy manpages into base dir for inclusion in pypi packages man_pages = env.Install("#/", Glob("#/build/doc/man/*.1")) -# Build packages for pypi -wheel = env.Command('$DISTDIR/SCons-${VERSION}-py3-none-any.whl', ['setup.cfg', 'setup.py', 'SCons/__init__.py']+man_pages, - '$PYTHON setup.py bdist_wheel') +# Build packages for pypi. 'build' makes sdist (tgz) + whl +wheel = env.Command( + target=[ + '$DISTDIR/SCons-${VERSION}-py3-none-any.whl', + '$DISTDIR/SCons-${VERSION}.tar.gz', + ], + source=['setup.cfg', 'setup.py', 'SCons/__init__.py'] + man_pages, + action='$PYTHON -m build --outdir $DISTDIR', +) -zip_file = env.Command('$DISTDIR/SCons-${VERSION}.zip', ['setup.cfg', 'setup.py', 'SCons/__init__.py']+man_pages, - '$PYTHON setup.py sdist --format=zip') -tgz_file = env.Command('$DISTDIR/SCons-${VERSION}.tar.gz', ['setup.cfg', 'setup.py', 'SCons/__init__.py']+man_pages, - '$PYTHON setup.py sdist --format=gztar') +# Do we actually need this one? +# zip_file = env.Command('$DISTDIR/SCons-${VERSION}.zip', ['setup.cfg', 'setup.py', 'SCons/__init__.py']+man_pages, +# #'$PYTHON setup.py sdist --format=zip') +# '$PYTHON setup.py sdist --format=zip') # Now set depends so the above run in a particular order -env.Depends(tgz_file, [zip_file, wheel]) +# NOTE: 'build' with default options builds sdist, then whl from sdist, +# so it's already ordered. +# env.Depends(tgz_file, [zip_file, wheel]) # NOTE: Commenting this out as the manpages are expected to be in the base directory when manually # running setup.py from the base of the repo. diff --git a/setup.cfg b/setup.cfg index f177d6f..e4f37af 100644 --- a/setup.cfg +++ b/setup.cfg @@ -45,10 +45,10 @@ classifiers = [options] zip_safe = False python_requires = >=3.6 -install_requires = +install_requires = setuptools +setup_requires = setuptools - -setup_requires = setuptools + build include_package_data = True packages = find: -- cgit v0.12