diff --git a/bootstrap b/bootstrap index 6e408265d84..5070b5df44a 100755 --- a/bootstrap +++ b/bootstrap @@ -92,7 +92,7 @@ EOF if test -f "$DIR/requirements.txt"; then SPKG_SOURCE=pip elif test ! -f "$DIR/checksums.ini"; then - if test -f "$DIR/spkg-install"; then + if test -f "$DIR/spkg-install" -o -f "$DIR/spkg-install.in"; then SPKG_SOURCE=script else # a dummy package diff --git a/build/bin/sage-spkg b/build/bin/sage-spkg index 383a98ffbbc..16a6d49d618 100755 --- a/build/bin/sage-spkg +++ b/build/bin/sage-spkg @@ -323,21 +323,26 @@ export SAGE_SPKG_SCRIPTS="$SAGE_INST_LOCAL/var/lib/sage/scripts" export SAGE_SPKG_WHEELS="$SAGE_INST_LOCAL/var/lib/sage/wheels" # PKG_SRC should look like "package-VERSION" or just "package". -# If VERSION matches the version in build/pkgs or there is no version -# specified, use the local scripts; otherwise we try to find a package -# in upstream. +# VERSION, if provided, must match the version in build/pkgs. PKG_VER="${PKG_NAME#${PKG_BASE}}" PKG_VER="${PKG_VER#-}" PKG_SCRIPTS="$SAGE_ROOT/build/pkgs/$PKG_BASE" -LOCAL_PKG_VER=`cat $PKG_SCRIPTS/package-version.txt 2>/dev/null` +LOCAL_PKG_VER=`cat $PKG_SCRIPTS/package-version.txt 2>/dev/null || echo none` PKG_VER="$LOCAL_PKG_VER" +if [ -n "$PKG_VER" -a "$PKG_VER" != "$LOCAL_PKG_VER" ]; then + echo >&2 "Error: Selecting a different version of a package is no longer supported" + exit 1 +fi if [ -z "$PKG_VER" ]; then PKG_NAME="${PKG_BASE}" else PKG_NAME="${PKG_BASE}-${PKG_VER}" fi PKG_BASE_VER=`echo $PKG_VER | sed 's/\.p[0-9][0-9]*$//'` -PKG_NAME_UPSTREAM=`lookup_param tarball "$PKG_SCRIPTS/checksums.ini" | sed "s/VERSION/$PKG_BASE_VER/"` +if [ -f "$PKG_SCRIPTS/checksums.ini" ]; then + # Normal/wheel package + PKG_NAME_UPSTREAM=`lookup_param tarball "$PKG_SCRIPTS/checksums.ini" | sed "s/VERSION/$PKG_BASE_VER/"` +fi # Set the $SAGE_DESTDIR variable to be passed to the spkg-install # script (the script itself could set this, but better to standardize @@ -356,7 +361,7 @@ WRAPPED_SCRIPTS="build install check preinst postinst $INSTALLED_SCRIPTS" warning_for_experimental_packages() { ############################ if [ x`cat "$PKG_SCRIPTS/type"` = x"experimental" ]; then - if [ $YES != 1 ]; then + if [ $YES != 1 -a -n "$PKG_NAME_UPSTREAM" ]; then # We use /dev/tty here because our output may be redirected # to a logfile, or line-buffered. write_to_tty <&2 "Error: Installing old-style SPKGs is no longer supported" - exit 1 + # Do a final check that PKG_SRC is a file with an absolute path + cd / + if [ ! -f "$PKG_SRC" ]; then + echo >&2 "Error: spkg file '$PKG_SRC' not found." + echo >&2 "This shouldn't happen, it is a bug in the sage-spkg script." + exit 1 + fi fi fi -# Do a final check that PKG_SRC is a file with an absolute path -cd / -if [ ! -f "$PKG_SRC" ]; then - echo >&2 "Error: spkg file '$PKG_SRC' not found." - echo >&2 "This shouldn't happen, it is a bug in the sage-spkg script." - exit 1 -fi - # Go back to SAGE_ROOT where we have less chance of completely messing # up the system if we do something wrong. cd "$SAGE_ROOT" || exit $? # If SAGE_SPKG_COPY_UPSTREAM is set, it should be the name of a directory # to which all upstream files are copied. This is used in sage-sdist. -if [ -n "$SAGE_SPKG_COPY_UPSTREAM" ]; then +if [ -n "$SAGE_SPKG_COPY_UPSTREAM" -a -n "$PKG_NAME_UPSTREAM" ]; then mkdir -p "$SAGE_SPKG_COPY_UPSTREAM" && cp -p "$PKG_SRC" "$SAGE_SPKG_COPY_UPSTREAM" if [ $? -ne 0 ]; then error_msg "Error copying upstream tarball to directory '$SAGE_SPKG_COPY_UPSTREAM'" @@ -483,14 +483,26 @@ extract_the_package() { ########################################## cd "$SAGE_BUILD_DIR" || exit $? echo "Setting up build directory for $PKG_NAME" -cp -RLp "$PKG_SCRIPTS" "$PKG_NAME" -cd "$PKG_NAME" || exit $? - -if [ "$SAGE_KEEP_BUILT_SPKGS" = "yes" ]; then - touch .keep -fi - -case "$PKG_SRC" in +if [ -z "$PKG_NAME_UPSTREAM" ]; then + # Not a normal or wheel package. + # Transplant the 'src' symlink, copy scripts. + mkdir -p "$PKG_NAME" + if [ -d "$PKG_SCRIPTS"/src ]; then + ln -s $(cd "$PKG_SCRIPTS"/src && pwd -P) "$PKG_NAME"/src + fi + for a in build install check preinst postinst; do # replace by use of $WRAPPED_SCRIPTS later + if [ -r "$PKG_SCRIPTS"/spkg-$a.in ]; then + cp "$PKG_SCRIPTS"/spkg-$a.in "$PKG_NAME"/ + elif [ -x "$PKG_SCRIPTS"/spkg-$a ]; then + cp "$PKG_SCRIPTS"/spkg-$a "$PKG_NAME"/ + fi + done + cd "$PKG_NAME" || exit $? +else + # Normal or wheel package, copy whole directory, resolving symlinks + cp -RLp "$PKG_SCRIPTS" "$PKG_NAME" + cd "$PKG_NAME" || exit $? + case "$PKG_SRC" in *.whl) # (Platform-independent) wheel # Do not extract, do not create a src directory, @@ -514,7 +526,11 @@ case "$PKG_SRC" in fi cd .. ;; -esac + esac +fi +if [ "$SAGE_KEEP_BUILT_SPKGS" = "yes" ]; then + touch .keep +fi } ############################################ extract_the_package # The package has been extracted, @@ -619,10 +635,14 @@ $CC -v echo "****************************************************" # Poison the proxy variable to forbid downloads in spkg-install -export http_proxy=http://192.0.2.0:5187/ -export https_proxy=$http_proxy -export ftp_proxy=$http_proxy -export rsync_proxy=$http_proxy +# for normal packages +if [ -n "$PKG_NAME_UPSTREAM" ]; then + # Normal/wheel package + export http_proxy=http://192.0.2.0:5187/ + export https_proxy=$http_proxy + export ftp_proxy=$http_proxy + export rsync_proxy=$http_proxy +fi # We need to run sage-rebase.sh for each package installed, but it # can be dangerous to do this while other packages are installing diff --git a/build/make/Makefile.in b/build/make/Makefile.in index 6031ae7fa2a..10a45a8e453 100644 --- a/build/make/Makefile.in +++ b/build/make/Makefile.in @@ -725,7 +725,7 @@ $(1)-$(4)-no-deps: echo "Error: The installation tree $(4) has been disabled" 2>&1; \ echo "$$($(4)_DISABLED_MESSAGE)" 2>&1; \ exit 1; \ - elif [ -x '$$(SAGE_ROOT)/build/pkgs/$(1)/spkg-install' ]; then \ + elif [ -x '$$(SAGE_ROOT)/build/pkgs/$(1)/spkg-install' -o -r '$$(SAGE_ROOT)/build/pkgs/$(1)/spkg-install.in' ]; then \ rm -rf '$$($(4))/var/lib/sage/scripts/$(1)'; \ cd '$$(SAGE_ROOT)/build/pkgs/$(1)' && \ . '$$(SAGE_ROOT)/src/bin/sage-src-env-config' && \ @@ -740,9 +740,9 @@ $(1)-$(4)-no-deps: SAGE_SPKG_SCRIPTS=$$($(4))/var/lib/sage/scripts \ SAGE_INST_LOCAL=$$($(4)) \ SAGE_CHECK=$$(SAGE_CHECK_$(1)) \ - sage-logger -p '$$(SAGE_ROOT)/build/pkgs/$(1)/spkg-install && if [ $$$$SAGE_CHECK != no -a -x $$(SAGE_ROOT)/build/pkgs/$(1)/spkg-check ]; then $$(SAGE_ROOT)/build/pkgs/$(1)/spkg-check; fi' '$$(SAGE_LOGS)/$(1)-$(2).log' && \ - rm -f "$$($(4))/$(SPKG_INST_RELDIR)/$(1)"-* && \ - touch "$$($(4))/$(SPKG_INST_RELDIR)/$(1)-$(2)"; \ + 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'; \ else ( \ echo; \ echo "Note: $(1) is a dummy package that the Sage distribution uses"; \ @@ -781,14 +781,10 @@ $(1)-$(4)-check: $(1)-check: $(1)-$(4)-check $(1)-$(4)-uninstall: - -$(AM_V_at)cd '$$(SAGE_ROOT)/build/pkgs/$(1)' && \ - . '$$(SAGE_ROOT)/src/bin/sage-src-env-config' && \ - . '$$(SAGE_ROOT)/src/bin/sage-env-config' && \ - . '$$(SAGE_ROOT)/src/bin/sage-env' && \ - . '$$(SAGE_ROOT)/build/bin/sage-build-env-config' && \ - . '$$(SAGE_ROOT)/build/bin/sage-build-env' && \ - '$$(SAGE_ROOT)/build/pkgs/$(1)/spkg-uninstall' - -rm -f "$$($(4))/$(SPKG_INST_RELDIR)/$(1)"-* + if [ -d '$$($(4))' ]; then \ + sage-spkg-uninstall $(if $(filter $(1),$(TOOLCHAIN_DEPS)),--keep-files) \ + $(1) '$$($(4))'; \ + fi $(1)-uninstall: $(1)-$(4)-uninstall diff --git a/build/pkgs/r/spkg-uninstall b/build/pkgs/r/spkg-uninstall deleted file mode 100755 index 32892b79a91..00000000000 --- a/build/pkgs/r/spkg-uninstall +++ /dev/null @@ -1,7 +0,0 @@ -#! /usr/bin/env bash -# Remove old install -rm -rf "$SAGE_LOCAL"/lib/r -rm -rf "$SAGE_LOCAL"/lib/R -rm -rf "$SAGE_LOCAL"/lib/R.old -rm -rf "$SAGE_LOCAL"/lib/libRblas.* "$SAGE_LOCAL"/lib/libRlapack.* "$SAGE_LOCAL"/lib/libR.* -rm -f "$SAGE_LOCAL"/bin/R* diff --git a/build/pkgs/sage_conf/spkg-install b/build/pkgs/sage_conf/spkg-install deleted file mode 100755 index a180fb36542..00000000000 --- a/build/pkgs/sage_conf/spkg-install +++ /dev/null @@ -1,20 +0,0 @@ -#! /usr/bin/env bash -# From sage-spkg. -# For type=script packages, the build rule in build/make/Makefile sources -# sage-env but not sage-dist-helpers. -lib="$SAGE_ROOT/build/bin/sage-dist-helpers" -source "$lib" -if [ $? -ne 0 ]; then - echo >&2 "Error: failed to source $lib" - echo >&2 "Is $SAGE_ROOT the correct SAGE_ROOT?" - exit 1 -fi -cd src -if [ "$SAGE_EDITABLE" = yes ]; then - sdh_pip_editable_install . - if [ "$SAGE_WHEELS" = yes ]; then - sdh_setup_bdist_wheel && sdh_store_wheel . - fi -else - sdh_pip_install . -fi diff --git a/build/pkgs/sage_conf/spkg-install.in b/build/pkgs/sage_conf/spkg-install.in new file mode 100644 index 00000000000..4479c541b1c --- /dev/null +++ b/build/pkgs/sage_conf/spkg-install.in @@ -0,0 +1,9 @@ +cd src +if [ "$SAGE_EDITABLE" = yes ]; then + sdh_pip_editable_install . + if [ "$SAGE_WHEELS" = yes ]; then + sdh_setup_bdist_wheel && sdh_store_wheel . + fi +else + sdh_pip_install . +fi diff --git a/build/pkgs/sage_docbuild/spkg-install b/build/pkgs/sage_docbuild/spkg-install deleted file mode 100755 index cce58b40e22..00000000000 --- a/build/pkgs/sage_docbuild/spkg-install +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash -# From sage-spkg. -# For type=script packages, the build rule in build/make/Makefile sources -# sage-env but not sage-dist-helpers. -lib="$SAGE_ROOT/build/bin/sage-dist-helpers" -source "$lib" -if [ $? -ne 0 ]; then - echo >&2 "Error: failed to source $lib" - echo >&2 "Is $SAGE_ROOT the correct SAGE_ROOT?" - exit 1 -fi -cd src -if [ "$SAGE_EDITABLE" = yes ]; then - sdh_pip_editable_install . - if [ "$SAGE_WHEELS" = yes ]; then - sdh_setup_bdist_wheel && sdh_store_wheel . - fi -else - sdh_pip_install . -fi diff --git a/build/pkgs/sage_docbuild/spkg-install.in b/build/pkgs/sage_docbuild/spkg-install.in new file mode 100644 index 00000000000..4479c541b1c --- /dev/null +++ b/build/pkgs/sage_docbuild/spkg-install.in @@ -0,0 +1,9 @@ +cd src +if [ "$SAGE_EDITABLE" = yes ]; then + sdh_pip_editable_install . + if [ "$SAGE_WHEELS" = yes ]; then + sdh_setup_bdist_wheel && sdh_store_wheel . + fi +else + sdh_pip_install . +fi diff --git a/build/pkgs/sage_setup/spkg-install b/build/pkgs/sage_setup/spkg-install deleted file mode 100755 index cce58b40e22..00000000000 --- a/build/pkgs/sage_setup/spkg-install +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash -# From sage-spkg. -# For type=script packages, the build rule in build/make/Makefile sources -# sage-env but not sage-dist-helpers. -lib="$SAGE_ROOT/build/bin/sage-dist-helpers" -source "$lib" -if [ $? -ne 0 ]; then - echo >&2 "Error: failed to source $lib" - echo >&2 "Is $SAGE_ROOT the correct SAGE_ROOT?" - exit 1 -fi -cd src -if [ "$SAGE_EDITABLE" = yes ]; then - sdh_pip_editable_install . - if [ "$SAGE_WHEELS" = yes ]; then - sdh_setup_bdist_wheel && sdh_store_wheel . - fi -else - sdh_pip_install . -fi diff --git a/build/pkgs/sage_setup/spkg-install.in b/build/pkgs/sage_setup/spkg-install.in new file mode 100644 index 00000000000..4479c541b1c --- /dev/null +++ b/build/pkgs/sage_setup/spkg-install.in @@ -0,0 +1,9 @@ +cd src +if [ "$SAGE_EDITABLE" = yes ]; then + sdh_pip_editable_install . + if [ "$SAGE_WHEELS" = yes ]; then + sdh_setup_bdist_wheel && sdh_store_wheel . + fi +else + sdh_pip_install . +fi diff --git a/build/pkgs/sage_sws2rst/spkg-install b/build/pkgs/sage_sws2rst/spkg-install deleted file mode 100755 index a180fb36542..00000000000 --- a/build/pkgs/sage_sws2rst/spkg-install +++ /dev/null @@ -1,20 +0,0 @@ -#! /usr/bin/env bash -# From sage-spkg. -# For type=script packages, the build rule in build/make/Makefile sources -# sage-env but not sage-dist-helpers. -lib="$SAGE_ROOT/build/bin/sage-dist-helpers" -source "$lib" -if [ $? -ne 0 ]; then - echo >&2 "Error: failed to source $lib" - echo >&2 "Is $SAGE_ROOT the correct SAGE_ROOT?" - exit 1 -fi -cd src -if [ "$SAGE_EDITABLE" = yes ]; then - sdh_pip_editable_install . - if [ "$SAGE_WHEELS" = yes ]; then - sdh_setup_bdist_wheel && sdh_store_wheel . - fi -else - sdh_pip_install . -fi diff --git a/build/pkgs/sage_sws2rst/spkg-install.in b/build/pkgs/sage_sws2rst/spkg-install.in new file mode 100644 index 00000000000..4479c541b1c --- /dev/null +++ b/build/pkgs/sage_sws2rst/spkg-install.in @@ -0,0 +1,9 @@ +cd src +if [ "$SAGE_EDITABLE" = yes ]; then + sdh_pip_editable_install . + if [ "$SAGE_WHEELS" = yes ]; then + sdh_setup_bdist_wheel && sdh_store_wheel . + fi +else + sdh_pip_install . +fi diff --git a/build/pkgs/sagelib/spkg-install b/build/pkgs/sagelib/spkg-install.in old mode 100755 new mode 100644 similarity index 91% rename from build/pkgs/sagelib/spkg-install rename to build/pkgs/sagelib/spkg-install.in index 730829b3101..7ddfda29b05 --- a/build/pkgs/sagelib/spkg-install +++ b/build/pkgs/sagelib/spkg-install.in @@ -1,15 +1,3 @@ -#!/usr/bin/env bash -# From sage-spkg. -# For type=script packages, the build rule in build/make/Makefile sources -# sage-env but not sage-dist-helpers. -lib="$SAGE_ROOT/build/bin/sage-dist-helpers" -source "$lib" -if [ $? -ne 0 ]; then - echo >&2 "Error: failed to source $lib" - echo >&2 "Is $SAGE_ROOT the correct SAGE_ROOT?" - exit 1 -fi - if [ "$SAGE_EDITABLE" = yes ]; then cd "$SAGE_SRC" else diff --git a/build/pkgs/sagemath_bliss/spkg-install b/build/pkgs/sagemath_bliss/spkg-install.in old mode 100755 new mode 100644 similarity index 59% rename from build/pkgs/sagemath_bliss/spkg-install rename to build/pkgs/sagemath_bliss/spkg-install.in index 7ce202f09ae..ccd53947ab0 --- a/build/pkgs/sagemath_bliss/spkg-install +++ b/build/pkgs/sagemath_bliss/spkg-install.in @@ -1,14 +1,3 @@ -#!/usr/bin/env bash -# From sage-spkg. -# For type=script packages, the build rule in build/make/Makefile sources -# sage-env but not sage-dist-helpers. -lib="$SAGE_ROOT/build/bin/sage-dist-helpers" -source "$lib" -if [ $? -ne 0 ]; then - echo >&2 "Error: failed to source $lib" - echo >&2 "Is $SAGE_ROOT the correct SAGE_ROOT?" - exit 1 -fi cd src export PIP_NO_INDEX=true diff --git a/build/pkgs/sagemath_categories/spkg-install b/build/pkgs/sagemath_categories/spkg-install deleted file mode 120000 index e60fac9ffa1..00000000000 --- a/build/pkgs/sagemath_categories/spkg-install +++ /dev/null @@ -1 +0,0 @@ -../sagemath_objects/spkg-install \ No newline at end of file diff --git a/build/pkgs/sagemath_categories/spkg-install.in b/build/pkgs/sagemath_categories/spkg-install.in new file mode 120000 index 00000000000..d83cc631c9a --- /dev/null +++ b/build/pkgs/sagemath_categories/spkg-install.in @@ -0,0 +1 @@ +../sagemath_objects/spkg-install.in \ No newline at end of file diff --git a/build/pkgs/sagemath_coxeter3/spkg-install b/build/pkgs/sagemath_coxeter3/spkg-install.in old mode 100755 new mode 100644 similarity index 59% rename from build/pkgs/sagemath_coxeter3/spkg-install rename to build/pkgs/sagemath_coxeter3/spkg-install.in index 7ce202f09ae..ccd53947ab0 --- a/build/pkgs/sagemath_coxeter3/spkg-install +++ b/build/pkgs/sagemath_coxeter3/spkg-install.in @@ -1,14 +1,3 @@ -#!/usr/bin/env bash -# From sage-spkg. -# For type=script packages, the build rule in build/make/Makefile sources -# sage-env but not sage-dist-helpers. -lib="$SAGE_ROOT/build/bin/sage-dist-helpers" -source "$lib" -if [ $? -ne 0 ]; then - echo >&2 "Error: failed to source $lib" - echo >&2 "Is $SAGE_ROOT the correct SAGE_ROOT?" - exit 1 -fi cd src export PIP_NO_INDEX=true diff --git a/build/pkgs/sagemath_environment/spkg-install b/build/pkgs/sagemath_environment/spkg-install deleted file mode 120000 index e60fac9ffa1..00000000000 --- a/build/pkgs/sagemath_environment/spkg-install +++ /dev/null @@ -1 +0,0 @@ -../sagemath_objects/spkg-install \ No newline at end of file diff --git a/build/pkgs/sagemath_environment/spkg-install.in b/build/pkgs/sagemath_environment/spkg-install.in new file mode 120000 index 00000000000..d83cc631c9a --- /dev/null +++ b/build/pkgs/sagemath_environment/spkg-install.in @@ -0,0 +1 @@ +../sagemath_objects/spkg-install.in \ No newline at end of file diff --git a/build/pkgs/sagemath_mcqd/spkg-install b/build/pkgs/sagemath_mcqd/spkg-install.in old mode 100755 new mode 100644 similarity index 59% rename from build/pkgs/sagemath_mcqd/spkg-install rename to build/pkgs/sagemath_mcqd/spkg-install.in index 7ce202f09ae..ccd53947ab0 --- a/build/pkgs/sagemath_mcqd/spkg-install +++ b/build/pkgs/sagemath_mcqd/spkg-install.in @@ -1,14 +1,3 @@ -#!/usr/bin/env bash -# From sage-spkg. -# For type=script packages, the build rule in build/make/Makefile sources -# sage-env but not sage-dist-helpers. -lib="$SAGE_ROOT/build/bin/sage-dist-helpers" -source "$lib" -if [ $? -ne 0 ]; then - echo >&2 "Error: failed to source $lib" - echo >&2 "Is $SAGE_ROOT the correct SAGE_ROOT?" - exit 1 -fi cd src export PIP_NO_INDEX=true diff --git a/build/pkgs/sagemath_meataxe/spkg-install b/build/pkgs/sagemath_meataxe/spkg-install.in old mode 100755 new mode 100644 similarity index 59% rename from build/pkgs/sagemath_meataxe/spkg-install rename to build/pkgs/sagemath_meataxe/spkg-install.in index 7ce202f09ae..ccd53947ab0 --- a/build/pkgs/sagemath_meataxe/spkg-install +++ b/build/pkgs/sagemath_meataxe/spkg-install.in @@ -1,14 +1,3 @@ -#!/usr/bin/env bash -# From sage-spkg. -# For type=script packages, the build rule in build/make/Makefile sources -# sage-env but not sage-dist-helpers. -lib="$SAGE_ROOT/build/bin/sage-dist-helpers" -source "$lib" -if [ $? -ne 0 ]; then - echo >&2 "Error: failed to source $lib" - echo >&2 "Is $SAGE_ROOT the correct SAGE_ROOT?" - exit 1 -fi cd src export PIP_NO_INDEX=true diff --git a/build/pkgs/sagemath_objects/spkg-install b/build/pkgs/sagemath_objects/spkg-install.in old mode 100755 new mode 100644 similarity index 59% rename from build/pkgs/sagemath_objects/spkg-install rename to build/pkgs/sagemath_objects/spkg-install.in index 18ceb18724d..62cb1b73b22 --- a/build/pkgs/sagemath_objects/spkg-install +++ b/build/pkgs/sagemath_objects/spkg-install.in @@ -1,14 +1,3 @@ -#!/usr/bin/env bash -# From sage-spkg. -# For type=script packages, the build rule in build/make/Makefile sources -# sage-env but not sage-dist-helpers. -lib="$SAGE_ROOT/build/bin/sage-dist-helpers" -source "$lib" -if [ $? -ne 0 ]; then - echo >&2 "Error: failed to source $lib" - echo >&2 "Is $SAGE_ROOT the correct SAGE_ROOT?" - exit 1 -fi cd src export PIP_NO_INDEX=true diff --git a/build/pkgs/sagemath_repl/spkg-install b/build/pkgs/sagemath_repl/spkg-install deleted file mode 120000 index e60fac9ffa1..00000000000 --- a/build/pkgs/sagemath_repl/spkg-install +++ /dev/null @@ -1 +0,0 @@ -../sagemath_objects/spkg-install \ No newline at end of file diff --git a/build/pkgs/sagemath_repl/spkg-install.in b/build/pkgs/sagemath_repl/spkg-install.in new file mode 120000 index 00000000000..d83cc631c9a --- /dev/null +++ b/build/pkgs/sagemath_repl/spkg-install.in @@ -0,0 +1 @@ +../sagemath_objects/spkg-install.in \ No newline at end of file diff --git a/build/pkgs/sagemath_sirocco/spkg-install b/build/pkgs/sagemath_sirocco/spkg-install deleted file mode 100755 index 7ce202f09ae..00000000000 --- a/build/pkgs/sagemath_sirocco/spkg-install +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash -# From sage-spkg. -# For type=script packages, the build rule in build/make/Makefile sources -# sage-env but not sage-dist-helpers. -lib="$SAGE_ROOT/build/bin/sage-dist-helpers" -source "$lib" -if [ $? -ne 0 ]; then - echo >&2 "Error: failed to source $lib" - echo >&2 "Is $SAGE_ROOT the correct SAGE_ROOT?" - exit 1 -fi -cd src - -export PIP_NO_INDEX=true -export PIP_FIND_LINKS="file://$SAGE_SPKG_WHEELS" - -if [ "$SAGE_EDITABLE" = yes ]; then - # SAGE_ROOT/src/setup.py installs everything, nothing to do... - if [ "$SAGE_WHEELS" = yes ]; then - # ... except we build the wheel if requested - sdh_setup_bdist_wheel && sdh_store_wheel . - fi -else - if [ "$SAGE_WHEELS" = yes ]; then - # Modularized install via wheels - sdh_pip_install . - # else nothing to do in legacy direct installation. - fi -fi diff --git a/build/pkgs/sagemath_sirocco/spkg-install.in b/build/pkgs/sagemath_sirocco/spkg-install.in new file mode 100644 index 00000000000..ccd53947ab0 --- /dev/null +++ b/build/pkgs/sagemath_sirocco/spkg-install.in @@ -0,0 +1,18 @@ +cd src + +export PIP_NO_INDEX=true +export PIP_FIND_LINKS="file://$SAGE_SPKG_WHEELS" + +if [ "$SAGE_EDITABLE" = yes ]; then + # SAGE_ROOT/src/setup.py installs everything, nothing to do... + if [ "$SAGE_WHEELS" = yes ]; then + # ... except we build the wheel if requested + sdh_setup_bdist_wheel && sdh_store_wheel . + fi +else + if [ "$SAGE_WHEELS" = yes ]; then + # Modularized install via wheels + sdh_pip_install . + # else nothing to do in legacy direct installation. + fi +fi diff --git a/build/pkgs/sagemath_tdlib/spkg-install b/build/pkgs/sagemath_tdlib/spkg-install deleted file mode 100755 index 7ce202f09ae..00000000000 --- a/build/pkgs/sagemath_tdlib/spkg-install +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash -# From sage-spkg. -# For type=script packages, the build rule in build/make/Makefile sources -# sage-env but not sage-dist-helpers. -lib="$SAGE_ROOT/build/bin/sage-dist-helpers" -source "$lib" -if [ $? -ne 0 ]; then - echo >&2 "Error: failed to source $lib" - echo >&2 "Is $SAGE_ROOT the correct SAGE_ROOT?" - exit 1 -fi -cd src - -export PIP_NO_INDEX=true -export PIP_FIND_LINKS="file://$SAGE_SPKG_WHEELS" - -if [ "$SAGE_EDITABLE" = yes ]; then - # SAGE_ROOT/src/setup.py installs everything, nothing to do... - if [ "$SAGE_WHEELS" = yes ]; then - # ... except we build the wheel if requested - sdh_setup_bdist_wheel && sdh_store_wheel . - fi -else - if [ "$SAGE_WHEELS" = yes ]; then - # Modularized install via wheels - sdh_pip_install . - # else nothing to do in legacy direct installation. - fi -fi diff --git a/build/pkgs/sagemath_tdlib/spkg-install.in b/build/pkgs/sagemath_tdlib/spkg-install.in new file mode 100644 index 00000000000..ccd53947ab0 --- /dev/null +++ b/build/pkgs/sagemath_tdlib/spkg-install.in @@ -0,0 +1,18 @@ +cd src + +export PIP_NO_INDEX=true +export PIP_FIND_LINKS="file://$SAGE_SPKG_WHEELS" + +if [ "$SAGE_EDITABLE" = yes ]; then + # SAGE_ROOT/src/setup.py installs everything, nothing to do... + if [ "$SAGE_WHEELS" = yes ]; then + # ... except we build the wheel if requested + sdh_setup_bdist_wheel && sdh_store_wheel . + fi +else + if [ "$SAGE_WHEELS" = yes ]; then + # Modularized install via wheels + sdh_pip_install . + # else nothing to do in legacy direct installation. + fi +fi diff --git a/m4/sage_spkg_collect.m4 b/m4/sage_spkg_collect.m4 index d52dc6205ee..0ceb34a76eb 100644 --- a/m4/sage_spkg_collect.m4 +++ b/m4/sage_spkg_collect.m4 @@ -38,18 +38,15 @@ # of which is the names of the dependencies of as read # from the build//dependencies file. # -# - SAGE_NORMAL_PACKAGES - lists the names of packages that are installed -# by the "normal" method (using the sage-spkg program to download and -# extract the source tarball, and run the relevant scripts from -# build//spkg-*. +# - SAGE_NORMAL_PACKAGES - lists the names of packages that are of source type +# "normal" or "wheel". # -# - SAGE_PIP_PACKAGES - lists the names of packages with the "pip" type +# - SAGE_PIP_PACKAGES - lists the names of packages with the "pip" source type, # which are installed by directly invoking the pip command. # # - SAGE_SCRIPT_PACKAGES - lists the names of packages with the "script" -# type which are installed by running a custom script, which may -# download additional source files. -# +# source type, which are installed by running a custom script, which may +# download additional source files, and the "dummy" source type. dnl ========================================================================== dnl define PKG_CHECK_VAR for old pkg-config < 0.28; see Trac #29001 diff --git a/src/doc/en/developer/packaging.rst b/src/doc/en/developer/packaging.rst index 9f8bd2528ef..0fd58782264 100644 --- a/src/doc/en/developer/packaging.rst +++ b/src/doc/en/developer/packaging.rst @@ -117,8 +117,8 @@ the following source types: - the file ``package-version.txt`` is optional; - - installing the package runs the installation script ``spkg-install`` - (see :ref:`section-spkg-install`); + - installing the package runs the installation script ``spkg-install`` or + ``spkg-install.in`` (see :ref:`section-spkg-install`); - Sage records the version number of the package installed using a file in ``$SAGE_LOCAL/var/lib/sage/installed/`` and will rerun the installation @@ -134,8 +134,8 @@ the following source types: To summarize: the package source type is determined as follows: if there is a file ``requirements.txt``, it is a ``pip`` package. If not, then if there is a ``checksums.ini`` file, it is ``normal`` or ``wheel``. -Otherwise, if it has an ``spkg-install`` script, it is a ``script`` package, -and if it does not, then it is a ``dummy`` package. +Otherwise, if it has an ``spkg-install`` or ``spkg-install.in`` script, +it is a ``script`` package, and if it does not, then it is a ``dummy`` package. .. _section-directory-structure: @@ -358,13 +358,10 @@ at build time, which should to the appropriate system-specific Install scripts of script packages ---------------------------------- -A script package has a single install script named ``spkg-install``. +For script packages, it is also possible to use an install script named ``spkg-install``. It needs to be an executable shell script; it is not subject to the templating -described in the previous section. - -Sage runs ``spkg-install`` from the directory ``$SAGE_ROOT/build/pkgs/`` -in the environment obtained by sourcing the files ``src/bin/sage-env``, -``build/bin/sage-build-env-config``, and ``build/bin/sage-build-env``. +described in the previous section and will be executed directly from +the build directory. .. _section-sdh-helpers: diff --git a/src/doc/en/installation/source.rst b/src/doc/en/installation/source.rst index b16fd8e7295..6afae82731e 100644 --- a/src/doc/en/installation/source.rst +++ b/src/doc/en/installation/source.rst @@ -1016,7 +1016,7 @@ Environment variables dealing with specific Sage packages: - :envvar:`PARI_CONFIGURE` - use this to pass extra parameters to PARI's ``Configure`` script, for example to specify graphics support (which is disabled by default). See the file - :file:`build/pkgs/pari/spkg-install` for more information. + :file:`build/pkgs/pari/spkg-install.in` for more information. - :envvar:`SAGE_TUNE_PARI` - if yes, enable PARI self-tuning. Note that this can be time-consuming. If you set this variable to "yes", you