diff --git a/Makefile b/Makefile index 2e756b9f839..d9968fe48e2 100644 --- a/Makefile +++ b/Makefile @@ -110,6 +110,7 @@ bootstrap-clean: rm -rf config configure build/make/Makefile-auto.in rm -f src/doc/en/installation/*.txt rm -rf src/doc/en/reference/spkg/*.rst + rm -f src/doc/en/reference/repl/*.txt # Remove absolutely everything which isn't part of the git repo maintainer-clean: distclean bootstrap-clean diff --git a/bootstrap b/bootstrap index 60c65eb18f4..1e0fb4452ce 100755 --- a/bootstrap +++ b/bootstrap @@ -160,7 +160,7 @@ save () { # Create configure tarball echo "Creating $NEWCONFBALL..." mkdir -p upstream - tar zcf "$NEWCONFBALL" configure config/* build/make/Makefile-auto.in src/doc/en/installation/*.txt src/doc/en/reference/spkg/*.rst + tar zcf "$NEWCONFBALL" configure config/* build/make/Makefile-auto.in src/doc/en/installation/*.txt src/doc/en/reference/spkg/*.rst src/doc/en/reference/repl/*.txt # Update version echo "$NEWCONFVERSION" >$PKG/package-version.txt diff --git a/build/bin/sage-site b/build/bin/sage-site new file mode 100755 index 00000000000..566ae033010 --- /dev/null +++ b/build/bin/sage-site @@ -0,0 +1,170 @@ +#!/usr/bin/env bash +# Handle options of the src/bin/sage script that pertain to SAGE_ROOT or sage-the-distribution. + +usage() { + echo + #### 1.......................26..................................................78 + #### |.....................--.|...................................................| + echo "Sage-the-distribution options:" + echo " --optional -- list all optional packages that can be installed" + echo " --experimental -- list all experimental packages that can be installed" + echo " --info [packages] -- print the SPKG.txt or SPKG.rst of the given packages," + echo " and some additional information." + echo " -i [packages] -- install the given Sage packages" + echo " --upgrade [version] -- download, build and install the given version. Here," + echo " 'version' is a git branch or tag name. Useful values" + echo " are 'master' (the current development version, this" + echo " is the default) or a version number like '5.13'." +} + +usage_advanced() { + echo + #### 1.......................26..................................................78 + #### |.....................--.|...................................................| + echo "Building the Sage library:" + echo + echo " -b -- build Sage library -- do this if you have" + echo " modified any source code files in SAGE_ROOT/src/sage/" + echo " -ba -- same as -b, but rebuild *all* Cython" + echo " code. This could take a while, so you will be asked" + echo " if you want to proceed." + echo " --ba-force -- same as -ba, but don't query before rebuilding" + echo " -br -- build and run Sage" + echo + echo " -bt [...] -- build Sage and test; same options as -t" + echo " -btp [...] -- build Sage and test in parallel; same options as -tp" + echo " -btnew [...] -- build Sage and test modified files, as in -t --new" + echo + echo " -bn [...], --build-and-notebook [...]" + echo " -- build the Sage library (as by running \"sage -b\")" + echo " and then start the notebook" + echo + echo "Package handling:" + echo + echo " --package [args] -- call the package manager with given arguments." + echo " Run without arguments for help." + echo " --experimental -- list all experimental packages that can be installed" + echo " -i [opts] [pkgs] -- install the given Sage packages. Options:" + echo " -c -- run the packages' test suites," + echo " overriding the settings of" + echo " SAGE_CHECK and SAGE_CHECK_PACKAGES" + echo " -d -- only download, do not install packages" + echo " -f -- force build: install the packages even" + echo " if they are already installed" + echo " -s -- do not delete the temporary build directories" + echo " after a successful build" + echo " -y -- reply yes to prompts about experimental" + echo " and old-style packages; warning: there" + echo " is no guarantee that these packages will" + echo " build correctly; use at your own risk" + echo " -n -- reply no to prompts about experimental" + echo " and old-style packages" + echo " -f [opts] [pkgs] -- shortcut for -i -f: force build of the given Sage" + echo " packages" + echo " -p [opts] [packages]-- install the given Sage packages, without dependency" + echo " checking. Options are the same as for the -i command." + echo " --location -- if needed, fix paths to make Sage relocatable" + echo " --optional -- list all optional packages that can be installed" + echo " --standard -- list all standard packages that can be installed" + echo " --installed -- list all installed packages" + echo + echo "Upgrading:" + echo + echo " --upgrade [version] -- download, build and install the given version. Here," + echo " 'version' is a git branch or tag name. Useful values" + echo " are 'master' (the current development version, this" + echo " is the default) or a version number like '5.13'." + + echo + #### 1.......................26..................................................78 + #### |.....................--.|...................................................| + echo "Making Sage distributions:" + echo + echo " --sdist -- build a source distribution of Sage" + echo + echo "Building the documentation:" + echo + echo " --docbuild [lang/] -- Build the Sage documentation" + echo + echo "Other developer tools:" + echo + echo " --root -- print the Sage root directory" + echo " --git-branch -- print the current git branch" + echo " --buildsh [...] -- run a shell with Sage environment variables" + echo " as they are set while building Sage and its packages" + echo + #### 1.......................26..................................................78 + #### |.....................--.|...................................................| +} + +if [ "$1" = '-h' -o "$1" = '-?' -o "$1" = '-help' -o "$1" = '--help' ]; then + usage + exit 0 +fi +if [ "$1" = "-advanced" -o "$1" = "--advanced" ]; then + usage_advanced + exit 0 +fi + +##################################################################### +# Package handling +##################################################################### + +if [ "$1" = '-package' -o "$1" = "--package" ]; then + shift + exec sage-package $@ +fi + +if [ "$1" = '-optional' -o "$1" = "--optional" ]; then + shift + exec sage-list-packages optional $@ +fi + +if [ "$1" = '-experimental' -o "$1" = "--experimental" ]; then + shift + exec sage-list-packages experimental $@ +fi + +if [ "$1" = '-standard' -o "$1" = "--standard" ]; then + shift + exec sage-list-packages standard $@ +fi + +if [ "$1" = '-installed' -o "$1" = "--installed" ]; then + shift + exec sage-list-packages all --installed-only $@ +fi + +if [ "$1" = '-p' ]; then + echo "Error: Installing old-style SPKGs is no longer supported." + exit 1 +fi + +if [ "$1" = '-info' -o "$1" = '--info' ]; then + shift + for PKG in "$@" + do + sage-spkg --info "$PKG" || exit $? + done + exit 0 +fi + +##################################################################### +# Building the documentation. +##################################################################### + +if [ "$1" = "-docbuild" -o "$1" = "--docbuild" ]; then + # Redirect stdin from /dev/null. This helps with running TeX which + # tends to ask interactive questions if something goes wrong. These + # cause the build to hang. If stdin is /dev/null, TeX just aborts. + shift + exec sage-python -m sage_setup.docbuild "$@" ... +# sage {-i|-p} ... # # Options can be: # -s: do not delete temporary build directory @@ -75,12 +75,10 @@ export LC_ALL=C.UTF-8 usage() { cat < +Usage: sage {-i|-p} -If 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. +Search Sage's list of packages (see 'sage --package list') for a +matching package, and if a match is found, install it. Options: -s: do not delete the temporary build directory @@ -251,37 +249,16 @@ done # Figure out the package filename, download it if needed. ################################################################## # One should be able to install a package using -# sage -i where can be any of the -# following values: -# -# 1a. /path/to/-x.y.z.spkg, i.e. the package is found somewhere -# in your file system and you're giving an absolute path. -# 1b. relative/path/to/-x.y.z.spkg, the same with a relative -# path. -# 2a. -x.y.z, i.e. the name of the package plus the package's -# version numbers. -# 2b. -x.y.z.spkg, i.e. the name of the package in addition to -# the version numbers and the ".spkg" extension. -# 3. , i.e. the name of the package without a version number. -# 4. /-x.y.z.spkg, i.e. the full URL where the package -# is hosted. Any local packages matching are ignored. -# -# In cases 2a, 2b 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. -# -# See #7544 and #12602. -# +# sage -i PKG_SRC="$1" # Does PKG_SRC contain a slash? if echo "$PKG_SRC" | grep / >/dev/null; then - PKG_HAS_PATH=yes + echo >&2 "Error: Installing old-style SPKGs is no longer supported" + exit 1 fi -# PKG_NAME is the last path component without .spkg -# This already reduces case 2b to case 2a. -PKG_NAME=`basename "$PKG_SRC" | sed 's/\.spkg$//'` -PKG_BASE=`echo "$PKG_NAME" | sed 's/-.*//'` +PKG_NAME="$PKG_SRC" +PKG_BASE=`echo "$PKG_NAME" | sed 's/-.*//'` # strip version number # USE_LOCAL_SCRIPTS is a flag that if non-empty will cause # this script to try to install the package using local metadata @@ -289,39 +266,31 @@ PKG_BASE=`echo "$PKG_NAME" | sed 's/-.*//'` # the value of this flag is set in the next codeblock USE_LOCAL_SCRIPTS= -if [ -f "$PKG_SRC" ]; then - # PKG_SRC is a file. If it is given by a relative path, prepend `pwd` - # (reduce case 1b to 1a) - if ! echo "$PKG_SRC" | grep '^/' >/dev/null; then - PKG_SRC="`pwd`/$PKG_SRC" - fi -elif [ -z "$PKG_HAS_PATH" ]; then - # If PKG_SRC is not an existing file and doesn't contain a slash, - # we are in case 2a or 3. If version in 2a matches the version in - # build/pkgs or we are in case 3 use the local scripts, otherwise - # we try to find a package in upstream - PKG_VER="${PKG_NAME#${PKG_BASE}}" - PKG_VER="${PKG_VER#-}" - PKG_SCRIPTS="$SAGE_ROOT/build/pkgs/$PKG_BASE" - LOCAL_PKG_VER=`cat $PKG_SCRIPTS/package-version.txt 2>/dev/null` - if [ -n "$LOCAL_PKG_VER" ] && [ -z "$PKG_VER" -o "$PKG_VER" = "$LOCAL_PKG_VER" ]; then - PKG_VER="$LOCAL_PKG_VER" - if [ -z "$PKG_VER" ]; then - PKG_NAME="${PKG_BASE}" - else - PKG_NAME="${PKG_BASE}-${PKG_VER}" - fi - USE_LOCAL_SCRIPTS=yes - PKG_BASE_VER=`echo $PKG_VER | sed 's/\.p[0-9][0-9]*$//'` - PKG_NAME_UPSTREAM=`lookup_param tarball "$PKG_SCRIPTS/checksums.ini" | sed "s/VERSION/$PKG_BASE_VER/"` - echo "Found local metadata for $PKG_NAME" - - # Warning for experimental packages - if [ x`cat "$PKG_SCRIPTS/type"` = x"experimental" -a $INFO = 0 ]; then - if [ $YES != 1 ]; then - # We use /dev/tty here because our output may be redirected - # to a logfile, or line-buffered. - write_to_tty </dev/null` +PKG_VER="$LOCAL_PKG_VER" +if [ -z "$PKG_VER" ]; then + PKG_NAME="${PKG_BASE}" +else + PKG_NAME="${PKG_BASE}-${PKG_VER}" +fi +USE_LOCAL_SCRIPTS=yes +PKG_BASE_VER=`echo $PKG_VER | sed 's/\.p[0-9][0-9]*$//'` +PKG_NAME_UPSTREAM=`lookup_param tarball "$PKG_SCRIPTS/checksums.ini" | sed "s/VERSION/$PKG_BASE_VER/"` +echo "Found local metadata for $PKG_NAME" + +# Warning for experimental packages +if [ x`cat "$PKG_SCRIPTS/type"` = x"experimental" -a $INFO = 0 ]; then + if [ $YES != 1 ]; then + # We use /dev/tty here because our output may be redirected + # to a logfile, or line-buffered. + write_to_tty < /dev/tty 2>&1 - else - answer=n - fi - case "$answer" in - n*|N*) exit 1;; - esac - # Confirm the user's input. (This gives important - # feedback to the user when output is redirected to a logfile.) - echo > /dev/tty "OK, installing $PKG_NAME now..." - fi + if [ $? -ne 0 ]; then + echo "Terminal not available for prompting. Use 'sage -i -y $PKG_BASE'" + echo "to install experimental packages in non-interactive mode." + YES=-1 fi - - else - cd "$SAGE_DISTFILES" - for spkg in `ls -1t ${PKG_NAME}.spkg ${PKG_NAME}-*.spkg 2>/dev/null`; do - if [ -f "$spkg" ]; then - # Found a good package - echo "Found package $PKG_NAME in $SAGE_DISTFILES/$spkg" - PKG_SRC="`pwd`/$spkg" - PKG_NAME=`basename "$spkg" | sed 's/\.spkg$//'` - break - fi - done + if [ $YES != -1 ]; then + read -p "Are you sure you want to continue [Y/n]? " answer < /dev/tty > /dev/tty 2>&1 + else + answer=n + fi + case "$answer" in + n*|N*) exit 1;; + esac + # Confirm the user's input. (This gives important + # feedback to the user when output is redirected to a logfile.) + echo > /dev/tty "OK, installing $PKG_NAME now..." fi fi @@ -376,154 +331,8 @@ if [ ! -f "$PKG_SRC" ]; then fi PKG_SRC="$SAGE_DISTFILES/$PKG_NAME_UPSTREAM" else - # Handle all the legacy cruft. This branch can be deleted once - # we get rid of old-style spkgs - if [ $YES = -1 ]; then - # User provided -n option, so don't even try to download the package" - echo "Old-style packages disabled by use of '-n' option" - exit 1 - fi - if [ $INFO -eq 0 ]; then - echo "Attempting to download package $PKG_NAME" - else - echo "Attempting to get on-line info for package $PKG_NAME" - fi - - # Reduce everything to case 4: full URL. - 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 - error_msg "Error downloading list of packages" - exit 1 - fi - for repo in optional experimental huge; 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 - error_msg "Error downloading $MIRROR/$repo/list" - 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 - if [ $YES != 1 ]; then - # Warn and ask the user if downloading an - # experimental package. - # Add a deprecation note for other packages, - # since old-style packages are deprecated. - if [ $repo = experimental ]; then - write_to_tty < /dev/tty 2>&1 - else - answer=n - fi - case "$answer" in - n*|N*) exit 1;; - esac - else - # Deprecated since Sage 6.9, Trac #19158 - write_to_tty < /dev/tty 2>&1 - elif [ $YES = -1 ]; then - answer=n - else - answer=y - fi - case "$answer" in - n*|N*) exit 1;; - esac - fi - # Confirm the user's input. (This gives important - # feedback to the user when output is redirected to a logfile.) - echo > /dev/tty "OK, installing $PKG_NAME now..." - 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" - echo >&2 " Try 'sage --package list' to see the available packages" - echo >&2 " $(sage-package apropos $PKG_NAME)" - exit 1 - fi - fi - - # Trac #5852: check write permissions - mkdir -p "$SAGE_DISTFILES" - if [ ! -w "$SAGE_DISTFILES" ]; then - error_msg "Error: no write access to packages directory $SAGE_PACKAGES" - exit 1 - fi - cd "$SAGE_DISTFILES" || exit $? - - # Download to a temporary file (such that we don't end up with a - # corrupted .spkg file). - PKG_TMP="${PKG_URL##*/}.tmp" - echo ">>> Trying to download $PKG_URL" - sage-download-file "$PKG_URL" "$PKG_TMP" - if [ $? -ne 0 ]; then - # Delete failed download - rm -f "$PKG_TMP" - error_msg "Error downloading $PKG_URL" - exit 1 - fi - - PKG_SRC="`pwd`/${PKG_URL##*/}" - mv -f "$PKG_TMP" "$PKG_SRC" + echo >&2 "Error: Installing old-style SPKGs is no longer supported" + exit 1 fi fi @@ -636,21 +445,8 @@ if [ "$USE_LOCAL_SCRIPTS" = yes ]; then exit 1 fi else - # Old-style package (deprecated) - echo "Extracting package $PKG_SRC" - ls -l "$PKG_SRC" - - sage-uncompress-spkg "$PKG_SRC" - if [ $? -ne 0 ]; then - error_msg "Error: failed to extract $PKG_SRC" - exit 1 - fi - - cd "$PKG_NAME" - if [ $? -ne 0 ]; then - error_msg "Error: after extracting, the directory '$PKG_NAME' does not exist" - exit 1 - fi + echo >&2 "Error: Installing old-style SPKGs is no longer supported." + exit 1 fi echo "Finished extraction" @@ -1049,4 +845,4 @@ fi touch "$SAGE_LOCAL/lib/sage-force-relocate.txt" -echo "Finished installing $PKG_NAME.spkg" +echo "Finished installing $PKG_NAME" diff --git a/build/make/Makefile.in b/build/make/Makefile.in index f17d4a49ab4..5ca1ff65478 100644 --- a/build/make/Makefile.in +++ b/build/make/Makefile.in @@ -96,16 +96,13 @@ OPTIONAL_CLEANED_PACKAGES_CLEANS = $(OPTIONAL_CLEANED_PACKAGES:%=%-clean) # All packages which should be downloaded SDIST_PACKAGES = @SAGE_SDIST_PACKAGES@ -SCRIPTS = @SAGE_SCRIPTS@ - # Packages that use the 'normal' build rules NORMAL_PACKAGES = @SAGE_NORMAL_PACKAGES@ # Packages that use the 'pip' package build rules PIP_PACKAGES = @SAGE_PIP_PACKAGES@ -# Packages that use the 'script' package build rules (not to be confused with -# the $(SCRIPTS) list) +# Packages that use the 'script' package build rules SCRIPT_PACKAGES = @SAGE_SCRIPT_PACKAGES@ @@ -203,8 +200,7 @@ all-sage: \ sagelib \ $(STANDARD_PACKAGE_INSTS) \ $(OPTIONAL_INSTALLED_PACKAGE_INSTS) \ - $(OPTIONAL_CLEANED_PACKAGES_CLEANS) \ - $(SCRIPTS) + $(OPTIONAL_CLEANED_PACKAGES_CLEANS) # Download all packages which should be inside an sdist tarball (the -B # option to make forces all targets to be built unconditionally) @@ -243,7 +239,7 @@ PYTHON_TOOLCHAIN = setuptools pip setuptools_scm future # Everything needed to start up Sage using "./sage". Of course, not # every part of Sage will work. It does not include Maxima for example. -SAGERUNTIME = sagelib $(SCRIPTS) $(inst_ipython) $(inst_pexpect) \ +SAGERUNTIME = sagelib $(inst_ipython) $(inst_pexpect) \ $(inst_psutil) $(inst_future) all-sageruntime: toolchain-deps @@ -269,14 +265,6 @@ $(STARTED): $(STANDARD_PACKAGE_INSTS) ############################################################################### base: $(inst_patch) $(inst_pkgconf) -############################################################################### -# Building scripts -############################################################################### - -# Don't just use "install" since we don't want to change permissions -$(SAGE_LOCAL)/bin/%: $(SAGE_SRC)/bin/% - $(AM_V_at)cp $< $@ - ############################################################################### # Building the documentation ############################################################################### diff --git a/build/pkgs/d3js/spkg-src b/build/pkgs/d3js/spkg-src index d8c8e66062e..134c8f0bc5d 100755 --- a/build/pkgs/d3js/spkg-src +++ b/build/pkgs/d3js/spkg-src @@ -36,6 +36,6 @@ mv "d3js-${ZIP_VERSION}.tar.gz" "${SAGE_ROOT}/upstream/" # update package info cd .. echo "${ZIP_VERSION}" > 'package-version.txt' -sage -sh 'sage-fix-pkg-checksums' +sage --package fix-checksum diff --git a/build/pkgs/ecl/spkg-src b/build/pkgs/ecl/spkg-src index 6333c7f3c8c..37ac03bf27b 100755 --- a/build/pkgs/ecl/spkg-src +++ b/build/pkgs/ecl/spkg-src @@ -53,5 +53,5 @@ autoreconf -ivf cd ../.. tar c ecl-$ECLVERSION | bzip2 -c >"$ECLTARBALL" -sage-fix-pkg-checksums "$ECLTARBALL" +sage --package fix-checksum "$ECLTARBALL" rm -rf ecl-* diff --git a/build/pkgs/maxima/SPKG.rst b/build/pkgs/maxima/SPKG.rst index edda0e0d067..4144178786f 100644 --- a/build/pkgs/maxima/SPKG.rst +++ b/build/pkgs/maxima/SPKG.rst @@ -43,7 +43,7 @@ Special Update/Build Instructions and download the source tarball maxima-x.y.z.tar.gz; place it in the upstream/ directory. -2. Update package-version.txt and run sage-fix-pkg-checksums. +2. Update package-version.txt and run 'sage --package fix-checksum'. 3. Make sure the patches still apply cleanly, and update them if necessary. diff --git a/build/pkgs/r/spkg-src b/build/pkgs/r/spkg-src index 349ec3e5846..23ce98c4702 100755 --- a/build/pkgs/r/spkg-src +++ b/build/pkgs/r/spkg-src @@ -10,4 +10,4 @@ set -e wget http://cran.r-project.org/src/base/R-3/$SOURCE_TARBALL mv $SOURCE_TARBALL $SAGE_ROOT/upstream/$TARGET_TARBALL -sage -sh 'sage-fix-pkg-checksums' +sage --package fix-checksum diff --git a/configure.ac b/configure.ac index bc7e9fe1510..87ceba98628 100644 --- a/configure.ac +++ b/configure.ac @@ -414,21 +414,6 @@ AC_SUBST([SAGE_SPKG_OPTIONS]) SAGE_SPKG_COLLECT() -# We need sage-env-config to exist before running this. -# TODO: fix this in Trac #21524 -touch "$SAGE_SRC/bin/sage-env-config" - -SAGE_SCRIPTS='' -for file in "$SAGE_SRC/bin/"*; do - # Skip files with ".in" extension - ext=${file##*.} - if test "$ext" != in; then - SAGE_SCRIPTS="${SAGE_SCRIPTS} \\$(printf '\n ')\$(SAGE_LOCAL)${file#$SAGE_SRC}" - fi -done - -AC_SUBST([SAGE_SCRIPTS]) - dnl AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([build/make/Makefile-auto build/make/Makefile]) AC_CONFIG_FILES([src/bin/sage-env-config build/bin/sage-build-env-config]) diff --git a/src/bin/sage b/src/bin/sage index d7c009fb402..4fc35077123 100755 --- a/src/bin/sage +++ b/src/bin/sage @@ -24,30 +24,21 @@ usage() { echo echo "Optional arguments:" echo " file.[sage|py|spyx] -- run given .sage, .py or .spyx file" - echo " -advanced -- list all command line options" + echo " --advanced -- list all command line options" echo " -c -- Evaluates cmd as sage code" - echo " -experimental -- list all experimental packages that can be installed" - echo " -gap [...] -- run Sage's Gap with given arguments" - echo " -gap3 [...] -- run Sage's Gap3 with given arguments" - echo " -gp [...] -- run Sage's PARI/GP calculator with given arguments" - echo " -h, -? -- print this help message" - echo " -i [packages] -- install the given Sage packages" - echo " -pip [...] -- invoke pip, the Python package manager" - echo " -inotebook [...] -- start the *insecure* Sage notebook (deprecated)" - echo " -maxima [...] -- run Sage's Maxima with given arguments" - echo " -mwrank [...] -- run Sage's mwrank with given arguments" + echo " --gap [...] -- run Sage's Gap with given arguments" + echo " --gp [...] -- run Sage's PARI/GP calculator with given arguments" + echo " -h -- print this help message" + echo " --pip [...] -- invoke pip, the Python package manager" + echo " --maxima [...] -- run Sage's Maxima with given arguments" + echo " --mwrank [...] -- run Sage's mwrank with given arguments" echo " --notebook=[...] -- start the Sage notebook (valid options are" - echo " 'default', 'sagenb', 'jupyter', and 'export')" + echo " 'default', 'jupyter', and 'export')" echo " Current default is 'export' from sagenb to jupyter" echo " -n, --notebook -- shortcut for --notebook=default" - echo " -optional -- list all optional packages that can be installed" - echo " -python [...] -- run the Python interpreter" - echo " -python2 [...] -- run the Python 2 interpreter" - echo " -python3 [...] -- run the Python 3 interpreter" + echo " --python [...], --python3 [...] -- run the Python 3 interpreter" echo " -R [...] -- run Sage's R with given arguments" - echo " -singular [...] -- run Sage's singular with given arguments" - echo " -sqlite3 [...] -- run Sage's sqlite3 with given arguments" - echo " -root -- print the Sage root directory" + echo " --singular [...] -- run Sage's singular with given arguments" echo " --nodotsage -- run Sage without using the user's .sage directory:" echo " create and use a temporary .sage directory instead" echo " -t [options] <--all|files|dir>" @@ -56,237 +47,16 @@ usage() { echo " --long - include lines with the phrase 'long time'" echo " --verbose - print debugging output during the test" echo " --optional - controls which optional tests are run" - echo " --sagenb - test all sagenb files" echo " --help - show all testing options" - echo " -upgrade [version] -- download, build and install the given version. Here," - echo " 'version' is a git branch or tag name. Useful values" - echo " are 'master' (the current development version, this" - echo " is the default) or a version number like '5.13'." - echo " -v, -version -- display Sage version information" - exit 0 -} - -usage_advanced() { - sage_version -v - #### 1.......................26..................................................78 - #### |.....................--.|...................................................| - echo - echo "Running Sage:" - echo " file.[sage|py|spyx] -- run given .sage, .py or .spyx file" - echo " -advanced -- print this advanced help message" - echo " -c -- Evaluates cmd as sage code" - echo " -h, -? -- print short help message" - echo " -min [...] -- do not populate global namespace (must be first" - echo " option)" - echo " -preparse -- preparse file.sage and produce corresponding file.sage.py" - echo " -q -- quiet; start with no banner" - echo " -root -- print the Sage root directory" - echo " -gthread, -qthread, -q4thread, -wthread, -pylab" - echo " -- pass the option through to ipython" - echo " -v, -version -- display Sage version information" - echo " -dumpversion -- print Sage version" - echo " -git-branch -- print the current git branch" - - echo - #### 1.......................26..................................................78 - #### |.....................--.|...................................................| - echo "Running the notebook:" - echo " --notebook=[...] -- start the Sage notebook (valid options are" - echo " 'default', 'sagenb', 'jupyter' and 'export')." - echo " Current default is 'export' sagenb to jupyter." - echo " See the output of sage --notebook --help" - echo " for more details and examples of how to pass" - echo " optional arguments" - echo " -bn, -build-and-notebook [...] -- build the Sage library then start" - echo " the Sage notebook" - echo " -inotebook [...] -- start the *insecure* Sage notebook (deprecated)" - echo " -n, -notebook [...] -- start the default Sage notebook (options are the" - echo " same as for the notebook command in Sage). See the" - echo " output of sage -n -h for more details" - - echo - #### 1.......................26..................................................78 - #### |.....................--.|...................................................| - echo "Running external programs:" - echo " -cleaner -- run the Sage cleaner" - echo " -cython [...] -- run Cython with given arguments" - echo " -ecl [...] -- run Common Lisp" - echo " -gap [...] -- run Sage's Gap with given arguments" - echo " -gap3 [...] -- run Sage's Gap3 with given arguments" - echo " -gdb -- run Sage under the control of gdb" - echo " -gp [...] -- run Sage's PARI/GP calculator with given arguments" - echo " -ipython [...] -- run Sage's IPython using the default environment (not" - echo " Sage), passing additional options to IPython" - echo " -ipython3 [...] -- same as above, but using Python 3" - echo " -jupyter [...] -- run Sage's Jupyter with given arguments" - echo " -kash [...] -- run Sage's Kash with given arguments" - command -v kash &>/dev/null || \ - echo " (not installed currently, run sage -i kash)" - echo " -lisp [...] -- run Lisp interpreter included with Sage" - echo " -M2 [...] -- run Sage's Macaulay2 with given arguments" - command -v M2 &>/dev/null || \ - echo " (not installed currently, run sage -i macaulay2)" - echo " -maxima [...] -- run Sage's Maxima with given arguments" - echo " -mwrank [...] -- run Sage's mwrank with given arguments" - echo " -polymake [...] -- run Sage's Polymake with given arguments" - command -v polymake &>/dev/null || \ - echo " (not installed currently, run sage -i polymake)" - echo " -python [...] -- run the Python interpreter" - echo " -python2 [...] -- run the Python 2 interpreter" - echo " -python3 [...] -- run the Python 3 interpreter" - echo " -R [...] -- run Sage's R with given arguments" - echo " -scons [...] -- run Sage's scons" - echo " -sh [...] -- run \$SHELL ($SHELL) with Sage environment variables" - echo " as they are set in the runtime of Sage" - echo " -buildsh [...] -- run \$SHELL ($SHELL) with Sage environment variables" - echo " as they are set while building Sage and its packages" - echo " -singular [...] -- run Sage's singular with given arguments" - echo " -sqlite3 [...] -- run Sage's sqlite3 with given arguments" - echo " -twistd [...] -- run Twisted server" - - echo - #### 1.......................26..................................................78 - #### |.....................--.|...................................................| - echo "Installing packages and upgrading:" - echo " -package [args] -- call the new package manager with given arguments." - echo " Run without arguments for package-specific help." - echo " -experimental -- list all experimental packages that can be installed" - echo " -f [opts] [packages]-- shortcut for -i -f: force build of the given Sage" - echo " packages" - echo " -i [opts] [packages]-- install the given Sage packages. Options:" - echo " -c -- run the packages' test suites" - echo " -d -- only download, do not install packages" - echo " -f -- force build: install the packages even" - echo " if they are already installed" - echo " -s -- do not delete the temporary build directories" - echo " after a successful build" - echo " -y -- reply yes to prompts about experimental" - echo " and old-style packages; warning: there" - echo " is no guarantee that these packages will" - echo " build correctly; use at your own risk" - echo " -n -- reply no to prompts about experimental" - echo " and old-style packages" - echo " -p [opts] [packages]-- install the given Sage packages, without dependency" - echo " checking and with support for old-style spkgs." - echo " Options are -c, -d and -s with the same meaning as" - echo " for the -i command" - echo " -info [packages] -- print the SPKG.txt or SPKG.rst of the given packages," - echo " and some additional information." - echo " --location -- if needed, fix paths to make Sage relocatable" - echo " -optional -- list all optional packages that can be installed" - echo " -standard -- list all standard packages that can be installed" - echo " -installed -- list all installed packages" - echo " -upgrade [version] -- download, build and install the given version. Here," - echo " 'version' is a git branch or tag name. Useful values" - echo " are 'master' (the current development version, this" - echo " is the default) or a version number like '5.13'." - echo " -pip [...] -- invoke pip, the Python package manager" - - echo - #### 1.......................26..................................................78 - #### |.....................--.|...................................................| - echo "Building and testing the Sage library:" - echo " -b -- build Sage library." - echo " -ba -- same as -b and rebuild all Cython code" - echo " -ba-force -- same as -ba, but don't query before rebuilding" - echo " -br -- build and run Sage" - echo " -bt [...] -- build and test, options like -t below" - echo " -btp [...] -- build and test parallel, options like -tp below" - echo " -btnew [...] -- build and test modified files, options like -tnew" - echo " -fixdoctests [output_file] [--long]" - echo " -- replace failing doctests with the actual output. With" - echo " optional output_file: redirect there. With the --long" - echo " option: include #long time tests." - echo " -startuptime [module] -- display how long each component of Sage takes to" - echo " start up; optionally specify a module to get more" - echo " details about that particular module" - echo " -t [options] <--all|files|dir>" - echo " -- test examples in .py, .pyx, .sage, .tex or .rst files" - echo " selected options:" - echo " --long - include lines with the phrase 'long time'" - echo " --verbose - print debugging output during the test" - echo " --all - test all files" - echo " --sagenb - test all sagenb files" - echo " --optional - controls which optional tests are run" - echo " --new - only test files modified since last commit" - echo " --initial - only show the first failure per block" - echo " --debug - drop into PDB after an unexpected error" - echo " --failed - only test files that failed last test" - echo " --warn-long [timeout] - warning if doctest is slow" - echo " --only-errors - only output failures, not successes" - echo " --gc=GC - control garbarge collection (ALWAYS:" - echo " collect garbage before every test; NEVER:" - echo " disable gc; DEFAULT: Python default)" - echo " --help - show all testing options" - echo " -tp [...] -- like -t above, but tests in parallel using N threads" - echo " with 0 interpreted as a sensible default" - echo " -testall [options] -- test all source files, docs, and examples. options" - echo " like -t" - - echo - #### 1.......................26..................................................78 - #### |.....................--.|...................................................| - echo "Documentation:" - echo " -coverage -- give info about doctest coverage of files" - echo " -coverageall -- give summary info about doctest coverage of all" - echo " files in the Sage library" - echo " -docbuild [lang/] -- Build the Sage documentation" - echo " -search_src -- search through all the Sage library code for string" - echo " -search_doc -- search through the Sage documentation for string" - echo " -grep -- same as -search_src" - echo " -grepdoc -- same as -search_doc" - - echo - #### 1.......................26..................................................78 - #### |.....................--.|...................................................| - echo "File conversion:" - echo " -rst2ipynb [...] -- Generates Jupyter notebook (.ipynb) from standalone" - echo " reStructuredText source." - command -v rst2ipynb &>/dev/null || \ - echo " (not installed currently, run sage -i rst2ipynb)" - echo " -ipynb2rst [...] -- Generates a reStructuredText source file from" - echo " a Jupyter notebook (.ipynb)." - echo " -rst2txt [...] -- Generates Sage worksheet text file from standalone" - echo " reStructuredText source." - echo " -rst2sws [...] -- Generates Sage worksheet (.sws) from standalone" - echo " reStructuredText source." - echo " -sws2rst -- Generates a reStructuredText source file from" - echo " a Sage worksheet (.sws) document." - - echo - #### 1.......................26..................................................78 - #### |.....................--.|...................................................| - echo "Making Sage packages or distributions:" - echo " -sdist -- build a source distribution of Sage" - echo " -fix-pkg-checksums -- fix the checksums from build/pkgs directories from " - echo " the packages located in upstream/" - - echo - #### 1.......................26..................................................78 - #### |.....................--.|...................................................| - echo "Valgrind memory debugging:" - echo " -cachegrind -- run Sage using Valgrind's cachegrind tool. The log" - echo " files are named sage-cachegrind.PID can be found in" - echo " $DOT_SAGE" - echo " -callgrind -- run Sage using Valgrind's callgrind tool. The log" - echo " files are named sage-callgrind.PID can be found in" - echo " $DOT_SAGE" - echo " -massif -- run Sage using Valgrind's massif tool. The log" - echo " files are named sage-massif.PID can be found in" - echo " $DOT_SAGE" - echo " -memcheck -- run Sage using Valgrind's memcheck tool. The log" - echo " files are named sage-memcheck.PID can be found in" - echo " $DOT_SAGE" - echo " -omega -- run Sage using Valgrind's omega tool. The log" - echo " files are named sage-omega.PID can be found in" - echo " $DOT_SAGE" - echo " -valgrind -- this is an alias for -memcheck" - echo - echo "You can also use -- before a long option, e.g., 'sage --optional'." - echo + echo " -v, --version -- display Sage version information" + if [ -n "$SAGE_ROOT" ]; then + exec "$SAGE_ROOT/build/bin/sage-site" "-h" + fi exit 0 } +# 'usage_advanced', which prints a longer help message, is defined +# below, after sourcing sage-env. ##################################################################### # Special options to be processed without sage-env @@ -385,7 +155,7 @@ if [ "$1" = '-i' ]; then # See https://trac.sagemath.org/ticket/25078 if ! echo "$ALL_TARGETS" | grep "^${PKG}$" >/dev/null; then echo >&2 "Error: package '$PKG' not found" - echo >&2 "Note: if it is an old-style package, use -p instead of -i to install it" + echo >&2 "Note: if it is an old-style package, installing these is no longer supported" exit 1 fi $MAKE SAGE_SPKG="sage-spkg $INSTALL_OPTIONS" "$PKG" @@ -396,7 +166,6 @@ if [ "$1" = '-i' ]; then exit 0 fi - ##################################################################### # Report information about the Sage environment ##################################################################### @@ -416,15 +185,6 @@ if [ "$1" = '-root' -o "$1" = '--root' ]; then exit 0 fi -if [ $# -gt 0 ]; then - if [ "$1" = '-h' -o "$1" = '-?' -o "$1" = '-help' -o "$1" = '--help' ]; then - usage - fi - if [ "$1" = "-advanced" -o "$1" = "--advanced" ]; then - usage_advanced - fi -fi - ##################################################################### # Source sage-env ($0 is the name of this "sage" script, so we can just @@ -444,6 +204,11 @@ if [ -z "$DOT_SAGE" ]; then export DOT_SAGE="$HOME/.sage" fi + +##################################################################### +# Helper functions +##################################################################### + # Prepare for running Sage, either interactively or non-interactively. sage_setup() { # Check that we're not in a source tarball which hasn't been built yet (#13561). @@ -490,6 +255,211 @@ interactive_sage() { exec sage-ipython "$@" -i } +##################################################################### +# sage --advanced +##################################################################### + +usage_advanced() { + sage_version -v + #### 1.......................26..................................................78 + #### |.....................--.|...................................................| + echo + echo "Running Sage, the most common options:" + echo + echo " file.[sage|py|spyx] -- run given .sage, .py or .spyx file" + echo " -h, -?, --help -- print a short help message" + echo " -v, --version -- print the Sage version" + echo " --advanced -- print this list of Sage options" + echo " -c cmd -- evaluate cmd as sage code. For example," + echo " \"sage -c 'print(factor(35))'\" will" + echo " print \"5 * 7\"." + echo + echo "Running Sage, other options:" + echo + echo " --dumpversion -- print brief Sage version" + echo " --preparse file.sage -- preparse \"file.sage\", and produce" + echo " the corresponding Python file" + echo " \"file.sage.py\"" + echo " -q -- quiet; start with no banner" + echo " --min -- do not populate global namespace" + echo " (must be first option)" + echo " --nodotsage -- run Sage without using the user's" + echo " .sage directory: create and use a temporary" + echo " .sage directory instead." + echo " --gthread, --qthread, --q4thread, --wthread, --pylab" + echo " -- pass the option through to IPython" + if [ -n "$SAGE_SRC" -a -d "$SAGE_SRC" ]; then + echo " --grep [options] " + echo " -- regular expression search through the Sage" + echo " library for \"string\". Any options will" + echo " get passed to the \"grep\" command." + echo " --grepdoc [options] " + echo " -- regular expression search through the" + echo " Sage documentation for \"string\"." + echo " --search_src ... -- same as --grep" + echo " --search_doc ... -- same as --grepdoc" + fi + echo + echo "Running external programs:" + echo + echo " --cython [...] -- run Cython with the given arguments" + echo " --ecl [...], --lisp [...] -- run Sage's copy of ECL (Embeddable" + echo " Common Lisp) with the given arguments" + echo " --gap [...] -- run Sage's Gap with the given arguments" + echo " --gap3 [...] -- run Sage's Gap3 with the given arguments" + command -v gap3 &>/dev/null || \ + echo " (not installed currently, run sage -i gap3)" + echo " --gdb -- run Sage under the control of gdb" + echo " --gdb-ipython -- run Sage's IPython under the control of gdb" + echo " --git [...] -- run Sage's Git with the given arguments" + echo " --gp [...] -- run Sage's PARI/GP calculator with the" + echo " given arguments" + echo " --ipython [...], --ipython3 [...]" + echo " -- run Sage's IPython using the default" + echo " environment (not Sage), passing additional" + echo " additional options to IPython" + echo " --jupyter [...] -- run Sage's Jupyter with given arguments" + echo " --kash [...] -- run Sage's Kash with the given arguments" + command -v kash &>/dev/null || \ + echo " (not installed currently, run sage -i kash)" + echo " --M2 [...] -- run Sage's Macaulay2 with the given arguments" + command -v M2 &>/dev/null || \ + echo " (not installed currently, run sage -i macaulay2)" + echo " --maxima [...] -- run Sage's Maxima with the given arguments" + echo " --mwrank [...] -- run Sage's mwrank with the given arguments" + echo " --pip [...] -- invoke pip, the Python package manager" + echo " --polymake [...] -- run Sage's Polymake with given arguments" + command -v polymake &>/dev/null || \ + echo " (not installed currently, run sage -i polymake)" + echo " --python [...], --python3 [...]" + echo " -- run the Python 3 interpreter" + echo " -R [...] -- run Sage's R with the given arguments" + echo " --scons [...] -- run Sage's scons" + echo " --singular [...] -- run Sage's singular with the given arguments" + echo " --sqlite3 [...] -- run Sage's sqlite3 with given arguments" + echo + echo "Running the notebook:" + echo + echo " -n [...], --notebook=[...]" + echo " -- start the notebook; valid options" + echo " include \"default\", \"jupyter\", \"export\"." + echo " Current default is \"jupyter\"." + echo " Run \"sage --notebook --help\" for more details." + echo + #### 1.......................26..................................................78 + #### |.....................--.|...................................................| + echo "Testing files:" + echo + echo " -t [options] -- test examples in .py, .pyx, .sage" + echo " or .tex files. Options:" + echo " --long -- include lines with the phrase 'long time'" + echo " --verbose -- print debugging output during the test" + echo " --all -- test all files" + echo " --optional -- also test all examples labeled \"# optional\"" + echo " --only-optional[=tags]" + echo " -- if no 'tags' are specified, only run" + echo " blocks of tests containing a line labeled" + echo " \"# optional\". If a comma-separated" + echo " list of tags is specified, only run block" + echo " containing a line labeled \"# optional tag\"" + echo " for any of the tags given, and in these blocks" + echo " only run the lines which are unlabeled or" + echo " labeled \"# optional\" or labeled" + echo " \"# optional tag\" for any of the tags given." + echo " --randorder[=seed] -- randomize order of tests" + echo " --new -- only test files modified since last commit" + echo " --initial -- only show the first failure per block" + echo " --debug -- drop into PDB after an unexpected error" + echo " --failed -- only test files that failed last test" + echo " --warn-long [timeout] -- warning if doctest is slow" + echo " --only-errors -- only output failures, not successes" + echo " --gc=GC -- control garbarge collection (ALWAYS:" + echo " collect garbage before every test; NEVER:" + echo " disable gc; DEFAULT: Python default)" + echo " --short[=secs] -- run as many doctests as possible in about 300" + echo " seconds (or the number of seconds given.) This runs" + echo " the tests for each module from the top of the file" + echo " and skips tests once it exceeds the budget" + echo " allocated for that file." + echo " --help -- show all testing options" + echo " --tnew [...] -- equivalent to -t --new" + echo " -tp [...] -- like -t above, but tests in parallel using" + echo " N threads, with 0 interpreted as min(8, cpu_count())" + echo " --testall [options] -- equivalent to -t --all" + echo + echo " --coverage -- give information about doctest coverage of files" + echo " --coverageall -- give summary info about doctest coverage of" + echo " all files in the Sage library" + echo " --startuptime [module] -- display how long each component of Sage takes to" + echo " start up; optionally specify a module to get more" + echo " details about that particular module" + echo + echo "Some developer utilities:" + echo + echo " --sh [...] -- run a shell with Sage environment variables" + echo " as they are set in the runtime of Sage" + echo " --cleaner -- run the Sage cleaner. This cleans up after Sage," + echo " removing temporary directories and spawned processes." + echo " (This gets run by Sage automatically, so it is usually" + echo " not necessary to run it separately.)" + #### 1.......................26..................................................78 + #### |.....................--.|...................................................| + echo "File conversion:" + echo + echo " --rst2ipynb [...] -- Generates Jupyter notebook (.ipynb) from standalone" + echo " reStructuredText source." + command -v rst2ipynb &>/dev/null || \ + echo " (not installed currently, run sage -i rst2ipynb)" + echo " --ipynb2rst [...] -- Generates a reStructuredText source file from" + echo " a Jupyter notebook (.ipynb)." + echo " --rst2txt [...] -- Generates Sage worksheet text file from standalone" + echo " reStructuredText source." + echo " --rst2sws [...] -- Generates Sage worksheet (.sws) from standalone" + echo " reStructuredText source." + echo " --sws2rst -- Generates a reStructuredText source file from" + echo " a Sage worksheet (.sws) document." + echo + #### 1.......................26..................................................78 + #### |.....................--.|...................................................| + echo "Valgrind memory debugging:" + echo + echo " --cachegrind -- run Sage using Valgrind's cachegrind tool. The log" + echo " files are named sage-cachegrind.PID can be found in" + echo " \$DOT_SAGE" + echo " --callgrind -- run Sage using Valgrind's callgrind tool. The log" + echo " files are named sage-callgrind.PID can be found in" + echo " \$DOT_SAGE" + echo " --massif -- run Sage using Valgrind's massif tool. The log" + echo " files are named sage-massif.PID can be found in" + echo " \$DOT_SAGE" + echo " --memcheck -- run Sage using Valgrind's memcheck tool. The log" + echo " files are named sage-memcheck.PID can be found in" + echo " \$DOT_SAGE" + echo " --omega -- run Sage using Valgrind's omega tool. The log" + echo " files are named sage-omega.PID can be found in" + echo " \$DOT_SAGE" + echo " --valgrind -- this is an alias for --memcheck" + if [ -n "$SAGE_ROOT/" ]; then + exec "$SAGE_ROOT/build/bin/sage-site" "--advanced" + fi + echo + exit 0 +} + +if [ $# -gt 0 ]; then + if [ "$1" = '-h' -o "$1" = '-?' -o "$1" = '-help' -o "$1" = '--help' ]; then + usage + fi + if [ "$1" = "-advanced" -o "$1" = "--advanced" ]; then + usage_advanced + fi +fi + + +##################################################################### +# Running Sage +##################################################################### + if [ "$1" = '-min' -o "$1" = '--min' ]; then shift export SAGE_IMPORTALL=no @@ -504,17 +474,76 @@ if [ $# -eq 0 ]; then interactive_sage fi +##################################################################### +# Other basic options +##################################################################### + +if [ "$1" = '-c' ]; then + shift + sage_setup + unset TERM # See Trac #12263 + exec sage-eval "$@" +fi + +if [ "$1" = '-preparse' -o "$1" = "--preparse" ]; then + shift + exec sage-preparse "$@" +fi + if [ "$1" = '-cleaner' -o "$1" = '--cleaner' ]; then exec sage-cleaner fi ##################################################################### -# Run Sage's versions of the standard Algebra/Geometry etc. software +# Run Sage's versions of Python, pip, IPython, Jupyter. +##################################################################### + +if [ "$1" = '-pip' -o "$1" = '--pip' ]; then + shift + exec sage-python -m pip "$@" +fi + +if [ "$1" = '--pip3' ]; then + shift + exec "$SAGE_LOCAL"/bin/python3 -m pip "$@" +fi + +if [ "$1" = '-python' -o "$1" = '--python' ]; then + shift + if [ "$SAGE_PYTHON3" = 'yes' ]; then + exec "$SAGE_LOCAL"/bin/python3 "$@" + else + exec "$SAGE_LOCAL"/bin/python2 "$@" + fi +fi + +if [ "$1" = '-python3' -o "$1" = '--python3' ]; then + shift + exec "$SAGE_LOCAL"/bin/python3 "$@" +fi + +if [ "$1" = '-ipython' -o "$1" = '--ipython' ]; then + shift + exec "$SAGE_LOCAL"/bin/ipython "$@" +fi + +if [ "$1" = '-ipython3' -o "$1" = '--ipython3' ]; then + shift + exec "$SAGE_LOCAL"/bin/ipython3 "$@" +fi + +if [ "$1" = '-jupyter' -o "$1" = '--jupyter' ]; then + shift + exec "$SAGE_LOCAL"/bin/jupyter "$@" +fi + +##################################################################### +# Run Sage's versions of its component packages ##################################################################### -if [ "$1" = '-axiom' -o "$1" = '--axiom' ]; then +if [ "$1" = "-cython" -o "$1" = '--cython' -o "$1" = '-pyrex' -o "$1" = "--pyrex" ]; then shift - exec axiom "$@" + exec sage-cython "$@" fi if [ "$1" = '-gap' -o "$1" = '--gap' ]; then @@ -547,16 +576,6 @@ if [ "$1" = '-sqlite3' -o "$1" = '--sqlite3' ]; then exec sqlite3 "$@" fi -if [ "$1" = '-sws2rst' -o "$1" = '--sws2rst' ]; then - shift - exec sage-sws2rst "$@" -fi - -if [ "$1" = '-twistd' -o "$1" = '--twistd' ]; then - shift - exec twistd "$@" -fi - if [ "$1" = '-ecl' -o "$1" = '--ecl' ]; then shift exec ecl "$@" @@ -572,11 +591,6 @@ if [ "$1" = '-kash' -o "$1" = '--kash' ]; then exec kash "$@" fi -if [ "$1" = '-fixdoctests' -o "$1" = '--fixdoctests' ]; then - shift - exec sage-fixdoctests "$@" -fi - if [ "$1" = '-maxima' -o "$1" = '--maxima' ]; then shift exec maxima "$@" @@ -597,69 +611,19 @@ if [ "$1" = '-scons' -o "$1" = '--scons' ]; then exec scons "$@" fi -if [ "$1" = '-pip' -o "$1" = '--pip' ]; then - shift - exec sage-python -m pip "$@" -fi - -if [ "$1" = '--pip3' ]; then - shift - exec "$SAGE_LOCAL"/bin/python3 -m pip "$@" -fi - -if [ "$1" = '-fix-pkg-checksums' -o "$1" = '--fix-pkg-checksums' ]; then - shift - exec sage-fix-pkg-checksums "$@" -fi - -if [ "$1" = '-python' -o "$1" = '--python' ]; then - shift - if [ "$SAGE_PYTHON3" = 'yes' ]; then - exec "$SAGE_LOCAL"/bin/python3 "$@" - else - exec "$SAGE_LOCAL"/bin/python2 "$@" - fi -fi - -if [ "$1" = '-python2' -o "$1" = '--python2' ]; then - shift - exec "$SAGE_LOCAL"/bin/python2 "$@" -fi - -if [ "$1" = '-python3' -o "$1" = '--python3' ]; then - shift - exec "$SAGE_LOCAL"/bin/python3 "$@" -fi - if [ "$1" = '-R' -o "$1" = '--R' ]; then shift exec R "$@" fi -if [ "$1" = '-ipython' -o "$1" = '--ipython' ]; then - shift - exec "$SAGE_LOCAL"/bin/ipython "$@" -fi - -if [ "$1" = '-ipython3' -o "$1" = '--ipython3' ]; then - shift - exec "$SAGE_LOCAL"/bin/ipython3 "$@" -fi - -if [ "$1" = '-jupyter' -o "$1" = '--jupyter' ]; then - shift - exec "$SAGE_LOCAL"/bin/jupyter "$@" -fi - if [ "$1" = '-git' -o "$1" = '--git' ]; then shift exec git "$@" fi -if [ "$1" = '-git-branch' -o "$1" = '--git-branch' ]; then - shift - exec git --git-dir="$SAGE_ROOT"/.git rev-parse --abbrev-ref HEAD -fi +##################################################################### +# sage --sh and sage --buildsh +##################################################################### if [ "$1" = '-sh' -o "$1" = '--sh' -o "$1" = '-buildsh' -o "$1" = '--buildsh' ]; then # AUTHORS: @@ -792,20 +756,6 @@ EOF exit $status fi -##################################################################### -# Test coverage of a module? -##################################################################### - -if [ "$1" = "-coverage" -o "$1" = "--coverage" ]; then - shift - exec sage-coverage "$@" -fi - -if [ "$1" = "-coverageall" -o "$1" = "--coverageall" ]; then - shift - exec sage-coverageall "$@" -fi - ##################################################################### # File conversion ##################################################################### @@ -833,10 +783,18 @@ if [ "$1" = '-rst2sws' -o "$1" = '--rst2sws' ]; then exec sage-rst2sws "$@" fi +if [ "$1" = '-sws2rst' -o "$1" = '--sws2rst' ]; then + shift + exec sage-sws2rst "$@" +fi + ##################################################################### -# Run Sage's versions of the standard Algebra/Geometry etc. software +# The notebook, grep, building Sage, testing Sage ##################################################################### +# build_sage, sage -b, sage -br, etc. could be moved to +# build/bin/sage-site. See #29111. + build_sage() { maybe_sage_location ( cd "$SAGE_SRC" && $MAKE ) || exit $? @@ -859,22 +817,20 @@ if [ "$1" = "-bn" -o "$1" = "--build-and-notebook" ]; then exec sage-notebook --notebook=default "$@" fi -if [ "$1" = "-inotebook" -o "$1" = '--inotebook' ]; then - shift - sage-cleaner &>/dev/null & - exec sage-notebook --notebook=sagenb secure=False "$@" -fi - -if [ "$1" = '-grep' -o "$1" = "--grep" -o "$1" = "-search_src" -o "$1" = "--search_src" ]; then - shift - sage-grep "$@" - exit 0 -fi +if [ -n "$SAGE_SRC" -a -d "$SAGE_SRC" ]; then + # Source inspection facilities, supported on sage-the-distribution and on distributions + # that package the Sage sources. + if [ "$1" = '-grep' -o "$1" = "--grep" -o "$1" = "-search_src" -o "$1" = "--search_src" ]; then + shift + sage-grep "$@" + exit 0 + fi -if [ "$1" = '-grepdoc' -o "$1" = "--grepdoc" -o "$1" = "-search_doc" -o "$1" = "--search_doc" ]; then - shift - sage-grepdoc "$@" - exit 0 + if [ "$1" = '-grepdoc' -o "$1" = "--grepdoc" -o "$1" = "-search_doc" -o "$1" = "--search_doc" ]; then + shift + sage-grepdoc "$@" + exit 0 + fi fi if [ "$1" = '-b' ]; then @@ -930,13 +886,31 @@ if [ "$1" = '-testall' -o "$1" = "--testall" ]; then exec sage-runtests -a "$@" fi -if [ "$1" = '-c' ]; then +if [ "$1" = '-fixdoctests' -o "$1" = '--fixdoctests' ]; then shift - sage_setup - unset TERM # See Trac #12263 - exec sage-eval "$@" + exec sage-fixdoctests "$@" +fi + +if [ "$1" = "-coverage" -o "$1" = "--coverage" ]; then + shift + exec sage-coverage "$@" +fi + +if [ "$1" = "-coverageall" -o "$1" = "--coverageall" ]; then + shift + exec sage-coverageall "$@" fi +if [ "$1" = '-startuptime' -o "$1" = '--startuptime' ]; then + exec sage-startuptime.py "$@" +fi + +##################################################################### +# Creating and handling Sage distributions +##################################################################### + +# The following could be moved to build/bin/sage-site. See #29111. + if [ "$1" = '--location' ]; then maybe_sage_location exit 0 @@ -1026,22 +1000,9 @@ if [ "$1" = '-sdist' -o "$1" = "--sdist" ]; then exec sage-sdist "$@" fi -if [ "$1" = '-rsyncdist' -o "$1" = "--rsyncdist" ]; then - if [ $# -ne 2 ]; then - echo >&2 "** MISSING VERSION NUMBER! **" - exit 2 - fi - maybe_sage_location - exec sage-rsyncdist $2 -fi - -if [ "$1" = "-docbuild" -o "$1" = "--docbuild" ]; then - # Redirect stdin from /dev/null. This helps with running TeX which - # tends to ask interactive questions if something goes wrong. These - # cause the build to hang. If stdin is /dev/null, TeX just aborts. - shift - exec sage-python -m sage_setup.docbuild "$@" &2 -echo "do:" >&2 -echo " $ sage-list-packages experimental" >&2 -exec sage-list-packages experimental diff --git a/src/bin/sage-list-optional b/src/bin/sage-list-optional deleted file mode 100755 index 3fd911e4ea6..00000000000 --- a/src/bin/sage-list-optional +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -echo "DEPRECATION WARNING: this script is deprecated" >&2 -echo "do:" >&2 -echo " $ sage-list-packages optional" >&2 -exec sage-list-packages optional diff --git a/src/bin/sage-list-standard b/src/bin/sage-list-standard deleted file mode 100755 index a8bbd66af46..00000000000 --- a/src/bin/sage-list-standard +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -echo "DEPRECATION WARNING: this script is deprecated" >&2 -echo "do:" >&2 -echo " $ sage-list-packages standard" >&2 -sage-list-packages standard diff --git a/src/bin/sage-rsyncdist b/src/bin/sage-rsyncdist deleted file mode 100755 index ed39a90ccb0..00000000000 --- a/src/bin/sage-rsyncdist +++ /dev/null @@ -1,125 +0,0 @@ -#!/usr/bin/env bash -# -# NOTE: This script is of little use after the git transition and -# will be deleted eventually. -# -# Create an rsyncable source distribution of Sage in dist/sage-rsync.tar.gz -# starting from a regular sdist tarball. -# -# This is mostly useful for regular automatic testing of Sage. -# -# All spkgs in spkg/standard are stored extracted: instead of a file -# spkg/standard/atlas-3.8.4.spkg, there is a directory -# spkg/standard/atlas/ (note the directory has no version number). -# In the tarball, there is no top-level directory like "sage-5.0", -# files like "Makefile" are stored directly at the top level. -# -# Running this script requires: -# * GNU tar -# * gzip with --rsyncable patch -# -# However, there are no special requirements for *building* from an -# rsyncable distribution. -# -# -# To build from an rsyncable tarball, do the following: -# mkdir sage-VERSION -# cd sage-VERSION -# tar xzf /path/to/sage-rsync.tar.gz -# ./rsyncpack.sh # to repack the directories into spkgs -# make # as usual -# -# -# AUTHOR: Jeroen Demeyer (2011-12-10): Trac ticket #12106 -# -#***************************************************************************** -# Copyright (C) 2011 Jeroen Demeyer -# -# 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/ -#***************************************************************************** - - -# Exit on error -set -e - - -# Check whether gzip supports --rsyncable, otherwise bail out immediately -if ! gzip --rsyncable /dev/null 2>/dev/null; then - echo >&2 "It seems your version of gzip does not support the --rsyncable option." - echo >&2 "In order to run sage --rsyncdist, you need a patched gzip." - echo >&2 "For more information about the patch, see" - echo >&2 "http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=118118" - exit 1 -fi - - -# If $1 starts with "sage-", remove this prefix -SAGE_VERSION=`echo "$1" | sed 's/^sage-//'` -if [ -z "$SAGE_VERSION" ]; then - echo >&2 "Usage: $0 " - echo >&2 "Create an rsyncable source distribution of Sage" - exit 2 -fi - -# Run this script from SAGE_ROOT -[ -z "$SAGE_ROOT" ] || cd "$SAGE_ROOT" - -if [ ! -r "dist/sage-$SAGE_VERSION.tar" ]; then - echo >&2 "The sdist tarball dist/sage-$SAGE_VERSION.tar has not been created yet." - echo >&2 "You should call this script after running ./sage --sdist - exit 1 -fi - -# Extract existing sdist tarball -mkdir -p "dist/sage-rsync" -cd "dist/sage-rsync" -echo "Extracting sdist tarball sage-$SAGE_VERSION.tar" -tar -x --strip-components 1 -f "../sage-$SAGE_VERSION.tar" - -# Create a shell script to repack the spkgs. The repacked spkgs will -# not be compressed, but that's not a problem. It just means one -# should not make an sdist from an rsyncable Sage distribution. -exec 5>rsyncpack.sh -chmod 755 rsyncpack.sh -cat >&5 <&2 "Cannot determine base package name for $spkg" - exit 1 - fi - - echo "Extracting $spkg to directory $spkgname" - ( bzip2 -cd $spkg || gzip -cd $spkg || cat $spkg ) 2>/dev/null |\ - tar -x --delay-directory-restore - rm $spkg - mv "$spkgnamever" "$spkgname" - - echo "mv '$spkgname' '$spkgnamever' && tar c '$spkgnamever' >'$spkg' && rm -rf '$spkgnamever'" >&5 -done -exec 5<&- -cd ../.. - -# Put files in the tar file in *alphabetical* order, which is much -# better for rsync. Print directories with trailing slash for -# better sorting and skip '.' -echo "Packing tarball sage-rsync.tar.gz" -find . '!' -name . '(' -type d -printf '%P/\n' -or -printf '%P\n' ')' |\ -sort |\ -tar -c --no-recursion -T /dev/stdin |\ -gzip --best --rsyncable >../sage-rsync.tar.gz diff --git a/src/doc/.gitignore b/src/doc/.gitignore index 5039f33ca6a..a52195617d8 100644 --- a/src/doc/.gitignore +++ b/src/doc/.gitignore @@ -5,3 +5,4 @@ /en/reference/spkg/*.rst /output /en/installation/*.txt +/en/reference/repl/*.txt diff --git a/src/doc/bootstrap b/src/doc/bootstrap index f25a7a8d5f6..fbeb0b90a99 100755 --- a/src/doc/bootstrap +++ b/src/doc/bootstrap @@ -77,3 +77,8 @@ done cat >> "$OUTPUT_INDEX" <&2 $0:$LINENO: installing "$OUTPUT" +./sage -advanced > "$OUTPUT" diff --git a/src/doc/en/reference/repl/options.rst b/src/doc/en/reference/repl/options.rst index 3bc37ca1961..715a6816608 100644 --- a/src/doc/en/reference/repl/options.rst +++ b/src/doc/en/reference/repl/options.rst @@ -9,219 +9,4 @@ Installation Guide for information about making sure your Command-line options for Sage ----------------------------- -.. rubric:: Running Sage, the most common options - -- ``file.[sage|py|spyx]`` -- run the given .sage, .py or .spyx - files (as in ``sage my_file.sage``) -- ``-h``, ``-?``, ``--help`` -- print a short help message -- ``-v``, ``--version`` -- print the Sage version -- ``--advanced`` -- print (essentially this) list of Sage options -- ``-c cmd`` -- evaluate ``cmd`` as sage code. For example, ``sage - -c 'print(factor(35))'`` will print "5 * 7". - -.. rubric:: Running Sage, other options - -- ``--preparse file.sage`` -- preparse ``file.sage``, a file of - Sage code, and produce the corresponding Python file - ``file.sage.py``. See the Sage tutorial for more about preparsing - and the differences between Sage and Python. -- ``-q`` -- quiet; start with no banner -- ``--grep [options] `` -- grep through all the Sage library - code for ``string``. Any options will get passed to the "grep" - command; for example, ``sage --grep -i epstein`` will search for - ``epstein``, and the ``-i`` flag tells grep to ignore case when - searching. Note that while running Sage, you can also use the - function :func:`search_src ` to - accomplish the same thing. -- ``--grepdoc [options] `` -- grep through all the Sage - documentation for ``string``. Note that while running Sage, you can - also use the function :func:`search_doc - ` to accomplish the same thing. -- ``--min [...]`` -- do not populate global namespace (must be first - option) -- ``-gthread``, ``-qthread``, ``-q4thread``, ``-wthread``, - ``-pylab`` -- pass the option through to IPython -- ``--nodotsage`` -- run Sage without using the user's - :file:`.sage` directory: create and use a temporary :file:`.sage` - directory instead. Warning: notebooks are stored in the - :file:`.sage` directory, so any notebooks created while running with - ``--nodotsage`` will be temporary also. - -.. rubric:: Running the notebook - -- ``-n [...]``, ``--notebook=[...]`` -- start the notebook, valid options - are ``default``, ``sagenb``, ``jupyter`` and ``export`` (see the - output of ``sage --notebook --help`` for more details and examples of - how to pass optional arguments) -- ``-bn [...]``, ``--build-and-notebook [...]`` -- build the Sage - library (as by running ``sage -b``) then start the Sage notebook -- ``--inotebook [...]`` -- start the *insecure* Sage notebook - -.. rubric:: Running external programs and utilities - -- ``--cython [...]`` -- run Cython with the given arguments -- ``--ecl [...]``, ``--lisp [...]`` -- run Sage's copy of ECL - (Embeddable Common Lisp) with the given arguments -- ``--gap [...]`` -- run Sage's Gap with the given arguments -- ``--git [...]`` -- run Sage's Git with the given arguments -- ``--gp [...]`` -- run Sage's PARI/GP calculator with the given arguments -- ``--ipython [...]`` -- run Sage's IPython using the default - environment (not Sage), passing additional options to IPython -- ``--kash [...]`` -- run Sage's Kash with the given arguments -- ``--M2 [...]`` -- run Sage's Macaulay2 with the given arguments -- ``--maxima [...]`` -- run Sage's Maxima with the given arguments -- ``--mwrank [...]`` -- run Sage's mwrank with the given arguments -- ``--python [...]``, ``--python2 [...]`` -- run the Python 2 interpreter -- ``--python3 [...]`` -- run the Python 3 interpreter -- ``-R [...]`` -- run Sage's R with the given arguments -- ``--scons [...]`` -- run Sage's scons -- ``--singular [...]`` -- run Sage's singular with the given arguments -- ``--twistd [...]`` -- run Twisted server -- ``--sh [...]`` -- run a shell with Sage environment variables - as they are set in the runtime of Sage -- ``--buildsh [...]`` -- run a shell with Sage environment variables - as they are set while building Sage and its packages -- ``--gdb`` -- run Sage under the control of gdb -- ``--gdb-ipython`` -- run Sage's IPython under the control of gdb -- ``--cleaner`` -- run the Sage cleaner. This cleans up after Sage, - removing temporary directories and spawned processes. (This gets - run by Sage automatically, so it is usually not necessary to run - it separately.) - -.. rubric:: Installing packages and upgrading - -- ``-i [options] [packages]`` -- install the given Sage packages (unless - they are already installed); if no packages are given, print - a list of all installed packages. Options: - - - ``-c`` -- run the packages' test suites, overriding the settings of - :envvar:`SAGE_CHECK` and :envvar:`SAGE_CHECK_PACKAGES`. - - ``-f`` -- force build: install the packages even if they are - already installed. - - ``-s`` -- do not delete the ``spkg/build`` directories after a - successful build -- useful for debugging. - -- ``-f [options] [packages]`` -- shortcut for ``-i -f``: force build of - the given Sage packages. -- ``--info [packages]`` -- display the ``SPKG.txt`` or ``SPKG.rst`` file of - the given Sage packages, and some additional information. -- ``--standard`` -- list all standard packages that can be installed -- ``--optional`` -- list all optional packages that can be installed -- ``--experimental`` -- list all experimental packages that can be installed -- ``--upgrade [url]`` -- download, build and install standard - packages from given url. If url not given, automatically selects - a suitable mirror. If url='ask', it lets you select the mirror. - -.. rubric:: Building and testing the Sage library - -- ``--root`` -- print the Sage root directory -- ``-b`` -- build Sage library -- do this if you have modified - any source code files in :file:`$SAGE_ROOT/src/sage/`. -- ``-ba`` -- same as ``-b``, but rebuild *all* Cython - code. This could take a while, so you will be asked if you want - to proceed. -- ``-ba-force`` -- same as ``-ba``, but don't query before rebuilding -- ``--br`` -- build and run Sage -- ``-t [options] `` -- test examples in .py, .pyx, .sage - or .tex files. Options: - - - ``--long`` -- include lines with the phrase 'long time' - - ``--verbose`` -- print debugging output during the test - - ``--optional`` -- also test all examples labeled ``# optional`` - - ``--only-optional[=tags]`` -- if no ``tags`` are specified, only - run blocks of tests containing a line labeled ``# optional``. If - a comma separated list of tags is specified, only run blocks containing - a line labeled ``# optional tag`` for any of the tags given and in these blocks only - run the lines which are unlabeled or labeled ``#optional`` or labeled - ``#optional tag`` for any of the tags given. - - ``--randorder[=seed]`` -- randomize order of tests - - ``--short[=seconds]`` -- run as many doctests as possible in about 300 - seconds (or the number of seconds given.) This runs the tests for each - module from the top of the file and skips tests once it exceeds the budget - allocated for that file. - -- ``-tnew [...]`` -- like ``-t`` above, but only tests files - modified since last commit -- ``-tp [...]`` -- like ``-t`` above, but tests in parallel - using ``N`` threads with 0 interpreted as ``minimum(8, cpu_count())`` -- ``--testall [options]`` -- test all source files, docs, and - examples; options are the same as for ``-t``. -- ``-bt [...]`` -- build and test, options like ``-t`` above -- ``-btp [...]`` -- build and test in parallel, options like - ``-tp`` above -- ``-btnew [...]`` -- build and test modified files, options like ``-tnew`` -- ``--fixdoctests file.py [output_file] [--long]`` -- writes a new - version of ``file.py`` to ``output_file`` (default: ``file.py.out``) - that will pass the doctests. With the optional ``--long`` argument - the long time tests are also checked. A patch for the new file is - printed to stdout. -- ``--startuptime [module]`` -- display how long each component of Sage takes - to start up. Optionally specify a module (e.g., "sage.rings.qqbar") to get - more details about that particular module. -- ``--coverage `` -- give information about doctest coverage - of files -- ``--coverageall`` -- give summary info about doctest coverage of - all files in the Sage library - -.. rubric:: Documentation - -- ``--docbuild [options] document (format | command)`` -- build or - return information about the Sage documentation. - - - ``document`` -- name of the document to build - - ``format`` -- document output format - - ``command`` -- document-specific command - - A ``document`` and either a ``format`` or a ``command`` are required, unless a - list of one or more of these is requested. - - Options: - - - ``help``, ``-h``, ``--help`` -- print a help message - - ``-H``, ``--help-all`` -- print an extended help message, - including the output from the options ``-h``, ``-D``, ``-F``, - ``-C all``, and a short list of examples. - - ``-D``, ``--documents`` -- list all available documents - - ``-F``, ``--formats`` -- list all output formats - - ``-C DOC``, ``--commands=DOC`` -- list all commands for document - ``DOC``; use ``-C all`` to list all - - ``-i``, ``--inherited`` -- include inherited members in - reference manual; may be slow, may fail for PDF output - - ``-u``, ``--underscore`` -- include variables prefixed with - ``_`` in reference manual; may be slow, may fail for PDF output - - ``-j``, ``--jsmath`` -- render math using jsMath; formats: - ``html``, ``json``, ``pickle``, ``web`` - - ``--no-pdf-links`` -- do not include PDF links in document - ``website``; formats: ``html``, ``json``, ``pickle``, ``web`` - - ``--check-nested`` -- check picklability of nested classes in - document ``reference`` - - ``-N``, ``--no-colors`` -- do not color output; does not affect - children - - ``-q``, ``--quiet`` -- work quietly; same as ``--verbose=0`` - - ``-v LEVEL``, ``--verbose=LEVEL`` -- report progress at level 0 - (quiet), 1 (normal), 2 (info), or 3 (debug); does not affect - children - - Advanced -- use these options with care: - - - ``-S OPTS``, ``--sphinx-opts=OPTS`` -- pass comma-separated ``OPTS`` - to sphinx-build - - ``-U``, ``--update-mtimes`` -- before building reference manual, - update modification times for auto-generated ReST files - -.. rubric:: Making Sage packages or distributions - -- ``--pkg dir`` -- create the Sage package ``dir.spkg`` from the - directory ``dir`` -- ``--pkg_nc dir`` -- as ``--pkg``, but do not compress the package -- ``--merge`` -- run Sage's automatic merge and test script -- ``--sdist`` -- build a source distribution of Sage - -.. rubric:: Valgrind memory debugging - -- ``--cachegrind`` -- run Sage using Valgrind's cachegrind tool -- ``--callgrind`` -- run Sage using Valgrind's callgrind tool -- ``--massif`` -- run Sage using Valgrind's massif tool -- ``--memcheck`` -- run Sage using Valgrind's memcheck tool -- ``--omega`` -- run Sage using Valgrind's omega tool -- ``--valgrind`` -- this is an alias for ``--memcheck`` +.. literalinclude:: options.txt diff --git a/src/sage/tests/cmdline.py b/src/sage/tests/cmdline.py index ac34a17edc5..310e55d2ff2 100644 --- a/src/sage/tests/cmdline.py +++ b/src/sage/tests/cmdline.py @@ -184,12 +184,16 @@ def test_executable(args, input="", timeout=100.0, pydebug_ignore_warnings=False 0 sage: (out, err, ret) = test_executable(["sage", "--advanced"]) - sage: out.find("search through the Sage documentation") >= 0 + sage: out.find("run the Sage cleaner.") >= 0 True sage: err '' sage: ret 0 + sage: out.find("print the Sage root directory") >= 0 # optional - build + True + sage: out.find("regular expression search through the Sage") >= 0 # optional - build + True Basic information about the Sage installation:: diff --git a/src/setup.py b/src/setup.py index f3399fd4c63..962cc4b5ab1 100755 --- a/src/setup.py +++ b/src/setup.py @@ -118,6 +118,63 @@ 'ext_data/valgrind/*', 'ext_data/threejs/*'] }, + scripts = [## The sage script + 'bin/sage', + ## Other scripts that should be in the path also for OS packaging of sage: + 'bin/sage-eval', + 'bin/sage-runtests', # because it is useful for doctesting user scripts too + 'bin/sage-fixdoctests', # likewise + 'bin/sage-coverage', # because it is useful for coverage-testing user scripts too + 'bin/sage-coverageall', # likewise + 'bin/sage-cython', # deprecated, might be used in user package install scripts + ## Helper scripts invoked by sage script + ## (they would actually belong to something like libexec) + 'bin/sage-cachegrind', + 'bin/sage-callgrind', + 'bin/sage-massif', + 'bin/sage-omega', + 'bin/sage-valgrind', + 'bin/sage-version.sh', + 'bin/sage-cleaner', + ## Only makes sense in sage-the-distribution. TODO: Move to another installation script. + 'bin/sage-list-packages', + 'bin/sage-clone-source', + 'bin/sage-download-upstream', + 'bin/sage-sdist', + 'bin/sage-location', + ## Uncategorized scripts in alphabetical order + 'bin/math-readline', + 'bin/sage-env', + 'bin/sage-env-config', + # sage-env-config.in -- not to be installed', + 'bin/sage-gdb-commands', + 'bin/sage-grep', + 'bin/sage-grepdoc', + 'bin/sage-inline-fortran', + 'bin/sage-ipynb2rst', + 'bin/sage-ipython', + 'bin/sage-maxima.lisp', + 'bin/sage-native-execute', + 'bin/sage-notebook', + 'bin/sage-num-threads.py', + 'bin/sage-open', + 'bin/sage-preparse', + 'bin/sage-pypkg-location', + 'bin/sage-python', + 'bin/sage-rebase.bat', + 'bin/sage-rebase.sh', + 'bin/sage-rebaseall.bat', + 'bin/sage-rebaseall.sh', + 'bin/sage-rst2sws', + 'bin/sage-rst2txt', + 'bin/sage-run', + 'bin/sage-run-cython', + 'bin/sage-startuptime.py', + 'bin/sage-sws2rst', + 'bin/sage-update-src', + 'bin/sage-update-version', + 'bin/sage-upgrade', + ], cmdclass = dict(build=sage_build, build_cython=sage_build_cython, build_ext=sage_build_ext,