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

Commit

Permalink
Merge branch 'develop' into u/mantepse/gcis
Browse files Browse the repository at this point in the history
  • Loading branch information
agdphd committed Sep 14, 2015
2 parents ced31fc + 559f73b commit fe2387c
Show file tree
Hide file tree
Showing 555 changed files with 23,947 additions and 6,721 deletions.
12 changes: 4 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,9 @@ build: all-build

# Defer unknown targets to build/make/Makefile
%::
$(MAKE) configure logs
+cd build/make && ./pipestatus \
"./install '$@' 2>&1" \
"tee -a ../../logs/install.log"

logs:
mkdir -p $@
$(MAKE) configure
+build/bin/sage-logger \
"cd build/make && ./install '$@'" logs/install.log

# Preemptively download all standard upstream source tarballs.
download:
Expand Down Expand Up @@ -62,7 +58,7 @@ bootstrap-clean:
maintainer-clean: distclean bootstrap-clean
rm -rf upstream

micro_release: bdist-clean lib-clean
micro_release: bdist-clean sagelib-clean
@echo "Stripping binaries ..."
LC_ALL=C find local/lib local/bin -type f -exec strip '{}' ';' 2>&1 | grep -v "File format not recognized" | grep -v "File truncated" || true

Expand Down
2 changes: 1 addition & 1 deletion VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Sage version 6.9.beta1, released 2015-08-05
Sage version 6.9.beta6, released 2015-09-10
40 changes: 40 additions & 0 deletions build/bin/sage-logger
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env bash
#
# sage-logger COMMAND LOGFILE
#
# Evaluate shell command COMMAND while logging stdout and stderr to
# LOGFILE. If either the command or the logging failed, return a
# non-zero exit status.
#
# AUTHOR:
#
# - Jeroen Demeyer (2015-07-26): initial version based on old pipestatus
# script (#18953)
#
#*****************************************************************************
# Copyright (C) 2015 Jeroen Demeyer <jdemeyer@cage.ugent.be>
#
# Distributed under the terms of the GNU General Public License (GPL)
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
# http://www.gnu.org/licenses/
#*****************************************************************************

cmd="$1"
logfile="$2"
logdir=`dirname "$logfile"`

mkdir -p "$logdir"

# Redirect stdout and stderr to a subprocess running tee.
# We trap SIGINT such that SIGINT interrupts the main process being
# run, not the logging.
( exec 2>&1; eval "$cmd" ) | ( trap '' SIGINT; tee -a "$logfile" )

pipestatus=(${PIPESTATUS[*]})

if [ ${pipestatus[1]} -ne 0 ]; then
exit ${pipestatus[1]}
else
exit ${pipestatus[0]}
fi
152 changes: 48 additions & 104 deletions build/bin/sage-spkg
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,25 @@
# Avoid surprises with character ranges [a-z] in regular expressions
export LC_ALL=C

usage()
{
cat <<EOF
Usage: sage -p <options> <package name>
If <package name> is a URL, download and install it. If it is a file
name, install it. Otherwise, search Sage's list of packages (see
'sage --package list') for a matching package, and if a match is
found, install it.
Options:
-f: force installation even if the package is already installed
-s: do not delete the temporary build directory
-c: after installing, run the test suite for the package
-d: only download the package
EOF
}

# error_msg(header, command)
# This is for printing an error message if something went wrong.
# The first argument is the header to print, the second argument should
Expand Down Expand Up @@ -152,42 +171,34 @@ fi
# Handle special command-line options
##################################################################
if [ $# -eq 0 ]; then
echo "Currently installed packages:"
exec ls -1 "$SAGE_SPKG_INST"
usage
exit 0
fi

# Options have to come in a specific order,
# this is ensured by spkg/bin/sage.
# Parse options
INFO=0
if [ "$1" = '--info' ]; then
INFO=1
shift
fi

FORCE=0
if [ "$1" = '-f' ]; then
FORCE=1
shift
fi

DOWNLOAD_ONLY=0
if [ "$1" = '-d' ]; then
DOWNLOAD_ONLY=1
while true; do
case "$1" in
--info)
INFO=1;;
-f)
FORCE=1;;
-d)
SAGE_INSTALL_FETCH_ONLY=1;;
-s)
export SAGE_KEEP_BUILT_SPKGS=yes;;
-c|--check)
SAGE_CHECK_PACKAGES=x # nonempty, so not set to '!python2' later
export SAGE_CHECK=yes;;
-*)
echo >&2 "Error: unknown option '$1'"
exit 2;;
*) break;;
esac
shift
elif [ -n "$SAGE_INSTALL_FETCH_ONLY" ]; then
DOWNLOAD_ONLY=1
fi
done

if [ "$1" = '-s' ]; then
export SAGE_KEEP_BUILT_SPKGS=yes
shift
fi

if [ "$1" = '-c' ]; then
export SAGE_CHECK=yes
SAGE_CHECK_PACKAGES=x # nonempty, so not set to '!python' later
shift
fi

##################################################################
# Figure out the package filename, download it if needed.
Expand All @@ -202,15 +213,14 @@ fi
# path.
# 2a. <package>-x.y.z, i.e. the name of the package plus the package's
# version numbers.
# 2b. <package>-x.y.z.spkg, i.e. the name of the package in addition to
# the version numbers and the ".spkg" extension.
# 2b. DELETED
# 3. <package>, i.e. the name of the package without a version number.
# 4. <URL>/<package>-x.y.z.spkg, i.e. the full URL where the package
# is hosted. Any local packages matching <package> are ignored.
# The package is only downloaded if it has not yet been installed
# (unless -f is given, then it's always downloaded and installed).
#
# In cases 2a, 2b and 3 we first look locally inside spkg/* for a
# In cases 2a and 3 we first look locally inside spkg/* for a
# matching package. Otherwise, we try to download it. In all cases,
# we reduce to case 1a.
#
Expand Down Expand Up @@ -325,76 +335,10 @@ if [ ! -f "$PKG_SRC" ]; then
if [ -n "$PKG_HAS_PATH" ]; then
PKG_URL="$PKG_SRC"
else
# Handle cases 2a and 3, where the package name is something
# like "foo" or "foo-1.2.3".
MIRROR=$(sage-download-file --print-fastest-mirror)/spkg
if [ $? -ne 0 ]; then
exit 1
fi
for repo in optional experimental standard huge archive; do
# Download the list of packages.
echo ">>> Checking online list of $repo packages."
# File inside DOT_SAGE should be writable
repolist="${DOT_SAGE}/${repo}.list"
sage-download-file --quiet "$MIRROR/$repo/list" $repolist
if [ $? -ne 0 ]; then
rm -f $repolist
exit 1
fi

# The contrived sed commands print out either ${PKG_NAME} if
# it appears as a complete line or some string starting with
# ${PKG_NAME}- whichever occurs first.
# Tested with GNU sed, BSD sed (on OS X) and Solaris sed.
pkg=`sed -n -f <( echo "/^${PKG_NAME}\$/{p;q;}" && echo "/^${PKG_NAME}-/{p;q;}" ) $repolist`
rm -f $repolist
if [ -n "$pkg" ]; then
echo ">>> Found $pkg"
PKG_NAME=$pkg

# If INFO is set, try downloading only the .txt file
if [ $INFO -eq 1 ]; then
PKG_URL="$MIRROR/$repo/$pkg.txt"
sage-download-file --quiet "$PKG_URL" && exit 0
# If the download failed (for whatever reason),
# fall through and use the .spkg file.
else
# Warn and ask the user if downloading an
# experimental or archive package.
if [ $repo = experimental ]; then
echo # The following message appears twice in this file
echo "=========================== WARNING ==========================="
echo "You are about to download and install an experimental package."
echo "This probably won't work at all for you! There is no guarantee"
echo "that it will build correctly, or behave as expected."
echo "Use at your own risk!"
echo "==============================================================="
ask_download=yes
elif [ $repo = archive ]; then
echo "=========================== WARNING ==========================="
echo "You are about to download and install an archived package."
echo "This means the package is likely to be outdated and it probably"
echo "won't work at all for you! Use at your own risk!"
echo "==============================================================="
ask_download=yes
else
ask_download=no
fi

if [ $ask_download = yes ]; then
read -p "Are you sure you want to continue [Y/n]? " answer
case "$answer" in
n*|N*) exit 0;;
esac
fi
fi
PKG_URL="$MIRROR/$repo/$pkg.spkg"
break
fi
done

if [ -z "$PKG_URL" ]; then
echo >&2 "Error: could not find a package matching $PKG_NAME on $MIRROR"
echo >&2 "Error: could not find a package matching $PKG_NAME"
echo >&2 " Try 'sage --package list' to see the available packages"
echo >&2 " $(sage-package apropos $PKG_NAME)"
exit 1
fi

Expand Down Expand Up @@ -453,7 +397,7 @@ if [ -n "$SAGE_SPKG_COPY_UPSTREAM" ]; then
exit 1
fi
fi
if [ $DOWNLOAD_ONLY -ne 0 ]; then
if [ -n "$SAGE_INSTALL_FETCH_ONLY" ]; then
exit 0
fi

Expand Down Expand Up @@ -605,7 +549,7 @@ fi
# Since Python's self-tests seem to fail on all platforms, we disable
# its test suite by default.
if [ -z "$SAGE_CHECK_PACKAGES" ]; then
SAGE_CHECK_PACKAGES='!python'
SAGE_CHECK_PACKAGES='!python2'
fi
# Allow spaces, commas, or colons as separator (the documentation suggests commas).
if echo ",$SAGE_CHECK_PACKAGES," | grep -i "[ ,:]\!$PKG_BASE[ ,:]" > /dev/null ; then
Expand Down
19 changes: 9 additions & 10 deletions build/make/deps
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@

# Do not put an explicit path for sage-spkg here, it will be found in $PATH.
SAGE_SPKG = sage-spkg -f
PIPE = $(SAGE_ROOT)/build/make/pipestatus
STARTED = $(SAGE_LOCAL)/etc/sage-started.txt

# Tell make not to look for files with these names:
.PHONY: all all-sage all-toolchain all-build start \
base toolchain toolchain-deps sagelib \
doc doc-html doc-html-jsmath doc-html-mathjax doc-pdf \
doc-clean clean lib-clean build-clean
doc-clean clean sagelib-clean build-clean

# Build everything and start Sage.
# Note that we put the "doc" target first in the rule below because
Expand Down Expand Up @@ -138,7 +137,7 @@ sagelib: \
$(INST)/$(NUMPY) \
$(INST)/$(PARI) \
$(INST)/$(PLANARITY) \
$(INST)/$(POLYBORI) \
$(INST)/$(BRIAL) \
$(INST)/$(PPL) \
$(INST)/$(PYNAC) \
$(INST)/$(PYTHON) \
Expand All @@ -151,7 +150,7 @@ sagelib: \
$(INST)/$(ZN_POLY)
if [ -z "$$SAGE_INSTALL_FETCH_ONLY" ]; then \
cd $(SAGE_SRC) && source bin/sage-env && \
$(PIPE) 'time $(MAKE) sage 2>&1' 'tee -a $(SAGE_LOGS)/sage-$(SAGE_VERSION).log'; \
sage-logger 'time $(MAKE) sage' '$(SAGE_LOGS)/sage-$(SAGE_VERSION).log'; \
fi


Expand Down Expand Up @@ -198,23 +197,23 @@ DOC_DEPENDENCIES = sagelib $(INST)/$(SPHINX) $(INST)/$(SAGENB) \
doc: doc-html

doc-html: $(DOC_DEPENDENCIES)
cd ../.. && $(PIPE) "./sage --docbuild --no-pdf-links all html $(SAGE_DOCBUILD_OPTS) 2>&1" "tee -a logs/dochtml.log"
cd ../.. && sage-logger './sage --docbuild --no-pdf-links all html $(SAGE_DOCBUILD_OPTS)' logs/dochtml.log

# 'doc-html-no-plot': build docs without building the graphics coming
# from the '.. plot' directive, in case you want to save a few
# megabytes of disk space. 'doc-clean' is a prerequisite because the
# presence of graphics is cached in src/doc/output.
doc-html-no-plot: doc-clean $(DOC_DEPENDENCIES)
cd ../.. && $(PIPE) "./sage --docbuild --no-pdf-links --no-plot all html $(SAGE_DOCBUILD_OPTS) 2>&1" "tee -a logs/dochtml.log"
cd ../.. && sage-logger './sage --docbuild --no-pdf-links --no-plot all html $(SAGE_DOCBUILD_OPTS)' logs/dochtml.log

doc-html-mathjax: $(DOC_DEPENDENCIES)
cd ../.. && $(PIPE) "./sage --docbuild --no-pdf-links all html -j $(SAGE_DOCBUILD_OPTS) 2>&1" "tee -a logs/dochtml.log"
cd ../.. && sage-logger './sage --docbuild --no-pdf-links all html -j $(SAGE_DOCBUILD_OPTS)' logs/dochtml.log

# Keep target 'doc-html-jsmath' for backwards compatibility.
doc-html-jsmath: doc-html-mathjax

doc-pdf: $(DOC_DEPENDENCIES)
cd ../.. && $(PIPE) "./sage --docbuild all pdf $(SAGE_DOCBUILD_OPTS) 2>&1" "tee -a logs/docpdf.log"
cd ../.. && sage-logger './sage --docbuild all pdf $(SAGE_DOCBUILD_OPTS)' logs/docpdf.log

doc-clean:
cd "$(SAGE_SRC)/doc" && $(MAKE) clean
Expand All @@ -228,7 +227,7 @@ clean:
@echo "Deleting package build directories..."
rm -rf "$(SAGE_LOCAL)/var/tmp/sage/build"

lib-clean:
sagelib-clean:
cd "$(SAGE_SRC)" && $(MAKE) clean

build-clean: clean doc-clean lib-clean
build-clean: clean doc-clean sagelib-clean
2 changes: 1 addition & 1 deletion build/make/install
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ filtered_packages_list all | while read PKG_NAME PKG_VERSION PKG_VAR; do
DEPS=""
fi
echo >&5 "\$(INST)/$PKG_VERSION:$DEPS"
echo >&5 " +\$(PIPE) \"\$(SAGE_SPKG) \$($PKG_VAR) 2>&1\" \"tee -a \$(SAGE_LOGS)/\$($PKG_VAR).log\""
echo >&5 " +sage-logger '\$(SAGE_SPKG) \$($PKG_VAR)' '\$(SAGE_LOGS)/\$($PKG_VAR).log'"
echo >&5

# Add a target with just the bare package name such that
Expand Down

0 comments on commit fe2387c

Please sign in to comment.