Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion pkgs/sage-conf/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/_sage_conf/_conf.py
/setup.cfg
/build
/dist
/*.egg-info
Expand Down
1 change: 1 addition & 0 deletions pkgs/sage-conf_pypi/sage_root/.upstream.d
8 changes: 4 additions & 4 deletions pkgs/sage-conf_pypi/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ def run(self):
if os.environ.get('CONDA_PREFIX', ''):
SETENV = ':'
else:
SETENV = '(. ./.homebrew-build-env 2> /dev/null || :)'
SETENV = '. ./.homebrew-build-env 2> /dev/null'

SAGE_LOCAL = os.path.join(SAGE_ROOT, 'local')

if os.path.exists(os.path.join(SAGE_ROOT, 'config.status')):
print(f'Reusing configured SAGE_ROOT={SAGE_ROOT}')
else:
cmd = f"cd {SAGE_ROOT} && {SETENV} && ./configure --prefix={SAGE_LOCAL} --with-python={sys.executable} --enable-build-as-root --enable-download-from-upstream-url --with-system-python3=force --with-sage-venv --disable-notebook --disable-sagelib --disable-sage_conf --disable-doc"
cmd = f"cd {SAGE_ROOT} && ({SETENV}; ./configure --prefix={SAGE_LOCAL} --with-python={sys.executable} --enable-build-as-root --enable-download-from-upstream-url --with-system-python3=force --with-sage-venv --disable-notebook --disable-sagelib --disable-sage_conf --disable-doc)"
print(f"Running {cmd}")
sys.stdout.flush()
if os.system(cmd) != 0:
Expand Down Expand Up @@ -73,10 +73,10 @@ def run(self):
# (that use native libraries shared with other packages).
SETMAKE = 'if [ -z "$MAKE" ]; then export MAKE="make -j$(PATH=build/bin:$PATH build/bin/sage-build-num-threads | cut -d" " -f 2)"; fi'
TARGETS = 'build'
cmd = f'cd {SAGE_ROOT} && {SETENV} && {SETMAKE} && $MAKE V=0 {TARGETS}'
cmd = f'cd {SAGE_ROOT} && ({SETENV}; {SETMAKE} && $MAKE V=0 ${{SAGE_CONF_TARGETS-{TARGETS}}})'
print(f"Running {cmd}", flush=True)
if os.system(cmd) != 0:
raise DistutilsSetupError(f"make {TARGETS} failed")
raise SetupError(f"make ${{SAGE_CONF_TARGETS-{TARGETS}}} failed")

setuptools_build_py.run(self)

Expand Down
45 changes: 41 additions & 4 deletions pkgs/sage-conf_pypi/tox.ini
Original file line number Diff line number Diff line change
@@ -1,12 +1,49 @@
[tox]
envlist = python
envlist = py39, py310, py311, py39-user, py310-user, py311-user

[testenv]
[testenv:.pkg]
basepython = py311
passenv =
MAKE
# So that .homebrew-build-env will work
HOMEBREW

setenv =
HOME={envdir}
HOME={work_dir}/home
# Passed to 'make' instead of 'build'. We test here:
# - frobby (standalone program with dependency on gmp; tests that .homebrew-build-env is invoked correctly)
# - lrcalc_python (builds a platform wheel, possibly with use of system library)
# - coxeter3 (which allows us to build sagemath-coxeter3)
SAGE_CONF_TARGETS=frobby lrcalc_python coxeter3

[testenv:python]
package = wheel
deps =
# For the 'sage' script
sagemath-environment
setenv =
HOME={work_dir}/home
allowlist_externals =
bash
env
commands =
bash -c 'set -ex; eval $SETENV; \
sage-config; \
ls $(sage-config SAGE_SPKG_WHEELS); \
sage -sh -c "frobby genideal"; \
{envpython} -m pip install $(sage-config SAGE_SPKG_WHEELS)/*.whl'

[testenv:python-user]
package = wheel
deps =
{[testenv:python]deps}
setenv =
{[testenv:python]setenv}
PYTHONUSERBASE={work_dir}/userbase
SETENV=export PATH={env:PYTHONUSERBASE}/bin:{env:PATH}
system_site_packages = True
install_command = env PATH={env:PYTHONUSERBASE}/bin:{env_bin_dir} python -I -m pip install --user {opts} {packages}
allowlist_externals =
{[testenv:python]allowlist_externals}
commands =
sage-config
{[testenv:python]commands}