Skip to content

Commit

Permalink
build/make/Makefile.in: Re-create venv when PYTHON_MINOR, PYTHON_FOR_…
Browse files Browse the repository at this point in the history
…VENV, or SAGE_VENV_FLAGS change
  • Loading branch information
mkoeppe committed Aug 31, 2023
1 parent a3246b0 commit 51172bd
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions build/make/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -233,21 +233,23 @@ SAGE_VENV_FLAGS = @SAGE_VENV_FLAGS@
ifneq ($(PYTHON_FOR_VENV),)
# Special rule for making the Python virtualenv from the system Python (Python
# 3 only). $(PYTHON) is set in Makefile to python3_venv.
# Thus $(inst_python3_venv) will be the dependency of every Python package.
# Thus $(inst_python3_venv) will an (order-only) dependency of every Python package.
#
# TODO: If we reconfigure to build our own Python after having used the system
# Python, files installed to create the virtualenv should be *removed*. That
# could either be done here by the makefile, or in an spkg-preinst for python3
ifeq ($(PYTHON),python3)
PYTHON = python3_venv
endif
inst_python3_venv = $(SAGE_VENV)/$(SPKG_INST_RELDIR)/python3_venv-$(subst /,-,$(PYTHON_FOR_VENV))$(findstring --system-site-packages,$(SAGE_VENV_FLAGS))
inst_python3_venv = $(SAGE_VENV)/$(SPKG_INST_RELDIR)/python3_venv-3.$(PYTHON_MINOR)-$(subst /,-,$(PYTHON_FOR_VENV))$(findstring --system-site-packages,$(SAGE_VENV_FLAGS))

$(SAGE_VENV)/$(SPKG_INST_RELDIR):
mkdir -p $@
$(inst_python3_venv): $(SAGE_VENV)/$(SPKG_INST_RELDIR)
mkdir -p "$@"

$(inst_python3_venv): | $(SAGE_VENV)/$(SPKG_INST_RELDIR)
$(PYTHON_FOR_VENV) $(SAGE_ROOT)/build/bin/sage-venv $(SAGE_VENV_FLAGS) "$(SAGE_VENV)"
touch $@
rm -f "$(SAGE_VENV)/$(SPKG_INST_RELDIR)"/python3_venv-*
touch "$@"
endif

# Build everything and start Sage.
Expand Down

0 comments on commit 51172bd

Please sign in to comment.