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

Commit

Permalink
Handle SAGE_CHECK_PACKAGES in build/make/Makefile.in, not sage-spkg
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Jul 12, 2020
1 parent 02b0be1 commit 25393b0
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 27 deletions.
26 changes: 2 additions & 24 deletions build/bin/sage-spkg
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
# -k: do not uninstall existing installation of this package before
# installing; instead simply overwrite existing files.
# -c: after installing, run the test suite for the spkg. This should
# override the settings of SAGE_CHECK and SAGE_CHECK_PACKAGES.
# override the settings of SAGE_CHECK.
# Exit with an error if the test suite fails.
# -w: after installing, run the test suite for the spkg. This should
# override the settings of SAGE_CHECK and SAGE_CHECK_PACKAGES.
# override the settings of SAGE_CHECK.
# Print a warning if the test suite fails.
# -d: only download the package
# -y: automatically reply "y" for all prompts regarding
Expand Down Expand Up @@ -227,10 +227,8 @@ while true; do
-s)
export SAGE_KEEP_BUILT_SPKGS=yes;;
-c|--check)
SAGE_CHECK_PACKAGES=x # nonempty, so not set to default later
export SAGE_CHECK=yes;;
-w|--check-warning-only)
SAGE_CHECK_PACKAGES=x # nonempty, so not set to default later
export SAGE_CHECK=warn;;
-k|--keep-existing)
KEEP_EXISTING=yes;;
Expand Down Expand Up @@ -567,26 +565,6 @@ if [ ! -f spkg-install ]; then
chmod +x spkg-install
fi


# SAGE_CHECK_PACKAGES: if this contains "!pkg", skip tests for "pkg",
# so set SAGE_CHECK=no. If this contains "pkg", run tests, so set
# SAGE_CHECK=yes. Check this now and export SAGE_CHECK so that the
# package's spkg-install script can use this variable.
#
# Since Python's self-tests seem to fail on all platforms, we disable
# its test suite by default. However, if SAGE_CHECK=warn, we do not
# do that.
if [ x"$SAGE_CHECK" = xyes -a -z "$SAGE_CHECK_PACKAGES" ]; then
SAGE_CHECK_PACKAGES='!python2,!python3'
fi
# Allow spaces, commas, or colons as separator (the documentation suggests commas).
if echo ",$SAGE_CHECK_PACKAGES," | grep -i "[ ,:]\!$PKG_BASE[ ,:]" > /dev/null ; then
export SAGE_CHECK=no
elif echo ",$SAGE_CHECK_PACKAGES," | grep -i "[ ,:]$PKG_BASE[ ,:]" > /dev/null ; then
export SAGE_CHECK=yes
fi


echo "****************************************************"
echo "Host system:"
uname -a
Expand Down
38 changes: 35 additions & 3 deletions build/make/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -429,11 +429,18 @@ pkg_deps = \
# $(1): package name
# $(2): package version
# $(3): package dependencies
define NORMAL_PACKAGE_templ

ifeq "$(origin SAGE_CHECK)" "undefined"
SAGE_CHECK := no
endif

define NORMAL_PACKAGE_templ ##########################################
SAGE_CHECK_$(1) := $(SAGE_CHECK)

$(1)-build-deps: $(3)

$$(INST)/$(1)-$(2): $(3)
+$(AM_V_at)sage-logger -p '$$(SAGE_SPKG) $$(SAGE_SPKG_OPTIONS) \
+$(AM_V_at)sage-logger -p 'SAGE_CHECK=$$(SAGE_CHECK_$(1)) $$(SAGE_SPKG) $$(SAGE_SPKG_OPTIONS) \
$(if $(filter $(1),$(TOOLCHAIN_DEPS)),--keep-existing) \
$(1)-$(2)' '$$(SAGE_LOGS)/$(1)-$(2).log'

Expand All @@ -444,7 +451,7 @@ $(1)-clean:
$(1) '$(SAGE_LOCAL)'

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

$(foreach pkgname, $(NORMAL_PACKAGES),\
$(eval $(call NORMAL_PACKAGE_templ,$(pkgname),$(vers_$(pkgname)),\
Expand All @@ -457,6 +464,31 @@ $(foreach pkgname, $(NORMAL_PACKAGES),\
$(call pkg_deps,$(pkgname)))))
endif

# SAGE_CHECK_PACKAGES: if this contains "!pkg", skip tests for "pkg",
# so set SAGE_CHECK=no. If this contains "pkg", run tests, so set
# SAGE_CHECK=yes. Check this now and export SAGE_CHECK so that the
# package's spkg-install script can use this variable.
#
# Since Python's self-tests seem to fail on all platforms, we disable
# its test suite by default. However, if SAGE_CHECK=warn, we do not
# do that.
SAGE_CHECK_PACKAGES_DEFAULT := !python3
comma := ,
ifeq "$(origin SAGE_CHECK_PACKAGES)" "undefined"
SAGE_CHECK_PACKAGES := $(if $(findstring yes,$(SAGE_CHECK)),$(SAGE_CHECK_PACKAGES_DEFAULT))
endif
SAGE_CHECK_PACKAGES := $(subst $(comma), ,$(SAGE_CHECK_PACKAGES))
SAGE_CHECK_PACKAGES := $(subst :, ,$(SAGE_CHECK_PACKAGES))
define SET_SAGE_CHECK
$(eval SAGE_CHECK_$(1) := $(2))
endef
$(foreach clause, $(SAGE_CHECK_PACKAGES), \
$(if $(findstring !,$(clause)), \
$(eval $(call SET_SAGE_CHECK,$(subst !,,$(clause)),no)), \
$(eval $(call SET_SAGE_CHECK,$(clause),yes))))
debug-check:
@echo $(foreach pkgname, $(NORMAL_PACKAGES), SAGE_CHECK_$(pkgname) = $(SAGE_CHECK_$(pkgname)))

# ================================ pip packages ===============================
# Generate build rules for 'pip' packages; this template is used to generate
# two rules in the form:
Expand Down

0 comments on commit 25393b0

Please sign in to comment.