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

Commit

Permalink
Merge #33671
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Aug 14, 2022
2 parents 12be2d9 + 84a5e13 commit 193174b
Show file tree
Hide file tree
Showing 21 changed files with 465 additions and 33 deletions.
16 changes: 16 additions & 0 deletions .devcontainer/develop-docker-cocalc/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// See https://aka.ms/devcontainer.json for format details.
{
"name": "CoCalc Docker",
"image": "sagemathinc/cocalc",
"containerEnv": {
"MAKE": "make -j12"
},
// Run commands after the container is created.
// libgmp.a is broken and leads to a build failure of ecm.
"postCreateCommand": ".devcontainer/post_create.sh && rm -f /usr/local/sage/local/lib/libgmp.a",
// Run commands after the container is started.
"postStartCommand": "make configure && ./configure --enable-build-as-root --prefix=/usr/local/sage/local --with-sage-venv && make build V=0",
"extensions": [
"ms-python.python"
]
}
21 changes: 21 additions & 0 deletions .devcontainer/develop-docker-computop/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// See https://aka.ms/devcontainer.json for format details.
{
"name": "computop/sage Docker",
"image": "computop/sage",
"containerEnv": {
"MAKE": "make -j12"
},
// Run commands after the container is created.
// Install build tools, get rid of sourcing /sage/activate in non-login shells.
// libgmp.a is broken and leads to a build failure of ecm.
"postCreateCommand": ".devcontainer/post_create.sh --sudo && sudo rm -f /sage/local/lib/libgmp.a && sed -i.bak '/sage.*activate/d' ~/.bashrc",
// Run commands after the container is started.
// Do not run configure within a sage-env (see #29485).
// The pari package is broken in the computop/sage 9.5 image, need to reinstall.
// Also libnauty is broken.

"postStartCommand": "make configure && (export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin && unset CFLAGS LDFLAGS CXXFLAGS CPATH LIBRARY_PATH && ./configure --prefix=/sage/local --with-sage-venv) && make pari-clean nauty-clean build V=0",
"extensions": [
"ms-python.python"
]
}
12 changes: 12 additions & 0 deletions .devcontainer/downstream-archlinux-latest/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// See https://aka.ms/devcontainer.json for format details.
{
"name": "archlinux:latest downstream Sage",
"image": "archlinux:latest",
// Run commands after the container is created.
"postCreateCommand": "EXTRA_SYSTEM_PACKAGES='sagemath sagemath-doc' EXTRA_SAGE_PACKAGES='notebook pip' .devcontainer/post_create.sh",
// Run commands after the container is started.
"postStartCommand": "make configure && ln -sf /usr venv",
"extensions": [
"ms-python.python"
]
}
20 changes: 20 additions & 0 deletions .devcontainer/downstream-conda-forge-latest/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// See https://aka.ms/devcontainer.json for format details.
{
"name": "condaforge/mambaforge:latest downstream Sage",
"image": "condaforge/mambaforge:latest",
// Run commands after the container is created.
"postCreateCommand": "mamba install --yes sage",
// Run commands after the container is started.
// * If the workspace directory looks like a copy of the Sage source tree (SAGE_ROOT):
// - it bootstraps and configures the Sage distribution,
// - thus, the script ``./sage`` and the symlinks ``prefix``, ``venv`` are set as expected,
// - the source tree is prepared for rebuilding Sage based from the source tree on
// top of the existing installation from the Docker image.
// - however, it does not start the build.
// * Otherwise, it does nothing. This is so that users can copy this devcontainer.json file as is
// into their projects.
"postStartCommand": "if [ -d pkgs/sagemath-standard ]; then make configure && ln -sf $CONDA_PREFIX venv; else echo 'Edit .devcontainer/devcontainer.json (postStartCommand) to run project-specific startup commands'; fi",
"extensions": [
"ms-python.python"
]
}
21 changes: 21 additions & 0 deletions .devcontainer/downstream-docker-cocalc/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// See https://aka.ms/devcontainer.json for format details.
{
"name": "CoCalc Docker",
"image": "sagemathinc/cocalc",
"containerEnv": {
"MAKE": "make -j12"
},
// Run commands after the container is created.
// libgmp.a is broken and leads to a build failure of ecm.
"postCreateCommand": ".devcontainer/post_create.sh && rm -f /usr/local/sage/local/lib/libgmp.a",
// Run commands after the container is started.
// * If the workspace directory looks like a copy of the Sage source tree (SAGE_ROOT):
// - it bootstraps the Sage distribution,
// - sets the symlink ``venv`` as expected,
// * Otherwise, it does nothing. This is so that users can copy this devcontainer.json file as is
// into their projects.
"postStartCommand": "if [ -d pkgs/sagemath-standard ]; then make configure && ./configure --enable-build-as-root --prefix=/usr/local/sage/local --with-sage-venv; else echo 'Edit .devcontainer/devcontainer.json (postStartCommand) to run project-specific startup commands'; fi",
"extensions": [
"ms-python.python"
]
}
21 changes: 21 additions & 0 deletions .devcontainer/downstream-docker-computop/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// See https://aka.ms/devcontainer.json for format details.
{
"name": "computop/sage Docker",
"image": "computop/sage",
"containerEnv": {
"MAKE": "make -j12"
},
// Run commands after the container is created.
// Install build tools, get rid of sourcing /sage/activate in non-login shells.
// libgmp.a is broken and leads to a build failure of ecm.
"postCreateCommand": ".devcontainer/post_create.sh --sudo && sudo rm -f /sage/local/lib/libgmp.a && sed -i.bak '/sage.*activate/d' ~/.bashrc",
// Run commands after the container is started.
// Do not run configure within a sage-env (see #29485).
// The pari package is broken in the computop/sage 9.5 image, need to reinstall.
// Also libnauty is broken.

"postStartCommand": "make configure && (export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin && unset CFLAGS LDFLAGS CXXFLAGS CPATH LIBRARY_PATH && ./configure --prefix=/sage/local --with-sage-venv)",
"extensions": [
"ms-python.python"
]
}
14 changes: 14 additions & 0 deletions .devcontainer/downstream-docker-sagemath/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// See https://aka.ms/devcontainer.json for format details.
{
"name": "sagemath/sagemath Docker",
"image": "sagemath/sagemath:develop",
// Run commands after the container is created.
// Install build tools.
"postCreateCommand": ".devcontainer/post_create.sh --sudo"
// Run commands after the container is started.
// Do not run configure within a sage-env (see #29485).
"postStartCommand": "if [ -d pkgs/sagemath-standard ]; then ln -sf /home/sage/sage/venv venv && ln -sf /home/sage/sage/local prefix; else echo 'Edit .devcontainer/devcontainer.json (postStartCommand) to run project-specific startup commands'; fi",
"extensions": [
"ms-python.python"
]
}
8 changes: 8 additions & 0 deletions .devcontainer/portability-Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This Dockerfile is used by all portability-.../devcontainer.json files,
# which provide the actual values for the 4 arguments defined below, which
# feed into the FROM statement that determines the base Docker image.
ARG SYSTEM_FACTOR="ubuntu-jammy"
ARG PACKAGE_FACTOR="standard"
ARG DOCKER_TARGET="with-system-packages"
ARG DOCKER_TAG="dev"
FROM ghcr.io/sagemath/sage/sage-docker-${SYSTEM_FACTOR}-${PACKAGE_FACTOR}-${DOCKER_TARGET}:${DOCKER_TAG}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// See https://aka.ms/devcontainer.json for format details.
{
"name": "Centos 7",
"build": {
"dockerfile": "portability-Dockerfile",
// See tox.ini for definitions.
"args": { "SYSTEM_FACTOR": "centos-7-devtoolset-gcc_11",
"PACKAGE_FACTOR": "standard",
"DOCKER_TARGET": "with-targets",
"DOCKER_TAG": "dev"
}
},
"containerEnv": {
"MAKE": "make -j12"
},
// Run commands after the container is created.
"postCreateCommand": ".devcontainer/post_create.sh",
// Run commands after the container is started.
"postStartCommand": ". /opt/rh/devtoolset-11/enable && .devcontainer/portability-post_start.sh",
"extensions": [
"ms-python.python"
]
}
30 changes: 30 additions & 0 deletions .devcontainer/portability-post_start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#! /bin/sh
# The portability-.../devcontainer.json configurations run this script after
# the container is started.
#
# The script assumes that it is run from SAGE_ROOT.
#
# If "config.log" or "logs" are symlinks (for example, created by 'tox -e local-...',
# or after https://trac.sagemath.org/ticket/33262), they might point outside of
# the dev container, so remove them. Likewise for upstream.
for f in config.log logs upstream; do
if [ -L $f ]; then
rm -f $f
fi
done
# If possible (ensured after https://trac.sagemath.org/ticket/33262), keep the
# logs in the container.
if [ ! -d logs ]; then
ln -s /sage/logs logs
fi
# Bootstrap, configure, and build the Sage distribution, reusing the Sage
# installation from the prebuilt image.
set -e
set -x
make configure
if [ -x /sage/config.status ]; then
eval ./configure $(/sage/config.status --config) --enable-build-as-root --prefix=/sage/local --with-sage-venv
else
./configure --enable-build-as-root --prefix=/sage/local --with-sage-venv
fi
make build V=0
23 changes: 23 additions & 0 deletions .devcontainer/portability-ubuntu-jammy-standard/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// See https://aka.ms/devcontainer.json for format details.
{
"name": "Ubuntu jammy",
"build": {
"dockerfile": "portability-Dockerfile",
// See tox.ini for definitions
"args": { "SYSTEM_FACTOR": "ubuntu-jammy",
"PACKAGE_FACTOR": "standard",
"DOCKER_TARGET": "with-targets",
"DOCKER_TAG": "dev"
}
},
"containerEnv": {
"MAKE": "make -j12"
},
// Run commands after the container is created.
"postCreateCommand": ".devcontainer/post_create.sh",
// Run commands after the container is started.
"postStartCommand": ".devcontainer/portability-post_start.sh",
"extensions": [
"ms-python.python"
]
}
9 changes: 9 additions & 0 deletions .devcontainer/post_create.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#! /bin/sh
# Run this script from SAGE_ROOT. Invoke with "--sudo" if sudo is needed.
export PATH=$(pwd)/build/bin:$PATH
SYSTEM=$(sage-guess-package-system)
eval $(sage-print-system-package-command $SYSTEM "$@" update)
eval $(sage-print-system-package-command $SYSTEM --yes "$@" --spkg install _prereq python3 git $EXTRA_SAGE_PACKAGES)
if [ -n "$EXTRA_SYSTEM_PACKAGES" ]; then
eval $(sage-print-system-package-command $SYSTEM --yes "$@" install $EXTRA_SYSTEM_PACKAGES)
fi
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@ src/ENV/
src/env.bak/
src/venv.bak/

# devcontainer
/.devcontainer/devcontainer.json

# mypy
**/.mypy_cache/

Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@
"python.linting.pycodestyleEnabled": true,
"python.linting.enabled": true,
"cSpell.words": [
"furo"
"furo",
"Conda",
"sagemath",
"Cython"
],
}
2 changes: 1 addition & 1 deletion build/bin/sage-print-system-package-command
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ case $system:$command in
;;
*conda*:install)
[ "$YES" = yes ] && options="$options --yes"
[ -n "$system_packages" ] && print_shell_command "conda install $system_packages"
[ -n "$system_packages" ] && print_shell_command "conda install $options $system_packages"
;;
homebrew*:install)
[ -n "$system_packages" ] && print_shell_command "brew install $system_packages"
Expand Down
2 changes: 1 addition & 1 deletion build/make/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ $(1)-$(4)-no-deps:
echo "$$($(4)_DISABLED_MESSAGE)" 2>&1; \
exit 1; \
else \
sage-logger -p 'SAGE_CHECK=$$(SAGE_CHECK_$(1)) PATH=$$($(4))/bin:$$$$PATH $$(SAGE_SPKG) $$(SAGE_SPKG_OPTIONS) \
sage-logger -p 'SAGE_CHECK=$$(SAGE_CHECK_$(1)) PATH=$$(SAGE_SRC)/bin:$$($(4))/bin:$$$$PATH $$(SAGE_SPKG) $$(SAGE_SPKG_OPTIONS) \
$(if $(filter $(1),$(TOOLCHAIN_DEPS)),--keep-existing) \
$(1)-$(2) $$($(4))' '$$(SAGE_LOGS)/$(1)-$(2).log'; \
fi
Expand Down
1 change: 1 addition & 0 deletions build/pkgs/notebook/distros/arch.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
jupyter-notebook
1 change: 1 addition & 0 deletions build/pkgs/pip/distros/arch.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python-pip
1 change: 1 addition & 0 deletions build/pkgs/tox/distros/arch.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python-tox
5 changes: 2 additions & 3 deletions src/bin/sage-env
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,8 @@ fi

# Don't execute the commands more than once for the same version of
# sage-env... for the same combination of SAGE_LOCAL and SAGE_VENV.
# "5" indicates the version of the format of the value of SAGE_ENV_VERSION.
# The current format was introduced in #32745.
SAGE_ENV_VERSION="5:$SAGE_LOCAL:$SAGE_VENV"
# "6" indicates the version of the format of the value of SAGE_ENV_VERSION.
SAGE_ENV_VERSION="6:$SAGE_LOCAL:$SAGE_VENV:$SAGE_SRC"
if [ "$SAGE_ENV_SOURCED" = "$SAGE_ENV_VERSION" ]; then
# Already sourced, nothing to do.
return 0
Expand Down
Loading

0 comments on commit 193174b

Please sign in to comment.