Skip to content

Commit 35fa89f

Browse files
committed
bootstrap: Determine SPKG_TREE_VAR here, pass it as a macro argument to SAGE_SPKG_FINALIZE
1 parent 7115a72 commit 35fa89f

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

bootstrap

+10-1
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,17 @@ SAGE_SPKG_CONFIGURE_$(echo ${pkgname} | tr '[a-z]' '[A-Z]')"
126126
else
127127
SPKG_SOURCE=normal
128128
fi
129+
if test -f "$DIR/trees.txt"; then
130+
SPKG_TREE_VAR="$(sed "s/#.*//;" "$DIR/trees.txt")"
131+
else
132+
SPKG_TREE_VAR=SAGE_LOCAL
133+
if test -f "$DIR/requirements.txt" -o -f "$DIR/install-requires.txt"; then
134+
# A Python package
135+
SPKG_TREE_VAR=SAGE_VENV
136+
fi
137+
fi
129138
spkg_configures="$spkg_configures
130-
SAGE_SPKG_FINALIZE([$pkgname], [$pkgtype], [$SPKG_SOURCE])"
139+
SAGE_SPKG_FINALIZE([$pkgname], [$pkgtype], [$SPKG_SOURCE], [$SPKG_TREE_VAR])"
131140
done
132141
echo "$spkg_configures" >> m4/sage_spkg_configures.m4
133142

m4/sage_spkg_collect.m4

+4-11
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ AC_DEFUN([SAGE_SPKG_FINALIZE], [dnl
154154
m4_pushdef([SPKG_NAME], [$1])dnl
155155
m4_pushdef([SPKG_TYPE], [$2])dnl
156156
m4_pushdef([SPKG_SOURCE], [$3])dnl
157+
m4_pushdef([SPKG_TREE_VAR], [$4])dnl
157158
dnl add SPKG_NAME to the SAGE_PACKAGE_VERSIONS and
158159
dnl SAGE_PACKAGE_DEPENDENCIES lists, and to one or more of the above variables
159160
dnl depending on the package type and other criteria (such as whether or not it
@@ -193,20 +194,12 @@ AC_DEFUN([SAGE_SPKG_FINALIZE], [dnl
193194
dnl trees. For example, if we decide to create a separate tree for a venv with the
194195
dnl Jupyter notebook, then packages such as jupyter_core would have to be installed into
195196
dnl two trees.
196-
if test -f "$DIR/trees.txt"; then
197-
SPKG_TREE_VAR="$(sed "s/#.*//;" "$DIR/trees.txt")"
198-
else
199-
SPKG_TREE_VAR=SAGE_LOCAL
200-
if test -f "$DIR/requirements.txt" -o -f "$DIR/install-requires.txt"; then
201-
dnl A Python package
202-
SPKG_TREE_VAR=SAGE_VENV
203-
fi
204-
fi
205-
SAGE_PACKAGE_TREES="${SAGE_PACKAGE_TREES}$(printf '\ntrees_')SPKG_NAME = ${SPKG_TREE_VAR}"
197+
SAGE_PACKAGE_TREES="${SAGE_PACKAGE_TREES}$(printf '\ntrees_')SPKG_NAME = SPKG_TREE_VAR"
206198
207199
dnl Determine whether it is installed already
208200
AS_VAR_SET([is_installed], [no])
209-
for treevar in ${SPKG_TREE_VAR} SAGE_LOCAL; do
201+
m4_append_uniq_w([SPKG_TREE_VAR], [SAGE_LOCAL])
202+
for treevar in SPKG_TREE_VAR; do
210203
AS_VAR_COPY([t], [$treevar])
211204
AS_IF([test -n "$t" -a -d "$t/var/lib/sage/installed/" ], [dnl
212205
for f in "$t/var/lib/sage/installed/SPKG_NAME"-*; do

0 commit comments

Comments
 (0)