Skip to content
This repository was archived by the owner on Jun 27, 2020. It is now read-only.

Commit d983201

Browse files
committed
#10494 reviewer patch, various minor changes
1 parent 49fd40b commit d983201

File tree

2 files changed

+20
-33
lines changed

2 files changed

+20
-33
lines changed

sdist

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,21 @@
11
#!/usr/bin/env bash
22

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
105
echo >&2 "Error: $0 requires 'sage' to be in your PATH"
116
echo >&2 "Maybe first call 'SAGE_ROOT/sage -sh'"
127
exit 1
138
fi
149

1510
echo "Trying to commit changes (if any)..."
16-
sage -hg ci
11+
sage -hg commit
1712
status=$?
1813
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...
2015
echo "No changes to commit (not an error)"
2116
elif [ $status -ne 0 ]; then
2217
echo >&2 "Error: $0: Couldn't commit changes" \
23-
"('hg ci' failed with exit code $status)"
18+
"('hg commit' failed with exit code $status)"
2419
exit 1
2520
else
2621
# $status == 0
@@ -39,4 +34,3 @@ echo "**********************************************************"
3934
echo "* If this is an official SageNB release, don't forget to *"
4035
echo "* push the changes to the public Mercurial repository. *"
4136
echo "**********************************************************"
42-
#./push

spkg-dist

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
#!/usr/bin/env python
22
# Create a new Sage Notebook spkg.
3-
3+
#
44
# Since the 'sdist' shell script called below requires (at least) 'sage'
55
# to be in the path, we could equally check *here* if it is; SAGE_ROOT
66
# or SAGE_LOCAL don't have to be set, since 'sdist' calls 'sage -hg ...'
77
# and 'sage -python ...'.
88
# (We also later run 'sage -pkg ...' from *this* script.)
99
#
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
1412

1513
import os
1614
import sys
@@ -29,11 +27,12 @@ try:
2927
except IndexError:
3028
sys.stderr.write("Error: Found no version string in 'setup.py'\n")
3129
sys.exit(1)
30+
3231
i = version_line.find("'")
3332
j = version_line.rfind("'")
3433
if i==-1 or j==-1 or j-i<3:
3534
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)
3736
sys.stderr.write("Perhaps no single quotes used?\n")
3837
sys.exit(1)
3938
version = version_line[i + 1:j]
@@ -44,14 +43,8 @@ print "Creating the new source tarball..."
4443
sys.stdout.flush()
4544
proc = subprocess.Popen([os.path.join(os.path.curdir, 'sdist')], shell=True)
4645
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."
5346
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")
5548
sys.exit(1)
5649

5750
# Create the spkg.
@@ -179,8 +172,7 @@ if [ $? -ne 0 ]; then
179172
fi
180173
181174
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)
184176
if ! grep sagenb easy-install.pth >/dev/null; then
185177
# Ugly work-around, we haven't found the real cause yet (see #10176):
186178
echo "No sagenb path found in 'easy-install.pth'"'!'
@@ -198,10 +190,11 @@ else
198190
exit 1
199191
fi
200192
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+
205198
# The following fails only on wrong file permissions etc.:
206199
mv -f easy-install.pth.$$ easy-install.pth
207200
if [ $? -ne 0 ]; then
@@ -216,6 +209,6 @@ os.chmod(spkg_install, stat.S_IRWXU | stat.S_IRGRP | stat.S_IXGRP |
216209
# We are still in dist/, now package sagenb-x.y.z/ :
217210
print "Running 'sage -pkg %s'..."%base
218211
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)

0 commit comments

Comments
 (0)