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 From f0aca673ba3f2e5e10aefa4505ebd14ede01139d Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Wed, 11 May 2022 08:33:48 -0600 Subject: Add back "sdist" zipfile [skip appveyor] Uncommented the code building a zipfile of the release. This is done "the old way" (calling setup.py with args), since the "build" tool doesn't handle this. Signed-off-by: Mats Wichmann --- ReleaseConfig | 6 +++--- SConstruct | 11 +++++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/ReleaseConfig b/ReleaseConfig index 2b80306..1d5455d 100755 --- a/ReleaseConfig +++ b/ReleaseConfig @@ -27,9 +27,9 @@ # The version tuple that will be used for the release. The fields are # (major, minor, micro, type, patchlevel). The release level is one of -# 'alpha', 'beta', 'candidate', or 'final'. If the release type is not -# 'final', the patchlevel is set to the release date. This value is -# mandatory and must be present in this file. +# 'a' (alpha), 'b' (beta), 'rc' (release candidate), or 'final'. +# If the release type is not 'final', the patchlevel is set to the +# release date. This value is mandatory and must be present in this file. #version_tuple = (2, 2, 0, 'final', 0) version_tuple = (4, 5, 2, 'a', 0) diff --git a/SConstruct b/SConstruct index bd090d5..46cb814 100644 --- a/SConstruct +++ b/SConstruct @@ -209,10 +209,13 @@ wheel = env.Command( action='$PYTHON -m build --outdir $DISTDIR', ) -# 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') +# TODO: this is built the old way, because "build" doesn't make zipfiles, +# and it deletes its isolated env so we can't just zip that one up. +zip_file = env.Command( + target='$DISTDIR/SCons-${VERSION}.zip', + source=['setup.cfg', 'setup.py', 'SCons/__init__.py'] + man_pages, + action='$PYTHON setup.py sdist --format=zip', +) # Now set depends so the above run in a particular order # NOTE: 'build' with default options builds sdist, then whl from sdist, -- cgit v0.12 From d8f70f27f1e15bd666667d382af3620cd11a16d5 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Wed, 10 Aug 2022 14:02:06 -0600 Subject: Restore accidentally dropped dep [skip appveyor] When merging upstream, where the requirements file had already been split into three, dropped the install of the "build" package which is the main purpose of this PR. It was still in the GitHub action setup, so the CI run went fine. Signed-off-by: Mats Wichmann --- requirements-pkg.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/requirements-pkg.txt b/requirements-pkg.txt index ae71cde..3fb4aeb 100644 --- a/requirements-pkg.txt +++ b/requirements-pkg.txt @@ -11,3 +11,5 @@ readme-renderer sphinx < 6.0 sphinx-book-theme rst2pdf + +build -- cgit v0.12