diff --git a/.ci/retrofit-worktree.sh b/.ci/retrofit-worktree.sh new file mode 100755 index 00000000000..f926e59059e --- /dev/null +++ b/.ci/retrofit-worktree.sh @@ -0,0 +1,39 @@ +#!/bin/sh +if [ $# != 2 ]; then + echo >&2 "usage: $0 WORKTREE_NAME WORKTREE_DIRECTORY" + echo >&2 "Ensures that the current working directory is a git repository," + echo >&2 "then makes WORKTREE_DIRECTORY a git worktree named WORKTREE_NAME." +fi +WORKTREE_NAME="$1" +WORKTREE_DIRECTORY="$2" + +export GIT_AUTHOR_NAME="ci-sage workflow" +export GIT_AUTHOR_EMAIL="ci-sage@example.com" +export GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME" +export GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL" + +set -ex + +# If actions/checkout downloaded our source tree using the GitHub REST API +# instead of with git (because do not have git installed in our image), +# we first make the source tree a repo. +if [ ! -d .git ]; then git init && git add -A && git commit --quiet -m "new"; fi + +# Tag this state of the source tree "new". This is what we want to build and test. +git tag -f new + +# Our container image contains a source tree in $WORKTREE_DIRECTORY with a full build of Sage. +# But $WORKTREE_DIRECTORY is not a git repository. +# We make $WORKTREE_DIRECTORY a worktree whose index is at tag "new". +# We then commit the current sources and set the tag "old". (This keeps all mtimes unchanged.) +# Then we update worktree and index with "git reset --hard new". +# (This keeps mtimes of unchanged files unchanged and mtimes of changed files newer than unchanged files.) +# Finally we reset the index to "old". (This keeps all mtimes unchanged.) +# The changed files now show up as uncommitted changes. +# The final "git add -N" makes sure that files that were added in "new" do not show +# as untracked files, which would be removed by "git clean -fx". +git worktree add --detach $WORKTREE_NAME +rm -rf $WORKTREE_DIRECTORY/.git && mv $WORKTREE_NAME/.git $WORKTREE_DIRECTORY/ +rm -rf $WORKTREE_NAME && ln -s $WORKTREE_DIRECTORY $WORKTREE_NAME +if [ ! -f $WORKTREE_NAME/.gitignore ]; then cp .gitignore $WORKTREE_NAME/; fi +(cd $WORKTREE_NAME && git add -A && git commit --quiet --allow-empty -m "old" -a && git tag -f old && git reset --hard new && git reset --quiet old && git add -N . && git status) diff --git a/.devcontainer/onCreate-conda.sh b/.devcontainer/onCreate-conda.sh index eaa045cd27b..2cbb94e3492 100755 --- a/.devcontainer/onCreate-conda.sh +++ b/.devcontainer/onCreate-conda.sh @@ -4,7 +4,7 @@ set -e # Create conda environment ./bootstrap-conda conda install mamba -n base -c conda-forge -y -mamba env create --file src/environment-dev.yml || mamba env update --file src/environment-dev.yml +mamba env create --file src/environment-dev-3.11.yml || mamba env update --file src/environment-dev-3.11.yml conda init bash # Build sage diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 062fa973ac3..4dedaff614f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -49,6 +49,31 @@ jobs: path: upstream name: upstream + changed_files: + runs-on: ubuntu-latest + name: List changed packages + outputs: + uninstall_targets: ${{ steps.build-targets.outputs.uninstall_targets }} + build_targets: ${{ steps.build-targets.outputs.build_targets }} + steps: + - uses: actions/checkout@v4 + - name: Get all packages that have changed + id: changed-packages + uses: tj-actions/changed-files@v38 + with: + files_yaml: | + configures: + - 'build/pkgs/*/spkg-configure.m4' + pkgs: + - 'build/pkgs/**' + - 'pkgs/**' + - name: Determine targets to build + id: build-targets + run: | + echo "uninstall_targets=$(echo $(for a in '' ${{ steps.changed-packages.outputs.configures_all_changed_files }}; do echo $a | sed -E 's,build/pkgs/([_.a-z0-9]*)/spkg-configure[.]m4 *,\1-uninstall,'; done | sort -u))" >> $GITHUB_OUTPUT + echo "build_targets=$(echo $(for a in '' ${{ steps.changed-packages.outputs.pkgs_all_changed_files }}; do echo $a | sed -E 's,-,_,g;s,(build/)?pkgs/([-_.a-z0-9]*)/[^ ]* *,\2-ensure,;'; done | sort -u))" >> $GITHUB_OUTPUT + cat $GITHUB_OUTPUT + build: runs-on: ubuntu-latest container: ghcr.io/sagemath/sage/sage-${{ github.event.inputs.platform || 'ubuntu-focal-standard' }}-with-targets:${{ github.event.inputs.docker_tag || 'dev'}} @@ -69,30 +94,8 @@ jobs: id: worktree run: | set -ex - git config --global user.email "ci-sage@example.com" - git config --global user.name "Build & Test workflow" git config --global --add safe.directory $(pwd) - # If actions/checkout downloaded our source tree using the GitHub REST API - # instead of with git (because do not have git installed in our image), - # we first make the source tree a repo. - if [ ! -d .git ]; then git init && git add -A && git commit --quiet -m "new"; fi - # Tag this state of the source tree "new". This is what we want to build and test. - git tag -f new - # Our container image contains a source tree in /sage with a full build of Sage. - # But /sage is not a git repository. - # We make /sage a worktree whose index is at tag "new". - # We then commit the current sources and set the tag "old". (This keeps all mtimes unchanged.) - # Then we update worktree and index with "git reset --hard new". - # (This keeps mtimes of unchanged files unchanged and mtimes of changed files newer than unchanged files.) - # Finally we reset the index to "old". (This keeps all mtimes unchanged.) - # The changed files now show up as uncommitted changes. - # The final "git add -N" makes sure that files that were added in "new" do not show - # as untracked files, which would be removed by "git clean -fx". - git worktree add --detach worktree-image - rm -rf /sage/.git && mv worktree-image/.git /sage/ - rm -rf worktree-image && ln -s /sage worktree-image - if [ ! -f worktree-image/.gitignore ]; then cp .gitignore worktree-image/; fi - (cd worktree-image && git add -A && git commit --quiet --allow-empty -m "old" -a && git tag -f old && git reset --hard new && git reset --quiet old && git add -N . && git status) + .ci/retrofit-worktree.sh worktree-image /sage - name: Download upstream artifact uses: actions/download-artifact@v3 @@ -126,20 +129,9 @@ jobs: MAKE: make -j2 --output-sync=recurse SAGE_NUM_THREADS: 2 - - name: Set up node to install pyright - if: always() && steps.worktree.outcome == 'success' - uses: actions/setup-node@v3 - with: - node-version: '12' - - - name: Install pyright - if: always() && steps.worktree.outcome == 'success' - # Fix to v232 due to bug https://github.com/microsoft/pyright/issues/3239 - run: npm install -g pyright@1.1.232 - - name: Static code check with pyright if: always() && steps.worktree.outcome == 'success' - run: pyright + run: ./sage -tox -e pyright working-directory: ./worktree-image - name: Clean (fallback to non-incremental) @@ -195,3 +187,255 @@ jobs: uses: codecov/codecov-action@v3 with: files: ./worktree-image/coverage.xml + + linux-standard: + needs: [changed_files] + if: "${{needs.changed_files.outputs.uninstall_targets}}${{needs.changed_files.outputs.build_targets}}" + uses: ./.github/workflows/docker.yml + with: + # Build incrementally from published Docker image + incremental: true + free_disk_space: true + from_docker_repository: ghcr.io/sagemath/sage/ + from_docker_target: "with-targets" + from_docker_tag: "dev" + docker_targets: "with-targets" + targets: "${{needs.changed_files.outputs.uninstall_targets}} ${{needs.changed_files.outputs.build_targets}} build doc-html ptest" + tox_system_factors: >- + ["ubuntu-focal", "ubuntu-jammy", "ubuntu-mantic", "debian-bullseye", "debian-bookworm", + "fedora-30", "fedora-38", "gentoo-python3.11", "debian-bullseye-i386"] + tox_packages_factors: >- + ["standard"] + docker_push_repository: ghcr.io/${{ github.repository }}/ + permissions: + packages: write + + linux-standard-sitepackages: + needs: [changed_files] + if: "${{needs.changed_files.outputs.uninstall_targets}}${{needs.changed_files.outputs.build_targets}}" + uses: ./.github/workflows/docker.yml + with: + # Build incrementally from published Docker image + incremental: true + free_disk_space: true + from_docker_repository: ghcr.io/sagemath/sage/ + from_docker_target: "with-targets" + from_docker_tag: "dev" + docker_targets: "with-targets" + targets: "${{needs.changed_files.outputs.uninstall_targets}} ${{needs.changed_files.outputs.build_targets}} build doc-html ptest" + # Only test systems with a usable system python (>= 3.9) + tox_system_factors: >- + ["ubuntu-jammy", "ubuntu-mantic", "debian-bullseye", "debian-bookworm", + "fedora-33", "fedora-38", "gentoo-python3.11", "archlinux", "debian-bullseye-i386"] + tox_packages_factors: >- + ["standard-sitepackages"] + docker_push_repository: ghcr.io/${{ github.repository }}/ + permissions: + packages: write + + linux-minimal: + needs: [changed_files] + if: "${{needs.changed_files.outputs.uninstall_targets}}${{needs.changed_files.outputs.build_targets}}" + uses: ./.github/workflows/docker.yml + with: + # Build incrementally from published Docker image + incremental: true + free_disk_space: true + from_docker_repository: ghcr.io/sagemath/sage/ + from_docker_target: "with-targets" + from_docker_tag: "dev" + docker_targets: "with-targets" + targets: "${{needs.changed_files.outputs.uninstall_targets}} ${{needs.changed_files.outputs.build_targets}} build doc-html ptest" + tox_system_factors: >- + ["ubuntu-focal", "ubuntu-jammy", "ubuntu-mantic", "debian-bullseye", "debian-bookworm", + "fedora-30", "fedora-38", "gentoo-python3.11", "debian-bullseye-i386"] + tox_packages_factors: >- + ["minimal"] + docker_push_repository: ghcr.io/${{ github.repository }}/ + permissions: + packages: write + + build-docs: + runs-on: ubuntu-latest + container: ghcr.io/sagemath/sage/sage-ubuntu-focal-standard-with-targets:dev + needs: [get_ci_fixes] + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Update system packages + run: | + apt-get update && apt-get install -y git zip + + - name: Add prebuilt tree as a worktree + id: worktree + run: | + git config --global user.email "ci-sage@example.com" + git config --global user.name "Build & Test workflow" + git config --global --add safe.directory $(pwd) + .ci/retrofit-worktree.sh worktree-image /sage + # Keep track of changes to built HTML + new_version=$(cat src/VERSION.txt); (cd /sage/local/share/doc/sage/html/en && find . -name "*.html" | xargs sed -i '/class="sidebar-brand-text"/s/Sage [0-9a-z.]* /Sage '$new_version' /'; git init && (echo "*.svg binary"; echo "*.pdf binary") >> .gitattributes && (echo ".buildinfo"; echo '*.inv'; echo '.git*'; echo '*.svg'; echo '*.pdf'; echo '*.png'; echo 'searchindex.js') > .gitignore; git add -A && git commit --quiet -m "old") + + - name: Download upstream artifact + uses: actions/download-artifact@v3 + with: + path: upstream + name: upstream + + - name: Apply CI fixes from sagemath/sage + # After applying the fixes, make sure all changes are marked as uncommitted changes. + run: | + if [ -r upstream/ci_fixes.patch ]; then + (cd worktree-image && git commit -q -m "current changes" --allow-empty -a && git am; git reset --quiet old; git add -N .) < upstream/ci_fixes.patch + fi + + - name: Incremental build + id: incremental + run: | + # Now re-bootstrap and build. The build is incremental because we were careful with the timestamps. + ./bootstrap && make build + working-directory: ./worktree-image + env: + MAKE: make -j2 --output-sync=recurse + SAGE_NUM_THREADS: 2 + + - name: Build (fallback to non-incremental) + id: build + if: always() && steps.worktree.outcome == 'success' && steps.incremental.outcome != 'success' + run: | + set -ex + make doc-clean doc-uninstall sagelib-clean && git clean -fx src/sage && ./config.status && make build + working-directory: ./worktree-image + env: + MAKE: make -j2 --output-sync=recurse + SAGE_NUM_THREADS: 2 + + - name: Build docs + id: docbuild + if: always() && (steps.incremental.outcome == 'success' || steps.build.outcome == 'success') + # Always non-incremental because of the concern that + # incremental docbuild may introduce broken links (inter-file references) though build succeeds + run: | + set -ex + export SAGE_USE_CDNS=yes + mv /sage/local/share/doc/sage/html/en/.git /sage/.git-doc + make doc-clean doc-uninstall sagelib-clean && git clean -fx src/sage + mkdir -p /sage/local/share/doc/sage/html/en/ && mv /sage/.git-doc /sage/local/share/doc/sage/html/en/.git + ./config.status && make doc-html + working-directory: ./worktree-image + env: + MAKE: make -j2 --output-sync=recurse + SAGE_NUM_THREADS: 2 + + - name: Copy docs + id: copy + if: always() && steps.docbuild.outcome == 'success' + run: | + set -ex + mkdir -p ./docs + # Create changelog + echo '## Preview of CHANGES.html' + (cd /sage/local/share/doc/sage/html/en && git diff --name-only) | tee ./docs/CHANGES.txt + (cd /sage/local/share/doc/sage/html/en && git diff; rm -rf .git) > ./docs/html.diff + echo '## Preview of html.diff'; head -n 400 ./docs/html.diff + (echo '
HTML diff'; sed -E 's,(.*),
\1,' ./docs/CHANGES.txt) > ./docs/CHANGES.html + # For some reason the deploy step below cannot find /sage/... + # So copy everything from there to local folder + # We also need to replace the symlinks because netlify is not following them + cp -r -L /sage/local/share/doc/sage/html/en/* ./docs + # Zip everything for increased performance + zip -r docs.zip docs + + - name: Upload docs + if: always() && steps.copy.outcome == 'success' + uses: actions/upload-artifact@v3 + with: + name: docs + path: docs.zip + + build-docs-pdf: + runs-on: ubuntu-latest + container: ghcr.io/sagemath/sage/sage-${{ github.event.inputs.platform || 'ubuntu-focal-standard' }}-with-targets:${{ github.event.inputs.docker_tag || 'dev'}} + needs: [get_ci_fixes] + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Update system packages + run: | + export PATH="build/bin:$PATH" + eval $(sage-print-system-package-command auto update) + eval $(sage-print-system-package-command auto --yes --no-install-recommends install zip) + eval $(sage-print-system-package-command auto --spkg --yes --no-install-recommends install git texlive) + + + - name: Add prebuilt tree as a worktree + id: worktree + run: | + git config --global user.email "ci-sage@example.com" + git config --global user.name "Build & Test workflow" + git config --global --add safe.directory $(pwd) + .ci/retrofit-worktree.sh worktree-image /sage + # Keep track of changes to built HTML + new_version=$(cat src/VERSION.txt); (cd /sage/local/share/doc/sage/html/en && find . -name "*.html" | xargs sed -i '/class="sidebar-brand-text"/s/Sage [0-9a-z.]* /Sage '$new_version' /'; git init && (echo "*.svg binary"; echo "*.pdf binary") >> .gitattributes && (echo ".buildinfo"; echo '*.inv'; echo '.git*'; echo '*.svg'; echo '*.pdf'; echo '*.png'; echo 'searchindex.js') > .gitignore; git add -A && git commit --quiet -m "old") + + - name: Download upstream artifact + uses: actions/download-artifact@v3 + with: + path: upstream + name: upstream + + - name: Apply CI fixes from sagemath/sage + # After applying the fixes, make sure all changes are marked as uncommitted changes. + run: | + if [ -r upstream/ci_fixes.patch ]; then + (cd worktree-image && git commit -q -m "current changes" --allow-empty -a && git am; git reset --quiet old; git add -N .) < upstream/ci_fixes.patch + fi + + - name: Incremental build + id: incremental + run: | + # Now re-bootstrap and build. The build is incremental because we were careful with the timestamps. + ./bootstrap && make build + working-directory: ./worktree-image + env: + MAKE: make -j2 + SAGE_NUM_THREADS: 2 + + - name: Build (fallback to non-incremental) + id: build + if: always() && steps.worktree.outcome == 'success' && steps.incremental.outcome != 'success' + run: | + set -ex + make doc-clean doc-uninstall sagelib-clean && git clean -fx src/sage && ./config.status && make build + working-directory: ./worktree-image + env: + MAKE: make -j2 + SAGE_NUM_THREADS: 2 + + - name: Build docs (PDF) + id: docbuild + if: always() && (steps.incremental.outcome == 'success' || steps.build.outcome == 'success') + run: make build V=0 && make doc-pdf + working-directory: ./worktree-image + env: + MAKE: make -j2 + SAGE_NUM_THREADS: 2 + + - name: Copy docs + if: always() && steps.docbuild.outcome == 'success' + run: | + # For some reason the deploy step below cannot find /sage/... + # So copy everything from there to local folder + mkdir -p ./docs + cp -r -L /sage/local/share/doc/sage/pdf/en/* ./docs + # Zip everything for increased performance + zip -r docs-pdf.zip docs + + - name: Upload docs + if: always() && steps.copy.outcome == 'success' + uses: actions/upload-artifact@v3 + with: + name: docs-pdf + path: docs-pdf.zip diff --git a/.github/workflows/ci-conda.yml b/.github/workflows/ci-conda.yml index 75babf3ab8c..944af9a72b3 100644 --- a/.github/workflows/ci-conda.yml +++ b/.github/workflows/ci-conda.yml @@ -59,7 +59,7 @@ jobs: with: path: ~/conda_pkgs_dir key: - ${{ runner.os }}-conda-${{ hashFiles('src/environment.yml') }} + ${{ runner.os }}-conda-${{ hashFiles('src/environment-3.11.yml') }} - name: Setup Conda uses: conda-incubator/setup-miniconda@v2 @@ -68,8 +68,8 @@ jobs: mamba-version: "*" channels: conda-forge,defaults channel-priority: true - activate-environment: sage-build - environment-file: src/${{ matrix.conda-env }}.yml + activate-environment: sage + environment-file: src/${{ matrix.conda-env }}-${{ matrix.python }}.yml - name: Print Conda environment shell: bash -l {0} @@ -83,7 +83,7 @@ jobs: run: | ./bootstrap echo "::add-matcher::.github/workflows/configure-systempackage-problem-matcher.json" - ./configure --enable-build-as-root --with-python=$CONDA_PREFIX/bin/python --prefix=$CONDA_PREFIX $(for pkg in $(./sage -package list :standard: --has-file spkg-configure.m4 --has-file distros/conda.txt --exclude rpy2); do echo --with-system-$pkg=force; done) + ./configure --enable-build-as-root --with-python=$CONDA_PREFIX/bin/python --prefix=$CONDA_PREFIX --enable-system-site-packages $(for pkg in $(./sage -package list :standard: --has-file spkg-configure.m4 --has-file distros/conda.txt --exclude rpy2); do echo --with-system-$pkg=force; done) echo "::remove-matcher owner=configure-system-package-warning::" echo "::remove-matcher owner=configure-system-package-error::" @@ -92,7 +92,7 @@ jobs: run: | # Use --no-deps and pip check below to verify that all necessary dependencies are installed via conda. pip install --no-build-isolation --no-deps -v -v -e ./pkgs/sage-conf ./pkgs/sage-setup - pip install --no-build-isolation --no-deps -v -v -e ./src + pip install --no-build-isolation --no-deps --config-settings editable_mode=compat -v -v -e ./src env: SAGE_NUM_THREADS: 2 diff --git a/.github/workflows/ci-linux-incremental.yml b/.github/workflows/ci-linux-incremental.yml deleted file mode 100644 index a4aa9ae99c7..00000000000 --- a/.github/workflows/ci-linux-incremental.yml +++ /dev/null @@ -1,132 +0,0 @@ -name: CI Linux incremental - -## This GitHub Actions workflow runs SAGE_ROOT/tox.ini with select environments, -## whenever a GitHub pull request is opened or synchronized in a repository -## where GitHub Actions are enabled. -## -## It builds and checks some sage spkgs as defined in TARGETS. -## -## A job succeeds if there is no error. -## -## The build is run with "make V=0", so the build logs of individual packages are suppressed. -## -## At the end, all package build logs that contain an error are printed out. -## -## After all jobs have finished (or are canceled) and a short delay, -## tar files of all logs are made available as "build artifacts". - -on: - pull_request: - types: - # Defaults - - opened - - synchronize - - reopened - # When a CI label is added - - labeled - workflow_dispatch: - -concurrency: - # Cancel previous runs of this workflow for the same branch - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -permissions: - packages: write - -jobs: - - changed_files: - runs-on: ubuntu-latest - name: List changed packages - outputs: - uninstall_targets: ${{ steps.build-targets.outputs.uninstall_targets }} - build_targets: ${{ steps.build-targets.outputs.build_targets }} - steps: - - uses: actions/checkout@v4 - - name: Get all packages that have changed - id: changed-packages - uses: tj-actions/changed-files@v38 - with: - files_yaml: | - configures: - - 'build/pkgs/*/spkg-configure.m4' - pkgs: - - 'build/pkgs/**' - - 'pkgs/**' - - name: Determine targets to build - id: build-targets - run: | - echo "uninstall_targets=$(echo $(for a in '' ${{ steps.changed-packages.outputs.configures_all_changed_files }}; do echo $a | sed -E 's,build/pkgs/([_.a-z0-9]*)/spkg-configure[.]m4 *,\1-uninstall,'; done | sort -u))" >> $GITHUB_OUTPUT - echo "build_targets=$(echo $(for a in '' ${{ steps.changed-packages.outputs.pkgs_all_changed_files }}; do echo $a | sed -E 's,-,_,g;s,(build/)?pkgs/([-_.a-z0-9]*)/[^ ]* *,\2-ensure,;'; done | sort -u))" >> $GITHUB_OUTPUT - cat $GITHUB_OUTPUT - - test: - needs: [changed_files] - if: | - github.event_name != 'pull_request' || - ((github.event.action != 'labeled' && - (contains(github.event.pull_request.labels.*.name, 'c: packages: standard') || - contains(github.event.pull_request.labels.*.name, 'c: packages: optional'))) || - (github.event.action == 'labeled' && - (github.event.label.name == 'c: packages: optional' || - github.event.label.name == 'c: packages: standard'))) - uses: ./.github/workflows/docker.yml - with: - # Build incrementally from published Docker image - incremental: true - free_disk_space: true - from_docker_repository: ghcr.io/sagemath/sage/ - from_docker_target: "with-targets" - from_docker_tag: "dev" - docker_targets: "with-targets" - targets: "${{needs.changed_files.outputs.uninstall_targets}} ${{needs.changed_files.outputs.build_targets}} build doc-html ptest" - tox_system_factors: >- - ["ubuntu-focal", - "ubuntu-jammy", - "ubuntu-mantic", - "debian-bullseye", - "debian-bookworm", - "fedora-30", - "fedora-38", - "gentoo-python3.11", - "debian-bullseye-i386"] - tox_packages_factors: >- - ["standard", - "minimal"] - docker_push_repository: ghcr.io/${{ github.repository }}/ - - site: - needs: [changed_files] - if: | - github.event_name != 'pull_request' || - ((github.event.action != 'labeled' && - (contains(github.event.pull_request.labels.*.name, 'c: packages: standard') || - contains(github.event.pull_request.labels.*.name, 'c: packages: optional'))) || - (github.event.action == 'labeled' && - (github.event.label.name == 'c: packages: optional' || - github.event.label.name == 'c: packages: standard'))) - uses: ./.github/workflows/docker.yml - with: - # Build incrementally from published Docker image - incremental: true - free_disk_space: true - from_docker_repository: ghcr.io/sagemath/sage/ - from_docker_target: "with-targets" - from_docker_tag: "dev" - docker_targets: "with-targets" - targets: "${{needs.changed_files.outputs.uninstall_targets}} ${{needs.changed_files.outputs.build_targets}} build doc-html ptest" - # Only test systems with a usable system python (>= 3.9) - tox_system_factors: >- - ["ubuntu-jammy", - "ubuntu-mantic", - "debian-bullseye", - "debian-bookworm", - "fedora-33", - "fedora-38", - "gentoo-python3.11", - "archlinux", - "debian-bullseye-i386"] - tox_packages_factors: >- - ["standard-sitepackages"] - docker_push_repository: ghcr.io/${{ github.repository }}/ diff --git a/.github/workflows/doc-build-pdf.yml b/.github/workflows/doc-build-pdf.yml deleted file mode 100644 index 0413954210b..00000000000 --- a/.github/workflows/doc-build-pdf.yml +++ /dev/null @@ -1,151 +0,0 @@ -name: Build documentation (PDF) - -on: - pull_request: - push: - workflow_dispatch: - # Allow to run manually - inputs: - platform: - description: 'Platform' - required: true - default: 'ubuntu-focal-standard' - docker_tag: - description: 'Docker tag' - required: true - default: 'dev' - -concurrency: - # Cancel previous runs of this workflow for the same branch - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - get_ci_fixes: - runs-on: ubuntu-latest - steps: - - name: Checkout - id: checkout - uses: actions/checkout@v4 - - name: Merge CI fixes from sagemath/sage - run: | - .ci/merge-fixes.sh - env: - GH_TOKEN: ${{ github.token }} - - name: Store CI fixes in upstream artifact - run: | - mkdir -p upstream - if git format-patch --stdout test_base > ci_fixes.patch; then - cp ci_fixes.patch upstream/ - fi - - uses: actions/upload-artifact@v3 - with: - path: upstream - name: upstream - - build-docs-pdf: - runs-on: ubuntu-latest - container: ghcr.io/sagemath/sage/sage-${{ github.event.inputs.platform || 'ubuntu-focal-standard' }}-with-targets:${{ github.event.inputs.docker_tag || 'dev'}} - needs: [get_ci_fixes] - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Update system packages - run: | - export PATH="build/bin:$PATH" - eval $(sage-print-system-package-command auto update) - eval $(sage-print-system-package-command auto --yes --no-install-recommends install zip) - eval $(sage-print-system-package-command auto --spkg --yes --no-install-recommends install git texlive) - - - - name: Add prebuilt tree as a worktree - id: worktree - run: | - set -ex - git config --global user.email "ci-sage@example.com" - git config --global user.name "Build & Test workflow" - git config --global --add safe.directory $(pwd) - # If actions/checkout downloaded our source tree using the GitHub REST API - # instead of with git (because do not have git installed in our image), - # we first make the source tree a repo. - if [ ! -d .git ]; then git init && git add -A && git commit --quiet -m "new"; fi - # Tag this state of the source tree "new". This is what we want to build and test. - git tag -f new - # Our container image contains a source tree in /sage with a full build of Sage. - # But /sage is not a git repository. - # We make /sage a worktree whose index is at tag "new". - # We then commit the current sources and set the tag "old". (This keeps all mtimes unchanged.) - # Then we update worktree and index with "git reset --hard new". - # (This keeps mtimes of unchanged files unchanged and mtimes of changed files newer than unchanged files.) - # Finally we reset the index to "old". (This keeps all mtimes unchanged.) - # The changed files now show up as uncommitted changes. - # The final "git add -N" makes sure that files that were added in "new" do not show - # as untracked files, which would be removed by "git clean -fx". - git worktree add --detach worktree-image - rm -rf /sage/.git && mv worktree-image/.git /sage/ - rm -rf worktree-image && ln -s /sage worktree-image - if [ ! -f worktree-image/.gitignore ]; then cp .gitignore worktree-image/; fi - (cd worktree-image && git add -A && git commit --quiet --allow-empty -m "old" -a && git tag -f old && git reset --hard new && git reset --quiet old && git add -N . && git status) - # Keep track of changes to built HTML - new_version=$(cat src/VERSION.txt); (cd /sage/local/share/doc/sage/html/en && find . -name "*.html" | xargs sed -i '/class="sidebar-brand-text"/s/Sage [0-9a-z.]* /Sage '$new_version' /'; git init && (echo "*.svg binary"; echo "*.pdf binary") >> .gitattributes && (echo ".buildinfo"; echo '*.inv'; echo '.git*'; echo '*.svg'; echo '*.pdf'; echo '*.png'; echo 'searchindex.js') > .gitignore; git add -A && git commit --quiet -m "old") - - - name: Download upstream artifact - uses: actions/download-artifact@v3 - with: - path: upstream - name: upstream - - - name: Apply CI fixes from sagemath/sage - # After applying the fixes, make sure all changes are marked as uncommitted changes. - run: | - if [ -r upstream/ci_fixes.patch ]; then - (cd worktree-image && git commit -q -m "current changes" --allow-empty -a && git am; git reset --quiet old; git add -N .) < upstream/ci_fixes.patch - fi - - - name: Incremental build - id: incremental - run: | - # Now re-bootstrap and build. The build is incremental because we were careful with the timestamps. - ./bootstrap && make build - working-directory: ./worktree-image - env: - MAKE: make -j2 - SAGE_NUM_THREADS: 2 - - - name: Build (fallback to non-incremental) - id: build - if: always() && steps.worktree.outcome == 'success' && steps.incremental.outcome != 'success' - run: | - set -ex - make doc-clean doc-uninstall sagelib-clean && git clean -fx src/sage && ./config.status && make build - working-directory: ./worktree-image - env: - MAKE: make -j2 - SAGE_NUM_THREADS: 2 - - - name: Build docs (PDF) - id: docbuild - if: always() && (steps.incremental.outcome == 'success' || steps.build.outcome == 'success') - run: make build V=0 && make doc-pdf - working-directory: ./worktree-image - env: - MAKE: make -j2 - SAGE_NUM_THREADS: 2 - - - name: Copy docs - if: always() && steps.docbuild.outcome == 'success' - run: | - # For some reason the deploy step below cannot find /sage/... - # So copy everything from there to local folder - mkdir -p ./docs - cp -r -L /sage/local/share/doc/sage/pdf/en/* ./docs - # Zip everything for increased performance - zip -r docs-pdf.zip docs - - - name: Upload docs - if: always() && steps.copy.outcome == 'success' - uses: actions/upload-artifact@v3 - with: - name: docs-pdf - path: docs-pdf.zip diff --git a/.github/workflows/doc-build.yml b/.github/workflows/doc-build.yml deleted file mode 100644 index 355e07ab78e..00000000000 --- a/.github/workflows/doc-build.yml +++ /dev/null @@ -1,159 +0,0 @@ -name: Build documentation - -on: - pull_request: - merge_group: - push: - branches: - - master - - develop - workflow_dispatch: - # Allow to run manually - -concurrency: - # Cancel previous runs of this workflow for the same branch - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - get_ci_fixes: - runs-on: ubuntu-latest - steps: - - name: Checkout - id: checkout - uses: actions/checkout@v4 - - name: Merge CI fixes from sagemath/sage - run: | - .ci/merge-fixes.sh - env: - GH_TOKEN: ${{ github.token }} - - name: Store CI fixes in upstream artifact - run: | - mkdir -p upstream - if git format-patch --stdout test_base > ci_fixes.patch; then - cp ci_fixes.patch upstream/ - fi - - uses: actions/upload-artifact@v3 - with: - path: upstream - name: upstream - - build-docs: - runs-on: ubuntu-latest - container: ghcr.io/sagemath/sage/sage-ubuntu-focal-standard-with-targets:dev - needs: [get_ci_fixes] - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Update system packages - run: | - apt-get update && apt-get install -y git zip - - - name: Add prebuilt tree as a worktree - id: worktree - run: | - set -ex - git config --global user.email "ci-sage@example.com" - git config --global user.name "Build & Test workflow" - git config --global --add safe.directory $(pwd) - # If actions/checkout downloaded our source tree using the GitHub REST API - # instead of with git (because do not have git installed in our image), - # we first make the source tree a repo. - if [ ! -d .git ]; then git init && git add -A && git commit --quiet -m "new"; fi - # Tag this state of the source tree "new". This is what we want to build and test. - git tag -f new - # Our container image contains a source tree in /sage with a full build of Sage. - # But /sage is not a git repository. - # We make /sage a worktree whose index is at tag "new". - # We then commit the current sources and set the tag "old". (This keeps all mtimes unchanged.) - # Then we update worktree and index with "git reset --hard new". - # (This keeps mtimes of unchanged files unchanged and mtimes of changed files newer than unchanged files.) - # Finally we reset the index to "old". (This keeps all mtimes unchanged.) - # The changed files now show up as uncommitted changes. - # The final "git add -N" makes sure that files that were added in "new" do not show - # as untracked files, which would be removed by "git clean -fx". - git worktree add --detach worktree-image - rm -rf /sage/.git && mv worktree-image/.git /sage/ - rm -rf worktree-image && ln -s /sage worktree-image - if [ ! -f worktree-image/.gitignore ]; then cp .gitignore worktree-image/; fi - (cd worktree-image && git add -A && git commit --quiet --allow-empty -m "old" -a && git tag -f old && git reset --hard new && git reset --quiet old && git add -N . && git status) - # Keep track of changes to built HTML - new_version=$(cat src/VERSION.txt); (cd /sage/local/share/doc/sage/html/en && find . -name "*.html" | xargs sed -i '/class="sidebar-brand-text"/s/Sage [0-9a-z.]* /Sage '$new_version' /'; git init && (echo "*.svg binary"; echo "*.pdf binary") >> .gitattributes && (echo ".buildinfo"; echo '*.inv'; echo '.git*'; echo '*.svg'; echo '*.pdf'; echo '*.png'; echo 'searchindex.js') > .gitignore; git add -A && git commit --quiet -m "old") - - - name: Download upstream artifact - uses: actions/download-artifact@v3 - with: - path: upstream - name: upstream - - - name: Apply CI fixes from sagemath/sage - # After applying the fixes, make sure all changes are marked as uncommitted changes. - run: | - if [ -r upstream/ci_fixes.patch ]; then - (cd worktree-image && git commit -q -m "current changes" --allow-empty -a && git am; git reset --quiet old; git add -N .) < upstream/ci_fixes.patch - fi - - - name: Incremental build - id: incremental - run: | - # Now re-bootstrap and build. The build is incremental because we were careful with the timestamps. - ./bootstrap && make build - working-directory: ./worktree-image - env: - MAKE: make -j2 --output-sync=recurse - SAGE_NUM_THREADS: 2 - - - name: Build (fallback to non-incremental) - id: build - if: always() && steps.worktree.outcome == 'success' && steps.incremental.outcome != 'success' - run: | - set -ex - make doc-clean doc-uninstall sagelib-clean && git clean -fx src/sage && ./config.status && make build - working-directory: ./worktree-image - env: - MAKE: make -j2 --output-sync=recurse - SAGE_NUM_THREADS: 2 - - - name: Build docs - id: docbuild - if: always() && (steps.incremental.outcome == 'success' || steps.build.outcome == 'success') - # Always non-incremental because of the concern that - # incremental docbuild may introduce broken links (inter-file references) though build succeeds - run: | - set -ex - export SAGE_USE_CDNS=yes - mv /sage/local/share/doc/sage/html/en/.git /sage/.git-doc - make doc-clean doc-uninstall sagelib-clean && git clean -fx src/sage - mkdir -p /sage/local/share/doc/sage/html/en/ && mv /sage/.git-doc /sage/local/share/doc/sage/html/en/.git - ./config.status && make doc-html - working-directory: ./worktree-image - env: - MAKE: make -j2 --output-sync=recurse - SAGE_NUM_THREADS: 2 - - - name: Copy docs - id: copy - if: always() && steps.docbuild.outcome == 'success' - run: | - set -ex - mkdir -p ./docs - # Create changelog - echo '## Preview of CHANGES.html' - (cd /sage/local/share/doc/sage/html/en && git diff --name-only) | tee ./docs/CHANGES.txt - (cd /sage/local/share/doc/sage/html/en && git diff; rm -rf .git) > ./docs/html.diff - echo '## Preview of html.diff'; head -n 400 ./docs/html.diff - (echo '
HTML diff'; sed -E 's,(.*),
\1,' ./docs/CHANGES.txt) > ./docs/CHANGES.html
- # For some reason the deploy step below cannot find /sage/...
- # So copy everything from there to local folder
- # We also need to replace the symlinks because netlify is not following them
- cp -r -L /sage/local/share/doc/sage/html/en/* ./docs
- # Zip everything for increased performance
- zip -r docs.zip docs
-
- - name: Upload docs
- if: always() && steps.copy.outcome == 'success'
- uses: actions/upload-artifact@v3
- with:
- name: docs
- path: docs.zip
diff --git a/.gitignore b/.gitignore
index 2cec8a0cf62..43f58abcafe 100644
--- a/.gitignore
+++ b/.gitignore
@@ -27,11 +27,29 @@
# no longer generated, but may still be in user worktrees
/src/lib/pkgconfig
+# Environment files generated by bootstrap-conda.
+# The files without Python version are no longer generated
+# but may still be in users' directories.
/environment.yml
+/environment-3.9.yml
+/environment-3.10.yml
+/environment-3.11.yml
/environment-optional.yml
+/environment-optional-3.9.yml
+/environment-optional-3.10.yml
+/environment-optional-3.11.yml
/src/environment.yml
+/src/environment-3.9.yml
+/src/environment-3.10.yml
+/src/environment-3.11.yml
/src/environment-dev.yml
+/src/environment-dev-3.9.yml
+/src/environment-dev-3.10.yml
+/src/environment-dev-3.11.yml
/src/environment-optional.yml
+/src/environment-optional-3.9.yml
+/src/environment-optional-3.10.yml
+/src/environment-optional-3.11.yml
/src/setup.cfg
/src/requirements.txt
diff --git a/.gitpod.yml b/.gitpod.yml
index 52ac8d7184c..51c2687c5d3 100644
--- a/.gitpod.yml
+++ b/.gitpod.yml
@@ -8,7 +8,7 @@ tasks:
# Create conda environment, then configure and build sage
init: >-
./bootstrap-conda
- && mamba env create --file src/environment-dev.yml --prefix venv
+ && mamba env create --file src/environment-dev-3.11.yml --prefix venv
&& conda config --append envs_dirs $(pwd)
&& conda activate $(pwd)/venv
&& ./bootstrap
diff --git a/.upstream.d/10-SAGE_SERVER b/.upstream.d/10-SAGE_SERVER
new file mode 100644
index 00000000000..40ee9e19450
--- /dev/null
+++ b/.upstream.d/10-SAGE_SERVER
@@ -0,0 +1,2 @@
+# When SAGE_SERVER is set, it should be an https/https server in the format of Sage mirrors.
+${SAGE_SERVER}/spkg/upstream/${SPKG}/
diff --git a/.upstream.d/20-github.com-sagemath-sage-releases b/.upstream.d/20-github.com-sagemath-sage-releases
new file mode 100644
index 00000000000..6bccdd7ff0a
--- /dev/null
+++ b/.upstream.d/20-github.com-sagemath-sage-releases
@@ -0,0 +1,3 @@
+# Upstream packages as uploaded as GitHub release assets.
+# This file is automatically updated by the sage-update-version script.
+https://github.com/sagemath/sage/releases/download/10.1/
diff --git a/.upstream.d/30-www.sagemath.org-mirror_list b/.upstream.d/30-www.sagemath.org-mirror_list
new file mode 100644
index 00000000000..951c1df6cfa
--- /dev/null
+++ b/.upstream.d/30-www.sagemath.org-mirror_list
@@ -0,0 +1 @@
+https://www.sagemath.org/mirror_list
diff --git a/Makefile b/Makefile
index 11a7b77665a..ae90db4e9e2 100644
--- a/Makefile
+++ b/Makefile
@@ -158,11 +158,7 @@ bootstrap-clean:
rm -rf config/install-sh config/compile config/config.guess config/config.sub config/missing configure build/make/Makefile-auto.in
rm -f src/doc/en/installation/*.txt
rm -rf src/doc/en/reference/spkg/*.rst
- rm -f environment.yml
- rm -f src/environment.yml
- rm -f src/environment-dev.yml
- rm -f environment-optional.yml
- rm -f src/environment-optional.yml
+ for a in environment environment-optional src/environment src/environment-dev src/environment-optional; do rm -f $$a.yml $$a-3.[89].yml $$a-3.1[0-9].yml; done
rm -f src/Pipfile
rm -f src/pyproject.toml
rm -f src/requirements.txt
diff --git a/bootstrap b/bootstrap
index 54d0a156239..2ae99949025 100755
--- a/bootstrap
+++ b/bootstrap
@@ -226,10 +226,10 @@ save () {
build/make/Makefile-auto.in \
src/doc/en/installation/*.txt \
src/doc/en/reference/spkg/*.rst \
- environment.yml \
- src/environment.yml \
- environment-optional.yml \
- src/environment-optional.yml \
+ environment-3.[89].yml environment-3.1[0-9].yml \
+ src/environment-3.[89].yml src/environment-3.1[0-9].yml \
+ environment-optional-3.[89].yml environment-optional-3.1[0-9].yml \
+ src/environment-optional-3.[89].yml src/environment-optional-3.1[0-9].yml \
src/Pipfile \
src/pyproject.toml \
src/requirements.txt \
diff --git a/bootstrap-conda b/bootstrap-conda
index ed4bb9e0d08..faa29513db4 100755
--- a/bootstrap-conda
+++ b/bootstrap-conda
@@ -11,112 +11,151 @@ STRIP_COMMENTS="sed s/#.*//;"
shopt -s extglob
DEVELOP_SPKG_PATTERN="@(_develop$(for a in $(head -n 1 build/pkgs/_develop/dependencies); do echo -n "|"$a; done))"
-BOOTSTRAP_PACKAGES=$(echo $(${STRIP_COMMENTS} build/pkgs/_bootstrap/distros/conda.txt))
-SYSTEM_PACKAGES=
-OPTIONAL_SYSTEM_PACKAGES=
-SAGELIB_SYSTEM_PACKAGES=
-SAGELIB_OPTIONAL_SYSTEM_PACKAGES=
-DEVELOP_SYSTEM_PACKAGES=
+BOOTSTRAP_PACKAGES=_bootstrap
+PACKAGES=
+OPTIONAL_PACKAGES=
+SAGELIB_PACKAGES=
+SAGELIB_OPTIONAL_PACKAGES=
+DEVELOP_PACKAGES=
+
for PKG_BASE in $(sage-package list --has-file distros/conda.txt --exclude _sagemath); do
PKG_SCRIPTS=build/pkgs/$PKG_BASE
SYSTEM_PACKAGES_FILE=$PKG_SCRIPTS/distros/conda.txt
PKG_TYPE=$(cat $PKG_SCRIPTS/type)
PKG_SYSTEM_PACKAGES=$(echo $(${STRIP_COMMENTS} $SYSTEM_PACKAGES_FILE))
- if [ -n "PKG_SYSTEM_PACKAGES" ]; then
+ if [ -n "$PKG_SYSTEM_PACKAGES" ]; then
if [ -f $PKG_SCRIPTS/spkg-configure.m4 ]; then
+ if grep -q SAGE_PYTHON_PACKAGE_CHECK $PKG_SCRIPTS/spkg-configure.m4; then
+ # Python package that would need --enable-system-site-packages to be used
+ # with the Sage distribution, but we do not recommend that for conda.
+ PKG_SAGELIB_ONLY=yes
+ else
+ PKG_SAGELIB_ONLY=no
+ fi
+ else
+ # No spkg-configure, so the Sage distribution is not able to make use of this package.
+ PKG_SAGELIB_ONLY=yes
+ fi
+ [ -n "$BOOTSTRAP_VERBOSE" ] && echo "$PKG_BASE:$PKG_TYPE:$PKG_SAGELIB_ONLY"
+ if [ $PKG_SAGELIB_ONLY = no ]; then
case "$PKG_BASE:$PKG_TYPE" in
*:standard)
- SYSTEM_PACKAGES+=" $PKG_SYSTEM_PACKAGES"
+ PACKAGES+=" $PKG_BASE"
;;
$DEVELOP_SPKG_PATTERN:*)
- DEVELOP_SYSTEM_PACKAGES+=" $PKG_SYSTEM_PACKAGES"
+ DEVELOP_PACKAGES+=" $PKG_BASE"
;;
*)
- OPTIONAL_SYSTEM_PACKAGES+=" $PKG_SYSTEM_PACKAGES"
+ OPTIONAL_PACKAGES+=" $PKG_BASE"
;;
esac
else
case "$PKG_BASE:$PKG_TYPE" in
*:standard)
- SAGELIB_SYSTEM_PACKAGES+=" $PKG_SYSTEM_PACKAGES"
+ SAGELIB_PACKAGES+=" $PKG_BASE"
;;
$DEVELOP_SPKG_PATTERN:*)
- DEVELOP_SYSTEM_PACKAGES+=" $PKG_SYSTEM_PACKAGES"
+ DEVELOP_PACKAGES+=" $PKG_BASE"
;;
*)
- SAGELIB_OPTIONAL_SYSTEM_PACKAGES+=" $PKG_SYSTEM_PACKAGES"
+ SAGELIB_OPTIONAL_PACKAGES+=" $PKG_BASE"
;;
esac
fi
fi
done
+unset PKG_SYSTEM_PACKAGES
+
+[ -n "$BOOTSTRAP_VERBOSE" ] && echo "## Collected:" && set | grep PACKAGES=
+
+# Translate to system packages
+export ENABLE_SYSTEM_SITE_PACKAGES=yes # Disable filtering in sage-get-system-packages
+SYSTEM_PACKAGES=$(sage-get-system-packages conda $PACKAGES)
+BOOTSTRAP_SYSTEM_PACKAGES=$(sage-get-system-packages conda $BOOTSTRAP_PACKAGES)
+OPTIONAL_SYSTEM_PACKAGES=$(sage-get-system-packages conda $OPTIONAL_PACKAGES)
+SAGELIB_SYSTEM_PACKAGES=$(sage-get-system-packages conda $SAGELIB_PACKAGES)
+SAGELIB_OPTIONAL_SYSTEM_PACKAGES=$(sage-get-system-packages conda $SAGELIB_OPTIONAL_PACKAGES)
+DEVELOP_SYSTEM_PACKAGES=$(sage-get-system-packages conda $DEVELOP_PACKAGES)
+unset ENABLE_SYSTEM_SITE_PACKAGES
+
+[ -n "$BOOTSTRAP_VERBOSE" ] && echo "## Translated to system:" && set | grep SYSTEM_PACKAGES=
+
echo >&2 $0:$LINENO: generate conda environment files
-(
- echo "name: sage-build"
- echo "channels:"
- echo " - conda-forge"
- echo " - nodefaults"
- echo "dependencies:"
- for pkg in $SYSTEM_PACKAGES; do
- echo " - $pkg"
- done
- echo " # Packages needed for ./bootstrap"
- for pkg in $BOOTSTRAP_PACKAGES; do
- echo " - $pkg"
- done
-) > environment.yml
-(
- sed 's/name: sage-build/name: sage/' environment.yml
- echo " # Additional packages providing all dependencies for the Sage library"
- for pkg in $SAGELIB_SYSTEM_PACKAGES; do
- echo " - $pkg"
- done
-) > src/environment.yml
+ (
+ echo "name: sage-build"
+ echo "channels:"
+ echo " - conda-forge"
+ echo " - nodefaults"
+ echo "dependencies:"
+ for pkg in $SYSTEM_PACKAGES; do
+ echo " - $pkg"
+ done
+ echo " # Packages needed for ./bootstrap"
+ for pkg in $BOOTSTRAP_SYSTEM_PACKAGES; do
+ echo " - $pkg"
+ done
+ ) > environment-template.yml
+ (
+ sed 's/name: sage-build/name: sage/' environment-template.yml
+ echo " # Additional packages providing all dependencies for the Sage library"
+ for pkg in $SAGELIB_SYSTEM_PACKAGES; do
+ echo " - $pkg"
+ done
+ ) > src/environment-template.yml
-(
- sed 's/name: sage/name: sage-dev/' src/environment.yml
- echo " # Additional dev tools"
- for pkg in $DEVELOP_SYSTEM_PACKAGES; do
- echo " - $pkg"
- done
-) > src/environment-dev.yml
+ (
+ cat environment-template.yml
+ echo " # optional packages"
+ for pkg in $OPTIONAL_SYSTEM_PACKAGES; do
+ echo " - $pkg"
+ done
+ ) > environment-optional-template.yml
-(
- cat environment.yml
- echo " # optional packages"
- for pkg in $OPTIONAL_SYSTEM_PACKAGES; do
- echo " - $pkg"
- done
-) > environment-optional.yml
+ (
+ sed 's/name: sage/name: sage-dev/' src/environment-template.yml
+ echo " # Additional dev tools"
+ for pkg in $DEVELOP_SYSTEM_PACKAGES; do
+ echo " - $pkg"
+ done
+ ) > src/environment-dev-template.yml
-(
- cat src/environment.yml
- echo " # optional packages"
- for pkg in $OPTIONAL_SYSTEM_PACKAGES $SAGELIB_OPTIONAL_SYSTEM_PACKAGES; do
- echo " - $pkg"
- done
-) > src/environment-optional.yml
-(
- echo >&4 " - pip:"
- echo >&5 " - pip:"
- for PKG_BASE in $((sage-package list :standard: :optional: --has-file requirements.txt --no-file distros/conda.txt --no-file src; sage-package list :standard: :optional: --has-file install-requires.txt --no-file requirements.txt --no-file distros/conda.txt --no-file src) | sort); do
- PKG_SCRIPTS=build/pkgs/$PKG_BASE
- SYSTEM_PACKAGES_FILE=$PKG_SCRIPTS/requirements.txt
- if [ ! -f $SYSTEM_PACKAGES_FILE ]; then
- SYSTEM_PACKAGES_FILE=$PKG_SCRIPTS/install-requires.txt
- fi
- PKG_TYPE=$(cat $PKG_SCRIPTS/type)
- if grep -q SAGERUNTIME $PKG_SCRIPTS/dependencies $PKG_SCRIPTS/dependencies_order_only 2>/dev/null; then
- : # cannot install packages that depend on the Sage library
- else
- case "$PKG_BASE:$PKG_TYPE" in
- $DEVELOP_SPKG_PATTERN:*) FD=4;;
- *) FD=5;;
- esac
- ${STRIP_COMMENTS} $SYSTEM_PACKAGES_FILE | while read -r line; do
- [ -n "$line" ] && echo >&$FD " - $line"
- done
- fi
+ (
+ cat src/environment-template.yml
+ echo " # optional packages"
+ for pkg in $OPTIONAL_SYSTEM_PACKAGES $SAGELIB_OPTIONAL_SYSTEM_PACKAGES; do
+ echo " - $pkg"
+ done
+ ) > src/environment-optional-template.yml
+
+ (
+ echo >&4 " - pip:"
+ echo >&5 " - pip:"
+ for PKG_BASE in $(sage-package list :standard: :optional: --has-file requirements.txt --no-file distros/conda.txt --no-file src; sage-package list :standard: :optional: --has-file install-requires.txt --no-file requirements.txt --no-file distros/conda.txt --no-file src); do
+ PKG_SCRIPTS=build/pkgs/$PKG_BASE
+ SYSTEM_PACKAGES_FILE=$PKG_SCRIPTS/requirements.txt
+ if [ ! -f $SYSTEM_PACKAGES_FILE ]; then
+ SYSTEM_PACKAGES_FILE=$PKG_SCRIPTS/install-requires.txt
+ fi
+ PKG_TYPE=$(cat $PKG_SCRIPTS/type)
+ if grep -q SAGERUNTIME $PKG_SCRIPTS/dependencies $PKG_SCRIPTS/dependencies_order_only 2>/dev/null; then
+ : # cannot install packages that depend on the Sage library
+ else
+ case "$PKG_BASE:$PKG_TYPE" in
+ $DEVELOP_SPKG_PATTERN:*) FD=4;;
+ *:standard) FD="4 5";;
+ *) FD=5;;
+ esac
+ ${STRIP_COMMENTS} $SYSTEM_PACKAGES_FILE | while read -r line; do
+ [ -n "$line" ] && for fd in $FD; do echo >&$fd " - $line"; done
+ done
+ fi
+ done
+ ) 4>> /dev/null 5>> src/environment-optional-template.yml
+
+for f in environment environment-optional src/environment src/environment-optional src/environment-dev; do
+ for python_version in 3.9 3.10 3.11; do
+ sed -E 's/^( *- *)python *$/\1python='$python_version'/' $f-template.yml > $f-$python_version.yml
done
-) 4>> src/environment-dev.yml 5>> src/environment-optional.yml
+ rm -f $f-template.yml
+done
diff --git a/build/bin/write-dockerfile.sh b/build/bin/write-dockerfile.sh
index 530c2c6ec63..8e4ad8a1a54 100755
--- a/build/bin/write-dockerfile.sh
+++ b/build/bin/write-dockerfile.sh
@@ -213,16 +213,34 @@ cat <