Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit cdfd3ee

Browse files
author
Matthias Koeppe
committed
Merge #32874
2 parents 938d3bb + 25898ba commit cdfd3ee

File tree

18 files changed

+305
-93
lines changed

18 files changed

+305
-93
lines changed

.gitignore

+6-1
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,15 @@ __pycache__/
131131
# Generated Cython files
132132
*.so
133133
**/*.so
134+
/src/cython_debug
135+
# Most C and C++ files are generated by Cython and should not
136+
# be included in the sdist.
134137
/src/sage/**/*.c
135138
/src/sage/**/*.cpp
139+
# C header generated by Cython
136140
/src/sage/modular/arithgroup/farey_symbol.h
141+
# List of C and C++ files that are actual source files,
142+
# NOT generated by Cython. The same list appears in src/MANIFEST.in
137143
!/src/sage/cpython/debugimpl.c
138144
!/src/sage/graphs/base/boost_interface.cpp
139145
!/src/sage/graphs/cliquer/cl.c
@@ -156,7 +162,6 @@ __pycache__/
156162
!/src/sage/stats/distributions/dgs_gauss_dp.c
157163
!/src/sage/stats/distributions/dgs_gauss_mp.c
158164
!/src/sage/symbolic/ginac/*.cpp
159-
/src/cython_debug
160165

161166
# Temporary build files
162167
build/temp.*/

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ pypi-wheels:
101101
rm -f venv/var/lib/sage/installed/$$a-*; \
102102
done
103103
for a in $(PYPI_WHEEL_PACKAGES); do \
104-
$(MAKE) SAGE_EDITABLE=no $$a; \
104+
$(MAKE) SAGE_EDITABLE=no SAGE_WHEELS=yes $$a; \
105105
done
106106
@echo "Built wheels are in venv/var/lib/sage/wheels/"
107107

@@ -112,7 +112,7 @@ wheels:
112112
rm -f venv/var/lib/sage/installed/$$a-*; \
113113
done
114114
for a in $(WHEEL_PACKAGES); do \
115-
$(MAKE) SAGE_EDITABLE=no $$a; \
115+
$(MAKE) SAGE_EDITABLE=no SAGE_WHEELS=yes $$a; \
116116
done
117117
@echo "Built wheels are in venv/var/lib/sage/wheels/"
118118

build/bin/sage-build-env

+4
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ if [ "x$SAGE_BUILD_ENV_SOURCED" = "x" ]; then
3131
if [ "x$SAGE_EDITABLE" = "x" ]; then
3232
export SAGE_EDITABLE="$CONFIGURED_SAGE_EDITABLE"
3333
fi
34+
# Likewise for SAGE_WHEELS
35+
if [ "x$SAGE_WHEELS" = "x" ]; then
36+
export SAGE_WHEELS="$CONFIGURED_SAGE_WHEELS"
37+
fi
3438

3539
# This is usually blank if the system GMP is used, or $SAGE_LOCAL otherwise
3640
if [ -n "$SAGE_GMP_PREFIX" ]; then

build/bin/sage-build-env-config.in

+1
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,4 @@ export SAGE_SUITESPARSE_PREFIX="@SAGE_SUITESPARSE_PREFIX@"
5858
export SAGE_CONFIGURE_FFLAS_FFPACK="@SAGE_CONFIGURE_FFLAS_FFPACK@"
5959

6060
export CONFIGURED_SAGE_EDITABLE="@SAGE_EDITABLE@"
61+
export CONFIGURED_SAGE_WHEELS="@SAGE_WHEELS@"

build/bin/sage-pip-install

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ PIP=pip3
2828
# We should avoid running pip while installing a package because that
2929
# is prone to race conditions. Therefore, we use a lockfile while
3030
# running pip. This is implemented in the Python script sage-flock
31-
LOCK="$SAGE_LOCAL/var/lock/$PIP.lock"
31+
LOCK="$SAGE_VENV/var/lock/$PIP.lock"
3232

3333
# Trac #33155: Pythons installed using the python.org macOS installers
3434
# for Python < 3.10 identify macOS Big Sur and newer as "10.16", causing

build/bin/sage-pip-uninstall

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ PIP=pip3
1414
# We should avoid running pip while uninstalling a package because that
1515
# is prone to race conditions. Therefore, we use a lockfile while
1616
# running pip. This is implemented in the Python script sage-flock
17-
LOCK="$SAGE_LOCAL/var/lock/$PIP.lock"
17+
LOCK="$SAGE_VENV/var/lock/$PIP.lock"
1818

1919
# --disable-pip-version-check: Don't periodically check PyPI to determine whether a new version of pip is available
2020
# --no-input: Disable prompting for input.

build/pkgs/sage_conf/spkg-install

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ fi
1212
cd src
1313
if [ "$SAGE_EDITABLE" = yes ]; then
1414
sdh_pip_editable_install .
15+
if [ "$SAGE_WHEELS" = yes ]; then
16+
sdh_setup_bdist_wheel && sdh_store_wheel .
17+
fi
1518
else
1619
sdh_pip_install .
1720
fi

build/pkgs/sage_docbuild/spkg-install

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ fi
1212
cd src
1313
if [ "$SAGE_EDITABLE" = yes ]; then
1414
sdh_pip_editable_install .
15+
if [ "$SAGE_WHEELS" = yes ]; then
16+
sdh_setup_bdist_wheel && sdh_store_wheel .
17+
fi
1518
else
1619
sdh_pip_install .
1720
fi

build/pkgs/sage_setup/spkg-install

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ fi
1212
cd src
1313
if [ "$SAGE_EDITABLE" = yes ]; then
1414
sdh_pip_editable_install .
15+
if [ "$SAGE_WHEELS" = yes ]; then
16+
sdh_setup_bdist_wheel && sdh_store_wheel .
17+
fi
1518
else
1619
sdh_pip_install .
1720
fi

build/pkgs/sage_sws2rst/spkg-install

+10-5
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,21 @@
33
# For type=script packages, the build rule in build/make/Makefile sources
44
# sage-env but not sage-dist-helpers.
55
lib="$SAGE_ROOT/build/bin/sage-dist-helpers"
6-
. "$lib"
6+
source "$lib"
77
if [ $? -ne 0 ]; then
88
echo >&2 "Error: failed to source $lib"
99
echo >&2 "Is $SAGE_ROOT the correct SAGE_ROOT?"
1010
exit 1
1111
fi
12-
set -e
13-
# We build the wheel directly with "setup.py bdist_wheel", not with "pip wheel",
14-
# because pip does not handle our symlinks correctly.
15-
(cd src && sdh_setup_bdist_wheel && sdh_store_and_pip_install_wheel .)
12+
cd src
13+
if [ "$SAGE_EDITABLE" = yes ]; then
14+
sdh_pip_editable_install .
15+
if [ "$SAGE_WHEELS" = yes ]; then
16+
sdh_setup_bdist_wheel && sdh_store_wheel .
17+
fi
18+
else
19+
sdh_pip_install .
20+
fi
1621
# For type=script packages, spkg-check is not run
1722
case "$SAGE_CHECK" in
1823
yes)

build/pkgs/sagelib/spkg-install

+26-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
#!/usr/bin/env bash
2+
# From sage-spkg.
3+
# For type=script packages, the build rule in build/make/Makefile sources
4+
# sage-env but not sage-dist-helpers.
5+
lib="$SAGE_ROOT/build/bin/sage-dist-helpers"
6+
source "$lib"
7+
if [ $? -ne 0 ]; then
8+
echo >&2 "Error: failed to source $lib"
9+
echo >&2 "Is $SAGE_ROOT the correct SAGE_ROOT?"
10+
exit 1
11+
fi
12+
213
if [ "$SAGE_EDITABLE" = yes ]; then
314
cd "$SAGE_SRC"
415
else
@@ -27,8 +38,6 @@ export SAGE_SRC_ROOT=/doesnotexist
2738
export SAGE_DOC_SRC=/doesnotexist
2839
export SAGE_BUILD_DIR=/doesnotexist
2940

30-
export PYTHON="$SAGE_LOCAL/bin/python3"
31-
3241
# We also poison all directories below SAGE_LOCAL.
3342
export SAGE_PKGCONFIG=/doesnotexist
3443
export SAGE_SPKG_SCRIPTS=/doesnotexist
@@ -51,17 +60,27 @@ if [ "$SAGE_EDITABLE" = yes ]; then
5160
# under the old distribution name "sage" (before #30912, which switched to setuptools
5261
# and renamed the distribution to "sagemath-standard"). There is no clean way to uninstall
5362
# them, so we just use rm.
54-
(cd "$SITEPACKAGESDIR" && rm -rf sage sage_setup sage-[1-9]*.egg-info sage-[1-9]*.dist-info)
55-
# Until https://trac.sagemath.org/ticket/34209 switches us to PEP 660 editable wheels
56-
export SETUPTOOLS_ENABLE_FEATURES=legacy-editable
57-
time python3 -m pip install --verbose --no-deps --no-index --no-build-isolation --isolated --editable . || exit 1
63+
(cd "$SITEPACKAGESDIR" && rm -rf sage sage-[1-9]*.egg-info sage-[1-9]*.dist-info)
64+
time sdh_pip_editable_install .
65+
66+
if [ "$SAGE_WHEELS" = yes ]; then
67+
# Additionally build a wheel (for use in other venvs)
68+
cd $SAGE_PKGS/sagelib/src && time sdh_setup_bdist_wheel && sdh_store_wheel .
69+
fi
5870
else
5971
# Make sure that an installed old version of sagelib in which sage is an ordinary package
6072
# does not shadow the namespace package sage during the build.
6173
(cd "$SITEPACKAGESDIR" && rm -f sage/__init__.py)
6274
# Likewise, we should remove the egg-link that may have been installed previously.
6375
(cd "$SITEPACKAGESDIR" && rm -f sagemath-standard.egg-link)
64-
time python3 -u setup.py --no-user-cfg build install || exit 1
76+
77+
if [ "$SAGE_WHEELS" = yes ]; then
78+
# Use --no-build-isolation to avoid rebuilds because of dependencies:
79+
# Compiling sage/interfaces/sagespawn.pyx because it depends on /private/var/folders/38/wnh4gf1552g_crsjnv2vmmww0000gp/T/pip-build-env-609n5985/overlay/lib/python3.10/site-packages/Cython/Includes/posix/unistd.pxd
80+
time sdh_pip_install --no-build-isolation .
81+
else
82+
time python3 -u setup.py --no-user-cfg build install || exit 1
83+
fi
6584
fi
6685

6786
# Trac #33103: The temp.* directories are large after a full build.

configure.ac

+6
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,12 @@ AC_ARG_ENABLE([editable],
132132
[AC_SUBST([SAGE_EDITABLE], [$enableval])],
133133
[AC_SUBST([SAGE_EDITABLE], [yes])])
134134

135+
AC_ARG_ENABLE([wheels],
136+
[AS_HELP_STRING([--enable-wheels],
137+
[build wheels for the Sage library and update them on "sage -b"; if disabled, use "make wheels" to build wheels])],
138+
[AC_SUBST([SAGE_WHEELS], [$enableval])],
139+
[])
140+
135141
# Check whether we are on a supported platform
136142
AC_CANONICAL_BUILD()
137143
AC_CANONICAL_HOST()

pkgs/sagemath-standard/setup.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@
1515
import multiprocessing
1616
multiprocessing.set_start_method('fork', force=True)
1717

18+
# If build isolation is not in use and setuptools_scm is installed,
19+
# then its file_finders entry point is invoked, which we don't need.
20+
# Workaround from ​https://github.com/pypa/setuptools_scm/issues/190#issuecomment-351181286
21+
try:
22+
import setuptools_scm.integration
23+
setuptools_scm.integration.find_files = lambda _: []
24+
except ImportError:
25+
pass
26+
1827
#########################################################
1928
### Set source directory
2029
#########################################################
@@ -30,7 +39,7 @@
3039
### Configuration
3140
#########################################################
3241

33-
if len(sys.argv) > 1 and (sys.argv[1] == "sdist" or sys.argv[1] == "egg_info"):
42+
if len(sys.argv) > 1 and (sys.argv[1] in ["sdist", "egg_info", "dist_info"]):
3443
sdist = True
3544
else:
3645
sdist = False

src/MANIFEST.in

+43-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,47 @@
1-
global-include *.c *.cc *.cpp *.h *.hh *.hpp *.inc *.py *.pyx *.pxd *.pxi *.rst *.txt *.tex
2-
3-
include MANIFEST.in
4-
include pyproject.toml
5-
6-
prune .tox
7-
81
prune sage/ext/interpreters # In particular, __init__.py must not be present in the distribution; or sage_setup.autogen.interpreters.rebuild will not generate the code
92
prune sage_setup
103
prune sage_docbuild
114
prune doc
5+
6+
#
7+
# Most C and C++ files are generated by Cython and should not
8+
# be included in the sdist.
9+
#
10+
global-exclude *.c
11+
global-exclude *.cpp
12+
13+
#
14+
# List of C and C++ files that are actual source files,
15+
# NOT generated by Cython. The same list appears in SAGE_ROOT/.gitignore
16+
#
17+
include sage/cpython/debugimpl.c
18+
include sage/graphs/base/boost_interface.cpp
19+
include sage/graphs/cliquer/cl.c
20+
include sage/graphs/graph_decompositions/sage_tdlib.cpp
21+
include sage/libs/eclib/wrap.cpp
22+
include sage/libs/linkages/padics/relaxed/flint_helper.c
23+
include sage/misc/inherit_comparison_impl.c
24+
include sage/modular/arithgroup/farey.cpp
25+
include sage/modular/arithgroup/sl2z.cpp
26+
include sage/rings/bernmm/bern_modp.cpp
27+
include sage/rings/bernmm/bern_modp_util.cpp
28+
include sage/rings/bernmm/bern_rat.cpp
29+
include sage/rings/bernmm/bernmm-test.cpp
30+
include sage/rings/padics/transcendantal.c
31+
include sage/rings/polynomial/weil/power_sums.c
32+
include sage/schemes/hyperelliptic_curves/hypellfrob/hypellfrob.cpp
33+
include sage/schemes/hyperelliptic_curves/hypellfrob/recurrences_ntl.cpp
34+
include sage/schemes/hyperelliptic_curves/hypellfrob/recurrences_zn_poly.cpp
35+
include sage/stats/distributions/dgs_bern.c
36+
include sage/stats/distributions/dgs_gauss_dp.c
37+
include sage/stats/distributions/dgs_gauss_mp.c
38+
include sage/symbolic/ginac/*.cpp
39+
40+
global-exclude __pycache__
41+
global-exclude *.py[co]
42+
global-exclude *.bak
43+
global-exclude *.so
44+
global-exclude *~
45+
prune .tox
46+
prune build
47+
prune dist

src/sage/libs/linkages/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)