Skip to content

Commit

Permalink
gh-35104: Remove direct use of "setup.py sdist", add targets "make SP…
Browse files Browse the repository at this point in the history
…KG-sdist"

    
<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes #1234" use "Introduce new method to
calculate 1+1"
-->
### 📚 Description
Fixes #34855

<!-- Describe your changes here in detail -->
<!-- Why is this change required? What problem does it solve? -->
<!-- If it resolves an open issue, please link to the issue here. For
example "Closes #1337" -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->

- [x] I have made sure that the title is self-explanatory and the
description concisely explains the PR.
- [x] I have linked an issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies
<!-- List all open pull requests that this PR logically depends on -->
<!--
- #xyz: short description why this is a dependency
- #abc: ...
-->
    
URL: #35104
Reported by: Matthias Köppe
Reviewer(s): John H. Palmieri
  • Loading branch information
Release Manager committed Mar 18, 2023
2 parents a07e273 + c0f6348 commit df5d71a
Show file tree
Hide file tree
Showing 12 changed files with 84 additions and 48 deletions.
37 changes: 0 additions & 37 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -80,42 +80,6 @@ download:
dist: build/make/Makefile
./sage --sdist

pypi-sdists: sage_setup
./sage --sh build/pkgs/sage_conf/spkg-src
./sage --sh build/pkgs/sage_sws2rst/spkg-src
./sage --sh build/pkgs/sage_docbuild/spkg-src
./sage --sh build/pkgs/sage_setup/spkg-src
./sage --sh build/pkgs/sagelib/spkg-src
./sage --sh build/pkgs/sagemath_objects/spkg-src
./sage --sh build/pkgs/sagemath_categories/spkg-src
./sage --sh build/pkgs/sagemath_environment/spkg-src
./sage --sh build/pkgs/sagemath_repl/spkg-src
@echo "Built sdists are in upstream/"

# Ensuring wheels are present, even for packages that may have been installed
# as editable. Until we have better uninstallation of script packages, we
# just remove the timestamps, which will lead to rebuilds of the packages.
PYPI_WHEEL_PACKAGES = sage_sws2rst sage_setup sagemath_environment sagemath_objects sagemath_repl sagemath_categories
pypi-wheels:
for a in $(PYPI_WHEEL_PACKAGES); do \
rm -f venv/var/lib/sage/installed/$$a-*; \
done
for a in $(PYPI_WHEEL_PACKAGES); do \
$(MAKE) SAGE_EDITABLE=no SAGE_WHEELS=yes $$a; \
done
@echo "Built wheels are in venv/var/lib/sage/wheels/"

# sage_docbuild is here, not in PYPI_WHEEL_PACKAGES, because it depends on sagelib
WHEEL_PACKAGES = $(PYPI_WHEEL_PACKAGES) sage_conf sagelib sage_docbuild
wheels:
for a in $(WHEEL_PACKAGES); do \
rm -f venv/var/lib/sage/installed/$$a-*; \
done
for a in $(WHEEL_PACKAGES); do \
$(MAKE) SAGE_EDITABLE=no SAGE_WHEELS=yes $$a; \
done
@echo "Built wheels are in venv/var/lib/sage/wheels/"

###############################################################################
# Cleaning up
###############################################################################
Expand Down Expand Up @@ -380,7 +344,6 @@ list:
@$(MAKE) --silent -f build/make/Makefile SAGE_PKGCONFIG=dummy $@

.PHONY: default build dist install micro_release \
pypi-sdists pypi-wheels wheels \
misc-clean bdist-clean distclean bootstrap-clean maintainer-clean \
test check testoptional testall testlong testoptionallong testallong \
ptest ptestoptional ptestall ptestlong ptestoptionallong ptestallong \
Expand Down
45 changes: 44 additions & 1 deletion build/make/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,23 @@ PIP_PACKAGES = @SAGE_PIP_PACKAGES@
# Packages that use the 'script' package build rules
SCRIPT_PACKAGES = @SAGE_SCRIPT_PACKAGES@


# Packages for which we build wheels for PyPI
PYPI_WHEEL_PACKAGES = \
sage_sws2rst \
sage_setup \
sagemath_environment \
sagemath_objects \
sagemath_repl \
sagemath_categories

# sage_docbuild is here, not in PYPI_WHEEL_PACKAGES, because it depends on sagelib
WHEEL_PACKAGES = $(PYPI_WHEEL_PACKAGES) \
sage_conf \
sagelib \
sage_docbuild

# Packages for which build sdists for PyPI
PYPI_SDIST_PACKAGES = $(WHEEL_PACKAGES)

# Generate the actual inst_<pkgname> variables; for each package that is
# actually built this generates a line like:
Expand Down Expand Up @@ -198,6 +214,7 @@ SAGE_I_TARGETS = sagelib doc
# Tell make not to look for files with these names:
.PHONY: all all-sage all-toolchain all-build all-sageruntime \
all-start build-start base toolchain toolchain-deps base-toolchain \
pypi-sdists pypi-wheels wheels \
sagelib \
doc doc-html doc-html-jsmath doc-html-mathjax doc-pdf \
doc-uninstall \
Expand Down Expand Up @@ -418,6 +435,25 @@ list-broken-packages: auditwheel_or_delocate
echo >&2 "$$fix_broken_packages"; \
fi

pypi-sdists: $(PYPI_SDIST_PACKAGES:%=%-sdist)
@echo "Built sdists are in upstream/"

# Ensuring wheels are present, even for packages that may have been installed
# as editable. Until we have better uninstallation of script packages, we
# just remove the timestamps, which will lead to rebuilds of the packages.
pypi-wheels:
for a in $(PYPI_WHEEL_PACKAGES); do \
rm -f $(SAGE_VENV)/var/lib/sage/installed/$$a-*; \
done
$(MAKE_REC) SAGE_EDITABLE=no SAGE_WHEELS=yes $(PYPI_WHEEL_PACKAGES)
@echo "Built wheels are in venv/var/lib/sage/wheels/"

wheels:
for a in $(WHEEL_PACKAGES); do \
rm -f $(SAGE_VENV)/var/lib/sage/installed/$$a-*; \
done
$(MAKE_REC) SAGE_EDITABLE=no SAGE_WHEELS=yes $(WHEEL_PACKAGES)
@echo "Built wheels are in venv/var/lib/sage/wheels/"

#==============================================================================
# Setting SAGE_CHECK... variables
Expand Down Expand Up @@ -711,6 +747,13 @@ $(1)-uninstall: $(1)-$(4)-uninstall

$(1)-clean: $(1)-uninstall

$(1)-sdist: FORCE python_build sage_setup cython
$(AM_V_at) cd '$$(SAGE_ROOT)' && \
. '$$(SAGE_ROOT)/src/bin/sage-src-env-config' && \
. '$$(SAGE_ROOT)/src/bin/sage-env-config' && \
. '$$(SAGE_ROOT)/src/bin/sage-env' && \
'$$(SAGE_ROOT)/build/pkgs/$(1)/spkg-src'

# Recursive tox invocation (note - we do not set the environment here).
# Setting SAGE_SPKG_WHEELS is for the benefit of sagelib's tox.ini
$(1)-tox-%: FORCE
Expand Down
5 changes: 4 additions & 1 deletion build/pkgs/sage_conf/spkg-src
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,7 @@ fi
set -e

cd pkgs/sage-conf_pypi
python3 -u setup.py --no-user-cfg sdist --dist-dir "$SAGE_DISTFILES"
# Get rid of old *.egg-info/SOURCES.txt
rm -Rf *.egg-info

python3 -m build --sdist --no-isolation --skip-dependency-check --outdir "$SAGE_DISTFILES"
5 changes: 4 additions & 1 deletion build/pkgs/sage_docbuild/spkg-src
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@ set -e
cd build/pkgs/sage_docbuild

cd src
python3 -u setup.py --no-user-cfg sdist --dist-dir "$SAGE_DISTFILES"
# Get rid of old *.egg-info/SOURCES.txt
rm -Rf *.egg-info

python3 -m build --sdist --no-isolation --skip-dependency-check --outdir "$SAGE_DISTFILES"
5 changes: 4 additions & 1 deletion build/pkgs/sage_setup/spkg-src
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@ set -e
cd build/pkgs/sage_setup

cd src
python3 -u setup.py --no-user-cfg sdist --dist-dir "$SAGE_DISTFILES"
# Get rid of old *.egg-info/SOURCES.txt
rm -Rf *.egg-info

python3 -m build --sdist --no-isolation --skip-dependency-check --outdir "$SAGE_DISTFILES"
1 change: 1 addition & 0 deletions build/pkgs/sage_sws2rst/spkg-install
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ if [ "$SAGE_EDITABLE" = yes ]; then
else
sdh_pip_install .
fi
cd ..
# For type=script packages, spkg-check is not run
case "$SAGE_CHECK" in
yes)
Expand Down
5 changes: 4 additions & 1 deletion build/pkgs/sage_sws2rst/spkg-src
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@ set -e
cd build/pkgs/sage_sws2rst

cd src
python3 -u setup.py --no-user-cfg sdist --dist-dir "$SAGE_DISTFILES"
# Get rid of old *.egg-info/SOURCES.txt
rm -Rf *.egg-info

python3 -m build --sdist --no-isolation --skip-dependency-check --outdir "$SAGE_DISTFILES"
8 changes: 6 additions & 2 deletions build/pkgs/sagelib/spkg-src
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# This script is not used during build.
#
# HOW TO MAKE THE TARBALL:
# ./sage --sh build/pkgs/sagelib/spkg-src
# make python_build && ./sage --sh build/pkgs/sagelib/spkg-src

if [ -z "$SAGE_ROOT" ] ; then
echo >&2 "Error - SAGE_ROOT undefined ... exiting"
Expand All @@ -18,4 +18,8 @@ set -e
cd "$SAGE_ROOT"/build/pkgs/sagelib

cd src
python3 -u setup.py --no-user-cfg sdist --dist-dir "$SAGE_DISTFILES"

# Get rid of old *.egg-info/SOURCES.txt
rm -Rf *.egg-info

python3 -m build --sdist --no-isolation --skip-dependency-check --outdir "$SAGE_DISTFILES"
5 changes: 4 additions & 1 deletion build/pkgs/sagemath_categories/spkg-src
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@ set -e
cd build/pkgs/sagemath_categories

cd src
python3 -u setup.py --no-user-cfg sdist --dist-dir "$SAGE_DISTFILES"
# Get rid of old *.egg-info/SOURCES.txt
rm -Rf *.egg-info

python3 -m build --sdist --no-isolation --skip-dependency-check --outdir "$SAGE_DISTFILES"
5 changes: 4 additions & 1 deletion build/pkgs/sagemath_environment/spkg-src
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@ set -e
cd build/pkgs/sagemath_environment

cd src
python3 -u setup.py --no-user-cfg sdist --dist-dir "$SAGE_DISTFILES"
# Get rid of old *.egg-info/SOURCES.txt
rm -Rf *.egg-info

python3 -m build --sdist --no-isolation --skip-dependency-check --outdir "$SAGE_DISTFILES"
6 changes: 5 additions & 1 deletion build/pkgs/sagemath_objects/spkg-src
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,8 @@ set -e
cd build/pkgs/sagemath_objects

cd src
python3 -u setup.py --no-user-cfg sdist --dist-dir "$SAGE_DISTFILES"

# Get rid of old *.egg-info/SOURCES.txt
rm -Rf *.egg-info

python3 -m build --sdist --no-isolation --skip-dependency-check --outdir "$SAGE_DISTFILES"
5 changes: 4 additions & 1 deletion build/pkgs/sagemath_repl/spkg-src
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@ set -e
cd build/pkgs/sagemath_repl

cd src
python3 -u setup.py --no-user-cfg sdist --dist-dir "$SAGE_DISTFILES"
# Get rid of old *.egg-info/SOURCES.txt
rm -Rf *.egg-info

python3 -m build --sdist --no-isolation --skip-dependency-check --outdir "$SAGE_DISTFILES"

0 comments on commit df5d71a

Please sign in to comment.