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

Commit

Permalink
WIP: Install pip packages with sage-spkg
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Sep 25, 2020
1 parent 6c27c05 commit 9750195
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 32 deletions.
7 changes: 4 additions & 3 deletions build/bin/sage-dist-helpers
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,10 @@ sdh_pip_install() {
else
local sudo="$SAGE_SUDO"
fi
$sudo sage-pip-uninstall "$@" || \
sdh_die "Error uninstalling a previous version of $PKG_NAME"

if [ "$*" = "." ]; then
$sudo sage-pip-uninstall "$@" || \
sdh_die "Error uninstalling a previous version of $PKG_NAME"
fi
mkdir -p dist
rm -f dist/*.whl
sage-python23 -m pip wheel --wheel-dir=dist --no-binary :all: --verbose --no-deps --no-index --isolated --no-build-isolation "$@" || \
Expand Down
31 changes: 2 additions & 29 deletions build/make/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -513,43 +513,16 @@ debug-check:
@echo $(foreach pkgname, $(NORMAL_PACKAGES), SAGE_CHECK_$(pkgname) = $(SAGE_CHECK_$(pkgname)))

# ================================ pip packages ===============================
# Generate build rules for 'pip' packages; this template is used to generate
# two rules in the form:
#
# <pkgname>: <dependencies>
# $(AM_V_at)sage-logger -p 'sage --pip install ...' '$(SAGE_LOGS)/<pkgname>.log'
#
# <pkgname>-uninstall:
# -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)-uninstall:
-sage --pip uninstall -y -r '$$(SAGE_ROOT)/build/pkgs/$(1)/requirements.txt'

.PHONY: $(1) $(1)-clean $(1)-uninstall $(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 ==============================
Expand Down

0 comments on commit 9750195

Please sign in to comment.