# HG changeset patch
# User Jeroen Demeyer <jdemeyer@cage.ugent.be>
# Date 1293184347 -3600
# Node ID b31b4590d0ea7a8cc62a5dc3d0ffadf61ceabd61
# Parent 411902fed464a338ef5ea04293d9c7c3dd39f21a
#10494 reviewer patch, various minor changes
diff -r 411902fed464 -r b31b4590d0ea sdist
a
|
b
|
|
1 | 1 | #!/usr/bin/env bash |
2 | 2 | |
3 | | # Just curious: *Which* 'sage' is supposed to be called here? |
4 | | # Should we check if SAGE_LOCAL or SAGE_ROOT is defined? |
5 | | # ... and perhaps call $SAGE_ROOT/sage or $SAGE_LOCAL/bin/...? -leif |
6 | | |
7 | | # At least check that 'sage' is in the path to specifically catch |
8 | | # one potential error [earlier, with an appropriate error message]: |
9 | | if ! command -v sage >/dev/null; then |
| 3 | # Check whether "sage" can be run (i.e. whether it's in the PATH) |
| 4 | if ! sage -v >/dev/null; then |
10 | 5 | echo >&2 "Error: $0 requires 'sage' to be in your PATH" |
11 | 6 | echo >&2 "Maybe first call 'SAGE_ROOT/sage -sh'" |
12 | 7 | exit 1 |
13 | 8 | fi |
14 | 9 | |
15 | 10 | echo "Trying to commit changes (if any)..." |
16 | | sage -hg ci |
| 11 | sage -hg commit |
17 | 12 | status=$? |
18 | 13 | if [ $status -eq 1 ]; then |
19 | | # 'hg ci' returns 1 (!) if there are no changes to commit... |
| 14 | # 'hg commit' returns 1 if there are no changes to commit... |
20 | 15 | echo "No changes to commit (not an error)" |
21 | 16 | elif [ $status -ne 0 ]; then |
22 | 17 | echo >&2 "Error: $0: Couldn't commit changes" \ |
23 | | "('hg ci' failed with exit code $status)" |
| 18 | "('hg commit' failed with exit code $status)" |
24 | 19 | exit 1 |
25 | 20 | else |
26 | 21 | # $status == 0 |
… |
… |
|
39 | 34 | echo "* If this is an official SageNB release, don't forget to *" |
40 | 35 | echo "* push the changes to the public Mercurial repository. *" |
41 | 36 | echo "**********************************************************" |
42 | | #./push |
diff -r 411902fed464 -r b31b4590d0ea spkg-dist
a
|
b
|
|
1 | 1 | #!/usr/bin/env python |
2 | 2 | # Create a new Sage Notebook spkg. |
3 | | |
| 3 | # |
4 | 4 | # Since the 'sdist' shell script called below requires (at least) 'sage' |
5 | 5 | # to be in the path, we could equally check *here* if it is; SAGE_ROOT |
6 | 6 | # or SAGE_LOCAL don't have to be set, since 'sdist' calls 'sage -hg ...' |
7 | 7 | # and 'sage -python ...'. |
8 | 8 | # (We also later run 'sage -pkg ...' from *this* script.) |
9 | 9 | # |
10 | | # We *might* get import errors earlier if some system-wide Python executes |
11 | | # this script (which is probably not intended), so we could really check |
12 | | # here first if SAGE_LOCAL is defined, which is a strong indication that |
13 | | # we're actually using Sage's Python. -leif |
| 10 | # This spkg-dist doesn't need any Sage components, it is fine to run |
| 11 | # it from a system-wide Python. -- Jeroen Demeyer |
14 | 12 | |
15 | 13 | import os |
16 | 14 | import sys |
… |
… |
|
29 | 27 | except IndexError: |
30 | 28 | sys.stderr.write("Error: Found no version string in 'setup.py'\n") |
31 | 29 | sys.exit(1) |
| 30 | |
32 | 31 | i = version_line.find("'") |
33 | 32 | j = version_line.rfind("'") |
34 | 33 | if i==-1 or j==-1 or j-i<3: |
35 | 34 | sys.stderr.write( |
36 | | "Error: Illegal version string in 'setup.py':\n %s\n" % version_line) |
| 35 | "Error: Illegal version string in 'setup.py':\n %s\n" % version_line) |
37 | 36 | sys.stderr.write("Perhaps no single quotes used?\n") |
38 | 37 | sys.exit(1) |
39 | 38 | version = version_line[i + 1:j] |
… |
… |
|
44 | 43 | sys.stdout.flush() |
45 | 44 | proc = subprocess.Popen([os.path.join(os.path.curdir, 'sdist')], shell=True) |
46 | 45 | if proc.wait(): |
47 | | # The previous error message was most probably inadequate, since |
48 | | # 'sdist' tries to commit any changes, and 'hg ci' returns 1 (!) (which |
49 | | # usually indicates an error) if there are *no changes to commit*. |
50 | | # The other potential error in 'sdist' was that 'python setup.py sdist' |
51 | | # failed, in which case the error message would have also been wrong. |
52 | | #print "Uncommitted changes in repository. Stopping." |
53 | 46 | sys.stderr.write( |
54 | | "Error: './sdist' failed. See message(s) above for the specific error.\n") |
| 47 | "Error: './sdist' failed. See message(s) above for the specific error.\n") |
55 | 48 | sys.exit(1) |
56 | 49 | |
57 | 50 | # Create the spkg. |
… |
… |
|
179 | 172 | fi |
180 | 173 | |
181 | 174 | cd "$SAGE_ROOT/local/lib/python/site-packages" |
182 | | # Dave says Solaris' non-POSIX grep in the default path |
183 | | # doesn't understand "-q" (which *is* POSIX): |
| 175 | # Use >/dev/null instead of grep -q (which doesn't work on Solaris) |
184 | 176 | if ! grep sagenb easy-install.pth >/dev/null; then |
185 | 177 | # Ugly work-around, we haven't found the real cause yet (see #10176): |
186 | 178 | echo "No sagenb path found in 'easy-install.pth'"'!' |
… |
… |
|
198 | 190 | exit 1 |
199 | 191 | fi |
200 | 192 | fi |
201 | | if true; then # Aids debugging (cf. #10176) |
202 | | echo "Old path: \"`grep sagenb easy-install.pth`\"" |
203 | | echo "New path: \"`grep sagenb easy-install.pth.$$`\"" |
204 | | fi |
| 193 | |
| 194 | # Print paths for debugging |
| 195 | echo "Old path: '`grep sagenb easy-install.pth`'" |
| 196 | echo "New path: '`grep sagenb easy-install.pth.$$`'" |
| 197 | |
205 | 198 | # The following fails only on wrong file permissions etc.: |
206 | 199 | mv -f easy-install.pth.$$ easy-install.pth |
207 | 200 | if [ $? -ne 0 ]; then |
… |
… |
|
216 | 209 | # We are still in dist/, now package sagenb-x.y.z/ : |
217 | 210 | print "Running 'sage -pkg %s'..."%base |
218 | 211 | sys.stdout.flush() |
219 | | subprocess.call(['sage -pkg ' + base], shell=True) |
220 | | # XXX Perhaps also check exit code here... (but 'sage -pkg' is verbose) |
221 | | |
| 212 | if subprocess.call(['sage', '-pkg', base]): |
| 213 | print "sage -pkg %s failed. See message(s) above for the specific error.\n"%base |
| 214 | sys.exit(1) |