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

Commit

Permalink
trac 29097: change "make SPKG-clean" to "make SPKG-uninstall".
Browse files Browse the repository at this point in the history
  • Loading branch information
jhpalmieri authored and Matthias Koeppe committed Jul 21, 2022
1 parent 3a5ea93 commit 65a5604
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 20 deletions.
2 changes: 1 addition & 1 deletion build/bin/sage-site
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ if [ "$1" = '-i' ]; then
# First, uninstall the packages if -f was given
if [ "$FORCE_INSTALL" = yes ]; then
for PKG in $PACKAGES; do
$MAKE "$PKG-clean" || true # Ignore errors
$MAKE "$PKG-uninstall" || true # Ignore errors
done
fi

Expand Down
40 changes: 22 additions & 18 deletions build/make/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ INSTALLED_PACKAGE_INSTS = \
# All previously installed standard/optional/experimental packages that are to be uninstalled
OPTIONAL_UNINSTALLED_PACKAGES = @SAGE_OPTIONAL_UNINSTALLED_PACKAGES@
UNINSTALLED_PACKAGES = $(OPTIONAL_UNINSTALLED_PACKAGES)
UNINSTALLED_PACKAGES_CLEANS = $(UNINSTALLED_PACKAGES:%=%-clean)
UNINSTALLED_PACKAGES_UNINSTALLS = $(UNINSTALLED_PACKAGES:%=%-uninstall)

# All packages which should be downloaded
SDIST_PACKAGES = @SAGE_SDIST_PACKAGES@
Expand Down Expand Up @@ -167,7 +167,7 @@ $(foreach tree,SAGE_LOCAL SAGE_VENV SAGE_DOCS, \
$(foreach pkgname,$(INSTALLED_PACKAGES), \
$(if $(findstring $(tree),$(trees_$(pkgname))), \
$(inst_$(pkgname))))) \
$(eval $(tree)_CLEANED_PACKAGE_CLEANS = \
$(eval $(tree)_UNINSTALLED_PACKAGE_UNINSTALLS = \
$(foreach pkgname,$(INSTALLED_PACKAGES), \
$(if $(findstring $(tree),$(trees_$(pkgname))), \
$(inst_$(pkgname))))))
Expand All @@ -191,7 +191,7 @@ PLUS =
endif

# List of targets that can be run using `sage -i` or `sage -f`
# These should generally have an associated -clean target for `sage -f` to
# These should generally have an associated -uninstall target for `sage -f` to
# work correctly
SAGE_I_TARGETS = sagelib doc

Expand Down Expand Up @@ -242,24 +242,24 @@ base-toolchain: _clean-broken-gcc base

# All targets except for the base packages and except the documentation
all-sage: \
$(SAGE_LOCAL_INSTALLED_PACKAGE_INSTS) $(SAGE_LOCAL_UNINSTALLED_PACKAGES_CLEANS) \
$(SAGE_VENV_INSTALLED_PACKAGE_INSTS) $(SAGE_VENV_UNINSTALLED_PACKAGES_CLEANS)
$(SAGE_LOCAL_INSTALLED_PACKAGE_INSTS) $(SAGE_LOCAL_UNINSTALLED_PACKAGES_UNINSTALLS) \
$(SAGE_VENV_INSTALLED_PACKAGE_INSTS) $(SAGE_VENV_UNINSTALLED_PACKAGES_UNINSTALLS)

# Same but filtered by installation trees:
all-build-local: toolchain-deps
+$(MAKE_REC) all-sage-local

all-sage-local: $(SAGE_LOCAL_INSTALLED_PACKAGE_INSTS) $(SAGE_LOCAL_UNINSTALLED_PACKAGES_CLEANS)
all-sage-local: $(SAGE_LOCAL_INSTALLED_PACKAGE_INSTS) $(SAGE_LOCAL_UNINSTALLED_PACKAGES_UNINSTALLS)

all-build-venv: toolchain-deps
+$(MAKE_REC) all-sage-venv

all-sage-venv: $(SAGE_VENV_INSTALLED_PACKAGE_INSTS) $(SAGE_VENV_UNINSTALLED_PACKAGES_CLEANS)
all-sage-venv: $(SAGE_VENV_INSTALLED_PACKAGE_INSTS) $(SAGE_VENV_UNINSTALLED_PACKAGES_UNINSTALLS)

all-build-docs: toolchain-deps
+$(MAKE_REC) all-sage-docs

all-sage-docs: $(SAGE_DOCS_INSTALLED_PACKAGE_INSTS) $(SAGE_DOCS_UNINSTALLED_PACKAGES_CLEANS)
all-sage-docs: $(SAGE_DOCS_INSTALLED_PACKAGE_INSTS) $(SAGE_DOCS_UNINSTALLED_PACKAGES_UNINSTALLS)

# Download all packages which should be inside an sdist tarball (the -B
# option to make forces all targets to be built unconditionally)
Expand Down Expand Up @@ -470,7 +470,7 @@ pkg_deps = \
# <pkgname>-no-deps:
# +$(AM_V_at)sage-logger -p '$(SAGE_SPKG) <pkgname>-<pkgvers>' '$(SAGE_LOGS)/<pkgname>-<pkgvers>.log'
#
# <pkgname>-clean:
# <pkgname>-uninstall:
# sage-spkg-uninstall <pkgname> '$(SAGE_LOCAL)'
#
# So <pkgname>-build-deps installs just the dependencies, while
Expand All @@ -485,7 +485,7 @@ pkg_deps = \
#
# python3: $(INST)/python3-3.7.3
#
# python3-clean:
# python3-uninstall:
# sage-spkg-uninstall python3 '$(SAGE_LOCAL)'
#
# Note: In these rules the $(INST)/<pkgname>-<pkgvers> target is used
Expand Down Expand Up @@ -527,15 +527,17 @@ $(1)-$(4)-no-deps:

$(1)-no-deps: $(1)-$(4)-no-deps

$(1)-$(4)-clean:
$(1)-$(4)-uninstall:
if [ -d '$$($(4))' ]; then \
sage-spkg-uninstall $(if $(filter $(1),$(TOOLCHAIN_DEPS)),--keep-files) \
$(1) '$$($(4))'; \
fi

$(1)-clean: $(1)-$(4)-clean
$(1)-uninstall: $(1)-$(4)-uninstall

$(1)-clean: $(1)-uninstall

.PHONY: $(1) $(1)-clean $(1)-build-deps $(1)-no-deps
.PHONY: $(1) $(1)-$(4)-uninstall $(1)-uninstall $(1)-clean $(1)-build-deps $(1)-no-deps
endef #################################################################

$(foreach pkgname, $(NORMAL_PACKAGES),\
Expand All @@ -558,7 +560,7 @@ endif
# <pkgname>: <dependencies>
# $(AM_V_at)sage-logger -p 'sage --pip install ...' '$(SAGE_LOGS)/<pkgname>.log'
#
# <pkgname>-clean:
# <pkgname>-uninstall:
# -sage --pip uninstall -y ...

# Positional arguments:
Expand All @@ -573,10 +575,12 @@ $(1): $(2)
$(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:
$(1)-uninstall:
-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
$(1)-clean: $(1)-uninstall

.PHONY: $(1) $(1)-uninstall $(1)-clean $(1)-build-deps $(1)-no-deps
endef

$(foreach pkgname,$(PIP_PACKAGES),\
Expand All @@ -602,7 +606,7 @@ endif
#
# <pkgname>: $(INST)/<pkgname>-<pkgvers>
#
# <pkgname>-clean:
# <pkgname>-uninstall:
# -$(AM_V_at)cd '$SAGE_ROOT' && \\
# . '$SAGE_ROOT/src/bin/sage-env-config' && \\
# . '$SAGE_ROOT/src/bin/sage-env' && \\
Expand Down Expand Up @@ -677,7 +681,7 @@ $(1)-tox-%: FORCE
SAGE_SPKG_WHEELS=$$(SAGE_LOCAL)/var/lib/sage/wheels \
tox -v -v -v -e $$*

.PHONY: $(1) $(1)-uninstall $(1)-build-deps $(1)-no-deps $(1)-clean
.PHONY: $(1) $(1)-uninstall $(1)-clean $(1)-build-deps $(1)-no-deps $(1)-clean

endef

Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ envlist =
#
# Or to rebuild a package with verbose output:
#
# $ tox -e local-homebrew-macos-standard -- ppl-clean ppl V=1
# $ tox -e local-homebrew-macos-standard -- ppl-uninstall ppl V=1
#
# The variant "local-homebrew-macos-usrlocal" uses the global installation in /usr/local
# instead. It may install packages or update packages. It will not remove packages.
Expand Down

0 comments on commit 65a5604

Please sign in to comment.