Ticket #10494: 10494_reviewer.patch

File 10494_reviewer.patch, 5.2 KB (added by jdemeyer, 12 years ago)

Reviewer patch, SAGENB (fixed filename, ignore previous)

  • sdist

    # 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  
    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)
     4if ! 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
    138fi
    149
    1510echo "Trying to commit changes (if any)..."
    16 sage -hg ci
     11sage -hg commit
    1712status=$?
    1813if [ $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)"
    2116elif [ $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
    2520else
    2621    # $status == 0
     
    3934echo "* If this is an official SageNB release, don't forget to *"
    4035echo "* push the changes to the public Mercurial repository.   *"
    4136echo "**********************************************************"
    42 #./push
  • spkg-dist

    diff -r 411902fed464 -r b31b4590d0ea spkg-dist
    a b  
    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
    1513import os
    1614import sys
     
    2927except IndexError:
    3028    sys.stderr.write("Error: Found no version string in 'setup.py'\n")
    3129    sys.exit(1)
     30
    3231i = version_line.find("'")
    3332j = version_line.rfind("'")
    3433if 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)
    3938version = version_line[i + 1:j]
     
    4443sys.stdout.flush()
    4544proc = subprocess.Popen([os.path.join(os.path.curdir, 'sdist')], shell=True)
    4645if 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.
     
    179172fi
    180173
    181174cd "$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)
    184176if ! 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'"'!'
     
    198190        exit 1
    199191    fi
    200192fi
    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
     195echo "Old path: '`grep sagenb easy-install.pth`'"
     196echo "New path: '`grep sagenb easy-install.pth.$$`'"
     197
    205198# The following fails only on wrong file permissions etc.:
    206199mv -f easy-install.pth.$$ easy-install.pth
    207200if [ $? -ne 0 ]; then
     
    216209# We are still in dist/, now package sagenb-x.y.z/ :
    217210print "Running 'sage -pkg %s'..."%base
    218211sys.stdout.flush()
    219 subprocess.call(['sage -pkg ' + base], shell=True)
    220 # XXX Perhaps also check exit code here... (but 'sage -pkg' is verbose)
    221 
     212if 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)