Skip to content

Commit

Permalink
bootstrap, m4/sage_spkg_collect.m4: Get dependencies via 'sage --pack…
Browse files Browse the repository at this point in the history
…age dependencies --format=shell'
  • Loading branch information
Matthias Koeppe committed Dec 16, 2023
1 parent 226b70d commit 37aad3c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 33 deletions.
6 changes: 5 additions & 1 deletion bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,11 @@ $config"
$spkg_configures
$spkg_configures_python
EOF
for pkgname in $(sage-package list); do
SPKGS=$(sage-package list)
cat >> m4/sage_spkg_configures.m4 <<EOF
SAGE_SPKG_COLLECT_INIT([$(echo $SPKGS)])
EOF
for pkgname in $SPKGS; do
DIR=build/pkgs/$pkgname
pkgtype="$(cat $DIR/type)"
if test -f "$DIR/requirements.txt"; then
Expand Down
43 changes: 11 additions & 32 deletions m4/sage_spkg_collect.m4
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ m4_include([m4/sage_spkg_configures.m4])
dnl ==========================================================================
AC_DEFUN([SAGE_SPKG_COLLECT_INIT], [
dnl Intialize the collection variables.
m4_pushdef([SPKG_NAMES], [$1])dnl
dnl Obtain dependencies at configure time.
eval $($SAGE_BOOTSTRAP_PYTHON build/bin/sage-package dependencies --format=shell ]SPKG_NAMES[)
# To deal with ABI incompatibilities when gcc is upgraded, every package
# (except gcc) should depend on gcc if gcc is already installed.
# See https://github.com/sagemath/sage/issues/24703
Expand Down Expand Up @@ -142,6 +145,7 @@ AC_SUBST([SAGE_DUMMY_PACKAGES])
AC_SUBST([SAGE_OPTIONAL_INSTALLED_PACKAGES])
AC_SUBST([SAGE_OPTIONAL_UNINSTALLED_PACKAGES])
AC_SUBST([SAGE_SDIST_PACKAGES])
m4_popdef([SPKG_NAMES])
])


Expand Down Expand Up @@ -346,38 +350,13 @@ AC_DEFUN([SAGE_SPKG_FINALIZE], [dnl
dnl
dnl Determine package dependencies
dnl
AS_IF([test -f "$DIR/dependencies"], [dnl
dnl - the # symbol is treated as comment which is removed
AS_VAR_SET([DEPS], [`sed 's/^ *//; s/ *#.*//; q' $DIR/dependencies`])
], [dnl
AS_VAR_SET([DEPS], [])
])
AS_IF([test -f "$DIR/dependencies_build"], [dnl
dnl - the # symbol is treated as comment which is removed
AS_VAR_SET([BUILD_DEPS], [`sed 's/^ *//; s/ *#.*//; q' $DIR/dependencies_build`])
], [dnl
dnl No 'dependencies_build' file, so reuse 'dependencies' for that
AS_VAR_COPY([BUILD_DEPS], [DEPS])
AS_VAR_SET([DEPS], [])
])
AS_IF([test -f "$DIR/dependencies_optional"], [dnl
for a in $(sed 's/^ *//; s/ *#.*//; q' "$DIR/dependencies_optional"); do
AS_VAR_APPEND([BUILD_DEPS], [' $(optional_inst_'$a') '])
done
])
AS_CASE(["$BUILD_DEPS"], [*\|*], [], [AS_VAR_APPEND([BUILD_DEPS], [" |"])])
AS_IF([test -f "$DIR/dependencies_order_only"], [dnl
ADD_DEPS=$(echo $(sed 's/^ *//; s/ *#.*//; q' $DIR/dependencies_order_only))
AS_VAR_APPEND([BUILD_DEPS], [" $ADD_DEPS"])
], [dnl
m4_case(SPKG_SOURCE, [pip], [AS_VAR_APPEND([BUILD_DEPS], [' pip'])], [:])dnl
])
AS_IF([test -f "$DIR/dependencies_check"], [dnl
AS_VAR_SET([CHECK_DEPS], [$(sed 's/^ *//; s/ *#.*//; q' $DIR/dependencies_check)])
], [dnl
AS_VAR_SET([CHECK_DEPS], [])
])
dnl
AS_VAR_COPY([BUILD_DEPS], [build_deps_]SPKG_NAME)
for a in [$optional_deps_]SPKG_NAME; do
AS_VAR_APPEND([BUILD_DEPS], [' $(optional_inst_'$a') '])
done
AS_VAR_APPEND([BUILD_DEPS], [" | $order_only_deps_]SPKG_NAME["])
AS_VAR_COPY([DEPS], [runtime_deps_]SPKG_NAME)
AS_VAR_COPY([CHECK_DEPS], [check_deps_]SPKG_NAME)
SAGE_PACKAGE_DEPENDENCIES="${SAGE_PACKAGE_DEPENDENCIES}$(printf '\nbuild_deps_')SPKG_NAME = ${BUILD_DEPS}$(printf '\ndeps_')SPKG_NAME = ${DEPS}$(printf '\ncheck_deps_')SPKG_NAME = ${CHECK_DEPS}"
dnl
dnl Determine package build rules
Expand Down

0 comments on commit 37aad3c

Please sign in to comment.