Ticket #11073: 11073_scripts.patch
| File 11073_scripts.patch, 8.9 KB (added by jdemeyer, 16 months ago) |
|---|
-
sage-bdist
# HG changeset patch # User Volker Braun <vbraun@stp.dias.ie> # Date 1306783826 14400 # Node ID bd2472ebcfa92d7e5ae64d312038e029b541b741 # Parent 969ab8fb7a8c76e950ce80898e5ebdc78adef342 Fix and simplify sage-sdist, move various scripts to spkg/bin diff --git a/sage-bdist b/sage-bdist
a b 2 2 3 3 ######################################################## 4 4 # Build Sage *binary* distribution 5 # This script should be called by the s age-sage script5 # This script should be called by the spkg/bin/sage script 6 6 # 7 7 # Released under the GNU GPL-v2+ -- (c) William Stein 8 8 ######################################################## … … 70 70 cd sage 71 71 # Delete cython hash, so that "sage -br" works the first time. 72 72 rm -f .cython_hash 73 cd "$TMP"/local/lib/python/site-packages 73 cd "$TMP"/local/lib/python/site-packages && \ 74 74 rm -rf sage 75 75 ln -sf ../../../../devel/sage/build/sage . 76 76 fi -
sage-make_devel_packages
diff --git a/sage-make_devel_packages b/sage-make_devel_packages
a b 1 1 #!/usr/bin/env bash 2 2 3 3 ######################################################## 4 # Rebuild S AGEpackages related to development, e.g.,5 # sage_scripts, sage, doc, extcode6 # This script should be called by the SAGEscript4 # Rebuild Sage packages related to development, e.g., 5 # sage_scripts, sage, sage_root, extcode 6 # This script should be called by the sage-sdist script 7 7 ######################################################## 8 8 9 9 if [ $# -ne 2 -a $# -ne 3 ]; then … … 20 20 21 21 # REMOVE OLD PACKAGES 22 22 cd "$SAGE_ROOT"/spkg/standard/ 23 rm doc-*.spkg24 rm examples-*.spkg25 23 rm extcode-*.spkg 26 24 rm sage-*.spkg 27 25 rm sage_scripts-*.spkg … … 49 47 hg tag "$SAGE_VERSION" 50 48 hg commit -m "$SAGE_VERSION" 51 49 #./sage-push 52 chmod +x spkg-dist53 50 ./spkg-dist "$SAGE_VERSION" "$SAGE_ROOT" 54 51 if [ $? -ne 0 ]; then 55 52 echo "Error building the Sage source code package" … … 73 70 hg commit -m "$SAGE_VERSION" 74 71 75 72 #./sage-push 76 chmod +x spkg-dist77 73 ./spkg-dist "$SAGE_VERSION" "$SAGE_ROOT" 78 74 if [ $? -ne 0 ]; then 79 75 echo "Error building the extcode package" … … 110 106 111 107 rm -rf "$SCRIPTS" 112 108 mkdir "$SCRIPTS" 113 chmod +x sage-*114 chmod -x sage-README-osx.txt sage-banner sage-env sage-gdb-commands115 chmod -x sage-maxima.lisp sage-verify-pyc116 109 rm sage-*~ 117 110 118 111 cp -pr sage-* .hg* ipy_profile_sage.py "$SCRIPTS"/ … … 148 141 hg clone --pull "$SAGE_ROOT" . 149 142 150 143 if [ $? -ne 0 ]; then 151 echo "Error copying Sage root repository."144 echo >&2 "Error cloning Sage root repository." 152 145 exit 1 153 146 fi 154 147 148 # Copy spkg-install 149 cp -p "$SAGE_ROOT"/spkg/root-spkg-install spkg-install 150 chmod +x spkg-install 151 155 152 rm .hg/hgrc 156 cd "$SAGE_ROOT"157 158 cp -p "$SAGE_ROOT"/spkg/root-spkg-install "$ROOT_REPO"/spkg-install159 chmod +x "$ROOT_REPO"/spkg-install160 153 161 154 echo "Done copying root repository." 162 155 156 cd "$SAGE_ROOT" 163 157 tar -jcf "$ROOT_REPO".spkg "$ROOT_REPO" 164 158 mv "$ROOT_REPO".spkg "$DESTINATION"/ 165 159 rm -rf "$ROOT_REPO" -
sage-preparse
diff --git a/sage-preparse b/sage-preparse
a b 11 11 12 12 import os, sys, re 13 13 14 # The s age-sage script that calls sage-preparse passes the current14 # The spkg/bin/sage script that calls sage-preparse passes the current 15 15 # directory in as the first argument. 16 16 os.chdir(sys.argv[1]) 17 17 -
new file sage-sage
diff --git a/sage-sage b/sage-sage new file mode 100755
- + 1 #!/usr/bin/env bash 2 3 # This script exists to handle the following situation: 4 # - In the past, a sysadmin created a script /usr/local/bin/sage 5 # by copying /usr/local/sage-4.8/sage (say) and changing the 6 # SAGE_ROOT line. 7 # - That sysadmin just installed sage-5.x (possibly by upgrading) and 8 # he edited the SAGE_ROOT line in /usr/local/bin/sage, like he is 9 # used to doing. 10 # - The old /usr/local/bin/sage script will try to execute 11 # $SAGE_ROOT/local/bin/sage-sage 12 # which is *this* script. 13 # - Since sage-sage isn't used anymore in sage-5.x, we print a warning 14 # with a nice explanation and run spkg/bin/sage instead 15 # 16 # AUTHOR: Jeroen Demeyer (Trac #11073) 17 # 18 19 # Where is sage installed? 20 whichsage=`which sage 2>/dev/null` 21 22 if [ -n "$whichsage" ]; then 23 guesssage="(this is probably '$whichsage')" 24 else 25 guesssage="(this could be '/usr/local/bin/sage' for example)" 26 fi 27 28 29 # If this doesn't exist, probably our user ran Sage with an explicit 30 # path or is using a shell alias. 31 32 33 # Print a nice warning 34 cat >&2 <<EOF 35 Warning: you are using an old "sage" script to run Sage. This old 36 script calls sage-sage which is deprecated since sage-5.0. 37 The best solution is to delete this old "sage" script 38 $guesssage 39 and replace it with a symbolic link to "$SAGE_ROOT/sage". 40 You might need sysadmin privileges for this. 41 42 For more information, consult the Sage Installation Guide: 43 $SAGE_ROOT/devel/sage/doc/output/html/en/installation/source.html#installation-in-a-multiuser-environment 44 or online at: 45 http://sagemath.org/doc/installation/source.html#installation-in-a-multiuser-environment 46 47 For now, Sage will continue to work with the current setup, but this 48 might change in future versions. 49 ********************************************************************** 50 EOF 51 52 # The $SAGE_ROOT/sage scripts of all Sage versions since at least 53 # sage-4.5 change directory to "$SAGE_ROOT" before running sage-sage. 54 # So, it is safe to assume that the current directory is "$SAGE_ROOT". 55 exec spkg/bin/sage "$@" -
sage-sdist
diff --git a/sage-sdist b/sage-sdist
a b 2 2 3 3 ######################################################## 4 4 # Build Sage source distribution 5 # This script should be called by the s age-sage script5 # This script should be called by the spkg/bin/sage script 6 6 ######################################################## 7 7 8 PKGDIR=spkg9 10 8 if [ $# -ne 2 ]; then 11 9 echo "Usage: $0 <SAGE_VERSION> <SAGE_ROOT>" 12 10 exit 1 … … 64 62 65 63 cd "$CUR" 66 64 67 cp "$SAGE_ROOT"/local/bin/sage-spkg "$PKGDIR"/base/ 68 cp "$SAGE_ROOT"/local/bin/sage-env "$PKGDIR"/base/ 69 cp "$SAGE_ROOT"/local/bin/sage-make_relative "$PKGDIR"/base/ 70 71 TMP="/tmp/$TARGET" 72 73 rm -rf "$TMP" 74 mkdir "$TMP" 75 76 # copy sage root repo over. Cloning needs to be done in an empty 77 # directory, so we do this now. The other sage repositories are dealt 78 # with later. 65 # Copy sage root directory. Cloning needs to be done in an empty 66 # directory, so we do this now. Creating the sage_root spkg is done 67 # in sage-make_devel_packagess below. 79 68 cd "$SAGE_ROOT" 80 69 81 70 hg diff … … 83 72 hg tag "$SAGE_VERSION" 84 73 hg commit -m "$SAGE_VERSION" 85 74 86 echo "Copying root repository..." 87 hg clone --pull . "$TMP" 88 89 if [ $? -ne 0 ]; then 90 echo "Error copying Sage root repository." 91 exit 1 92 fi 93 94 rm "$TMP"/.hg/hgrc 95 echo "Done copying root repository." 96 97 STD=standard 98 # Put VERSION.txt in a directory available for download during the 99 # update process. (See sage-update.) 100 cp -p VERSION.txt $TMP/$PKGDIR/$STD/ 101 cp -pr "$PKGDIR"/base "$TMP/$PKGDIR/" 102 103 "$SAGE_ROOT"/local/bin/sage-make_devel_packages "$SAGE_VERSION" "$SAGE_ROOT" "$TMP"/devel 75 # Create new sage_root, sage_scripts,... packages 76 ./local/bin/sage-make_devel_packages "$SAGE_VERSION" "$SAGE_ROOT" 104 77 105 78 if [ $? -ne 0 ]; then 106 79 echo "Error building the Sage packages." 107 80 exit 1 108 81 fi 109 82 110 cp "$TMP"/devel/*.spkg "$SAGE_ROOT/$PKGDIR/$STD/" 83 # Create new sage source distribution in $TMP 84 TMP="/tmp/$TARGET" 111 85 112 cp -p "$PKGDIR/$STD"/*.spkg "$TMP/$PKGDIR/$STD/"86 ROOT_REPO="sage_root-$SAGE_VERSION" 113 87 114 cd "$TMP/$PKGDIR/$STD" 115 rm -rf doc-* sage-* extcode-* sage_scripts-* examples-* 116 mv "$TMP"/devel/*.spkg . 117 rmdir "$TMP"/devel 88 # Extract the SAGE_ROOT repository to /tmp/$ROOT_REPO, then rename to 89 # $TMP. This will become the root directory of the source tarball. 90 cd /tmp 91 rm -rf "$ROOT_REPO" "$TMP" 92 tar xjf "$SAGE_ROOT/spkg/standard/${ROOT_REPO}.spkg" 93 mv "$ROOT_REPO" "$TMP" 94 cd "$TMP" 118 95 119 cd /tmp 96 # Remove spkg-install which is only needed in the spkg 97 rm spkg-install 98 99 # Copy all base and standard packages 100 cp -p "$SAGE_ROOT"/spkg/base/*.tar* spkg/base 101 cp -p "$SAGE_ROOT"/spkg/standard/*.spkg spkg/standard 102 103 # Put VERSION.txt in the new tarball root and also in spkg/standard, 104 # a directory available for download during the update process. 105 # (See sage-update) 106 cp -p "$SAGE_ROOT/VERSION.txt" . 107 cp -p "$SAGE_ROOT/VERSION.txt" spkg/standard 108 109 110 # Package the sdist repository 111 cd "$TMP/.." 120 112 tar cf "$TARGET".tar "$TARGET" 121 113 122 114 mkdir -p "$SAGE_ROOT"/dist -
sage-update
diff --git a/sage-update b/sage-update
a b 418 418 if __name__ == '__main__': 419 419 # Make sure the SAGE_ROOT variable is set. This should always be 420 420 # set because sage-update is only supposed to be called by 421 # sage-upgrade, which is called only by sage-sage, after sage-env. 421 # sage-upgrade, which is called only by spkg/bin/sage, after 422 # sourcing sage-env. 422 423 if 'SAGE_ROOT' not in os.environ: 423 424 raise RuntimeError("The environment variable SAGE_ROOT must be set.") 424 425 SAGE_ROOT = os.environ["SAGE_ROOT"]
