diff --git a/build/pkgs/sagelib/spkg-install b/build/pkgs/sagelib/spkg-install index 0848bc307e3..fa5684c96e7 100755 --- a/build/pkgs/sagelib/spkg-install +++ b/build/pkgs/sagelib/spkg-install @@ -36,7 +36,27 @@ export SAGE_SHARE=/doesnotexist # uses this variable. # export SAGE_LOCAL=/doesnotexist -time "$PYTHON" -u setup.py --no-user-cfg build install || exit 1 +# --single-version-externally-managed prevents setuptools from installing an egg +#time "$PYTHON" -u setup.py --no-user-cfg build install --single-version-externally-managed --root / || exit 1 + +# However, setuptools.command.install_lib installs too much (via copy_tree). +# FIXME: This should be fixed by a custom install command provided by sage_setup that uses find_extra_files +# and respects sage_setup + +# Until this is ready, we just build an sdist (driven by MANIFEST.in): +# - build/pkgs/sage_tdlib/src/MANIFEST.in includes/grafts some files/directories, +# - build/pkgs/sagelib/src/MANIFEST.in excludes/prunes the same files/directories. +# Then we pip-install the sdist. + +# (This duplicates the information encoded in the sage_setup directives in the files, +# and is therefore not a good long-term solution.) + +dist_dir="$SAGE_DISTFILES" +sage-python23 -u setup.py --no-user-cfg sdist --dist-dir "$dist_dir" || exit 1 +archive="$dist_dir"/$(sage-python23 -u setup.py --no-user-cfg --fullname | tail -1 2>/dev/null).tar.gz || exit 1 +# TODO: Go through sage-pip-install +sage-python23 -m pip install --ignore-installed --verbose --no-deps --no-index --isolated --no-build-isolation "$archive" || exit 1 + if [ "$UNAME" = "CYGWIN" ]; then sage-rebase.sh "$SAGE_LOCAL" 2>/dev/null; fi diff --git a/src/sage_setup/command/sage_install.py b/src/sage_setup/command/sage_install.py index f9ed30cc6c5..a5ba8bbd5fc 100644 --- a/src/sage_setup/command/sage_install.py +++ b/src/sage_setup/command/sage_install.py @@ -5,7 +5,7 @@ import os import time from distutils import log -from distutils.command.install import install +from setuptools.command.install import install class sage_install(install): diff --git a/src/sage_setup/command/sage_install_lib.py b/src/sage_setup/command/sage_install_lib.py new file mode 100644 index 00000000000..2dd5fd3098a --- /dev/null +++ b/src/sage_setup/command/sage_install_lib.py @@ -0,0 +1,12 @@ +from setuptools.command.install_lib import install_lib + +class sage_install_lib(install_lib): + + def get_exclusions(self): + + exclusions = install_lib.get_exclusions(self) + print("EXCLUSIONS: ", exclusions) + # FIXME: Exclude files outside of the current distribution + return exclusions + + pass