Skip to content

Commit 5ba61f8

Browse files
author
Release Manager
committed
Trac #31362: make build-local, make build-venv
The new `make` target `build-local` will build all non-Python packages that `make build` builds. `make build-venv` will build all Python packages that `make build` builds. Preparation for #30896, #30371 and related to #30913. URL: https://trac.sagemath.org/31362 Reported by: mkoeppe Ticket author(s): Matthias Koeppe Reviewer(s): John Palmieri
2 parents bef94ab + 61f6ba6 commit 5ba61f8

File tree

5 files changed

+69
-11
lines changed

5 files changed

+69
-11
lines changed

Makefile

+6
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ all: base-toolchain
1515
build: base-toolchain
1616
$(MAKE) all-build
1717

18+
build-local: base-toolchain
19+
$(MAKE) all-build-local
20+
21+
build-venv: base-toolchain
22+
$(MAKE) all-build-venv
23+
1824
start: base-toolchain
1925
$(MAKE) build-start
2026

build/make/Makefile.in

+46-8
Original file line numberDiff line numberDiff line change
@@ -86,19 +86,35 @@ GCC_DEP = @SAGE_GCC_DEP@
8686

8787
@SAGE_PACKAGE_DEPENDENCIES@
8888

89+
# Installation trees for all packages, in the format:
90+
#
91+
# - for a non-Python package:
92+
#
93+
# trees_<pkgname1> = SAGE_LOCAL
94+
#
95+
# - for a Python package:
96+
#
97+
# trees_<pkgname2> = SAGE_VENV
98+
99+
@SAGE_PACKAGE_TREES@
100+
89101
# All standard packages
90102
STANDARD_PACKAGES = @SAGE_STANDARD_PACKAGES@
91103
STANDARD_PACKAGE_INSTS = \
92104
$(foreach pkgname,$(STANDARD_PACKAGES),$(inst_$(pkgname)))
93105

94-
# All optional installed packages (triggers the auto-update)
106+
# Optional/experimental packages to be installed
95107
OPTIONAL_INSTALLED_PACKAGES = @SAGE_OPTIONAL_INSTALLED_PACKAGES@
96-
OPTIONAL_INSTALLED_PACKAGE_INSTS = \
97-
$(foreach pkgname,$(OPTIONAL_INSTALLED_PACKAGES),$(inst_$(pkgname)))
98108

99-
# All previously installed optional packages that are to be uninstalled
109+
# All packages to be installed
110+
INSTALLED_PACKAGES = $(STANDARD_PACKAGES) $(OPTIONAL_INSTALLED_PACKAGES)
111+
INSTALLED_PACKAGE_INSTS = \
112+
$(foreach pkgname,$(INSTALLED_PACKAGES),$(inst_$(pkgname)))
113+
114+
# All previously installed packages that are to be uninstalled
100115
OPTIONAL_CLEANED_PACKAGES = @SAGE_OPTIONAL_CLEANED_PACKAGES@
101-
OPTIONAL_CLEANED_PACKAGES_CLEANS = $(OPTIONAL_CLEANED_PACKAGES:%=%-clean)
116+
CLEANED_PACKAGES = $(OPTIONAL_CLEANED_PACKAGES)
117+
CLEANED_PACKAGES_CLEANS = $(CLEANED_PACKAGES:%=%-clean)
102118

103119
# All packages which should be downloaded
104120
SDIST_PACKAGES = @SAGE_SDIST_PACKAGES@
@@ -146,6 +162,18 @@ $(INST)/.dummy:
146162
touch $@
147163

148164

165+
# Filtered by installation tree
166+
$(foreach tree,SAGE_LOCAL SAGE_VENV, \
167+
$(eval $(tree)_INSTALLED_PACKAGE_INSTS = \
168+
$(foreach pkgname,$(INSTALLED_PACKAGES), \
169+
$(if $(findstring $(tree),$(trees_$(pkgname))), \
170+
$(inst_$(pkgname))))) \
171+
$(eval $(tree)_CLEANED_PACKAGE_CLEANS = \
172+
$(foreach pkgname,$(INSTALLED_PACKAGES), \
173+
$(if $(findstring $(tree),$(trees_$(pkgname))), \
174+
$(inst_$(pkgname))))))
175+
176+
149177
###############################################################################
150178

151179
# Silent rules
@@ -211,9 +239,19 @@ base-toolchain: _clean-broken-gcc base
211239
# All targets except for the base packages
212240
all-sage: \
213241
sagelib \
214-
$(STANDARD_PACKAGE_INSTS) \
215-
$(OPTIONAL_INSTALLED_PACKAGE_INSTS) \
216-
$(OPTIONAL_CLEANED_PACKAGES_CLEANS)
242+
$(INSTALLED_PACKAGE_INSTS) \
243+
$(CLEANED_PACKAGES_CLEANS)
244+
245+
# Same but filtered by installation trees:
246+
all-build-local: toolchain-deps
247+
+$(MAKE_REC) all-sage-local
248+
249+
all-sage-local: $(SAGE_LOCAL_INSTALLED_PACKAGE_INSTS) $(SAGE_LOCAL_CLEANED_PACKAGES_CLEANS)
250+
251+
all-build-venv: toolchain-deps
252+
+$(MAKE_REC) all-sage-venv
253+
254+
all-sage-venv: $(SAGE_VENV_INSTALLED_PACKAGE_INSTS) $(SAGE_VENV_CLEANED_PACKAGES_CLEANS)
217255

218256
# Download all packages which should be inside an sdist tarball (the -B
219257
# option to make forces all targets to be built unconditionally)

build/pkgs/pynac/install-requires.txt

-2
This file was deleted.
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
sagemath-standard

m4/sage_spkg_collect.m4

+16-1
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,10 @@ SAGE_STANDARD_PACKAGES=''
118118
# List of all packages that should be downloaded
119119
SAGE_SDIST_PACKAGES=''
120120
121-
# Generate package version and dependency lists
121+
# Generate package version/dependency/tree lists
122122
SAGE_PACKAGE_VERSIONS=""
123123
SAGE_PACKAGE_DEPENDENCIES=""
124+
SAGE_PACKAGE_TREES=""
124125
# Lists of packages categorized according to their build rules
125126
SAGE_NORMAL_PACKAGES=''
126127
SAGE_PIP_PACKAGES=''
@@ -149,6 +150,19 @@ for DIR in $SAGE_ROOT/build/pkgs/*; do
149150
150151
in_sdist=no
151152
153+
dnl Write out information about the installation tree, using the name of the tree prefix
154+
dnl variable (SAGE_LOCAL or SAGE_VENV). The makefile variable of SPKG is called "trees_SPKG",
155+
dnl note plural, for possible future extension in which an SPKG would be installed into several
156+
dnl trees. For example, if we decide to create a separate tree for a venv with the
157+
dnl Jupyter notebook, then packages such as jupyter_core would have to be installed into
158+
dnl two trees.
159+
SPKG_TREE_VAR=SAGE_LOCAL
160+
if test -f "$DIR/requirements.txt" -o -f "$DIR/install-requires.txt"; then
161+
dnl A Python package
162+
SPKG_TREE_VAR=SAGE_VENV
163+
fi
164+
SAGE_PACKAGE_TREES="${SAGE_PACKAGE_TREES}$(printf '\ntrees_')${SPKG_NAME} = ${SPKG_TREE_VAR}"
165+
152166
uninstall_message=""
153167
# Check consistency of 'DIR/type' file
154168
case "$SPKG_TYPE" in
@@ -320,6 +334,7 @@ done
320334
321335
AC_SUBST([SAGE_PACKAGE_VERSIONS])
322336
AC_SUBST([SAGE_PACKAGE_DEPENDENCIES])
337+
AC_SUBST([SAGE_PACKAGE_TREES])
323338
AC_SUBST([SAGE_NORMAL_PACKAGES])
324339
AC_SUBST([SAGE_PIP_PACKAGES])
325340
AC_SUBST([SAGE_SCRIPT_PACKAGES])

0 commit comments

Comments
 (0)