diff --git a/build/bin/sage-dist-helpers b/build/bin/sage-dist-helpers index 339d06ce493..ed23ba5014b 100644 --- a/build/bin/sage-dist-helpers +++ b/build/bin/sage-dist-helpers @@ -239,6 +239,18 @@ sdh_prefix_args () { sdh_pip_install() { echo "Installing $PKG_NAME" +<<<<<<< HEAD +======= + if [ -n "$SAGE_DESTDIR" ]; then + local sudo="" + else + local sudo="$SAGE_SUDO" + fi + if [ "$*" = "." ]; then + $sudo sage-pip-uninstall "$@" || \ + sdh_die "Error uninstalling a previous version of $PKG_NAME" + fi +>>>>>>> 9750195b6f (WIP: Install pip packages with sage-spkg) mkdir -p dist rm -f dist/*.whl install_options="" @@ -303,14 +315,12 @@ sdh_store_wheel() { if [ "$*" != "." ]; then sdh_die "Error: sdh_store_wheel requires . as only argument" fi - wheel="" - for w in dist/*.whl; do - if [ -n "$wheel" ]; then - sdh_die "Error: more than one wheel found after building" - fi - if [ -f "$w" ]; then - wheel="$w" - fi + for wheel in dist/*.whl; do + $sudo sage-pip-install $root "$wheel" || \ + sdh_die "Error installing $wheel" + mkdir -p "${SAGE_DESTDIR}${SAGE_SPKG_WHEELS}" && \ + $sudo mv "$wheel" "${SAGE_DESTDIR}${SAGE_SPKG_WHEELS}/" || \ + sdh_die "Error storing $wheel" done if [ -z "$wheel" ]; then sdh_die "Error: no wheel found after building" diff --git a/build/bin/sage-spkg b/build/bin/sage-spkg index fd03bd8f01f..1b3b59d726a 100755 --- a/build/bin/sage-spkg +++ b/build/bin/sage-spkg @@ -647,13 +647,16 @@ if [ -f spkg-build ]; then error_msg "Error installing package $PKG_NAME" "make" exit 1 fi -else +elif [ -f spkg-install ]; then # Package only has spkg-install time ./spkg-install if [ $? -ne 0 ]; then error_msg "Error installing package $PKG_NAME" "make" exit 1 fi +elif [ -f requirements.txt ]; then + . sage-dist-helpers + sdh_pip_install -r requirements.txt fi # To work around #26996: Remove the symlink set, or we get "cp: cannot overwrite directory" diff --git a/build/make/Makefile.in b/build/make/Makefile.in index 34c3b356c09..e33450bd312 100644 --- a/build/make/Makefile.in +++ b/build/make/Makefile.in @@ -537,40 +537,16 @@ $(foreach pkgname, $(NORMAL_PACKAGES),\ endif # ================================ pip packages =============================== -# Generate build rules for 'pip' packages; this template is used to generate -# two rules in the form: -# -# : -# $(AM_V_at)sage-logger -p 'sage --pip install ...' '$(SAGE_LOGS)/.log' -# -# -clean: -# -sage --pip uninstall -y ... - -# Positional arguments: -# $(1): package name -# $(2): package dependencies -define PIP_PACKAGE_templ -$(1)-build-deps: $(2) - -$(1): $(2) - +$(MAKE_REC) $(1)-no-deps - -$(1)-no-deps: - $(AM_V_at)sage-logger -p 'sage --pip install -r "$$(SAGE_ROOT)/build/pkgs/$(1)/requirements.txt"' '$$(SAGE_LOGS)/$(1).log' - -$(1)-clean: - -sage --pip uninstall --isolated --yes --no-input -r '$$(SAGE_ROOT)/build/pkgs/$(1)/requirements.txt' - -.PHONY: $(1) $(1)-clean $(1)-build-deps $(1)-no-deps -endef - $(foreach pkgname,$(PIP_PACKAGES),\ - $(eval $(call PIP_PACKAGE_templ,$(pkgname),$(call pkg_deps,$(pkgname))))) + $(eval $(call NORMAL_PACKAGE_templ,$(pkgname),$(vers_$(pkgname)),$(call pkg_deps,$(pkgname))))) +$(foreach pkgname, $(PIP_PACKAGES),\ + $(eval $(call NORMAL_PACKAGE_clean_templ,$(pkgname),$(vers_$(pkgname)),\ + $(call pkg_deps,$(pkgname))))) ifdef DEBUG_RULES $(info # Rules for pip packages) $(foreach pkgname,$(PIP_PACKAGES),\ - $(info $(call PIP_PACKAGE_templ,$(pkgname),$(call pkg_deps,$(pkgname))))) + $(info $(call NORMAL_PACKAGE_templ,$(pkgname),$(vers_$(pkgname)),$(call pkg_deps,$(pkgname))))) endif # ============================= script packages ==============================