Ticket #10176: sagenb-0.8.7_vs._0.8.7.p2.diff

File sagenb-0.8.7_vs._0.8.7.p2.diff, 5.2 KB (added by leif, 12 years ago)

Cumulative diff between SageNB 0.8.7 and 0.8.7.p2 - for reference / review only.

  • setup.py

    diff -r b68fd5956e6d -r 60d3b34db22e setup.py
    a b  
    55import os, sys, time
    66from setuptools import setup
    77
     8
     9import distutils.log
     10
     11if os.environ.get("SAGE_SETUPTOOLS_DEBUG","no")=="yes":
     12    distutils.log.set_threshold(distutils.log.DEBUG)
     13
     14
    815def all_files(dir, lstrip):
    916    """
    1017    Return list of all filenames in the given directory, with lstrip
     
    2128   
    2229
    2330code = setup(name = 'sagenb',
    24       version     = '0.8.7',  # the spkg-dist script assumes single quotes here
     31      version     = '0.8.7.p2',  # the spkg-dist script assumes single quotes here
    2532      description = 'The Sage Notebook',
    2633      license     = 'GNU Public License (GPL) v2+',
    2734      author      = 'William Stein et al.',
  • spkg-dist

    diff -r b68fd5956e6d -r 60d3b34db22e spkg-dist
    a b  
    4242
    4343spkg_install = os.path.abspath(os.path.join(os.path.curdir, 'spkg-install'))
    4444spkg_install_fd = open(spkg_install, 'w')
    45 spkg_install_fd.write("cd src\n")
    4645
    4746shutil.copy(os.path.join(os.path.pardir, os.path.pardir, 'SPKG.txt'),
    4847            os.path.curdir)
     
    5150
    5251def fetch_packages():
    5352    # This block is here in case we ever need it again.
     53    # XXX Then also make sure the easy_install commands
     54    # XXX get written to the correct part of spkg-install!
     55    # XXX (We currently use a single string for the whole file.)
    5456    print "Fetching the required packages"
    5557    pkg_index = PackageIndex()
    5658
     
    7577
    7678os.chdir(os.path.pardir)
    7779
    78 spkg_install_fd.write("""
     80# Write the whole file from a single raw Python string:
     81# (The #! has to be on the first line of the script.)
     82spkg_install_fd.write(
     83r"""#!/usr/bin/env bash
     84
     85# spkg-install for SageNB, generated by SageNB's spkg-dist
     86
     87if [ -z "$SAGE_LOCAL" ]; then
     88    echo "SAGE_LOCAL undefined - exiting..."
     89    exit 1
     90fi
     91
     92cd src
     93
    7994cd sagenb
    8095python setup.py install
    81 
    82 mkdir -p "$SAGE_ROOT/devel"
    83 
    84 echo "Copying SageNB package to '$SAGE_ROOT/devel/sagenb-main'."
    85 if [ -d "$SAGE_ROOT/devel/sagenb-main" ]; then
    86   echo "Copying old SageNB package to '$SAGE_ROOT/devel/sagenb-main-old'."
    87   rm -rf "$SAGE_ROOT/devel/sagenb-main-old"
    88   cp -pr "$SAGE_ROOT/devel/sagenb-main" "$SAGE_ROOT/devel/sagenb-main-old"
     96if [ $? -ne 0 ]; then
     97    echo "Error running 'setup.py install'."
     98    exit 1
    8999fi
    90100
    91 rm -f "$SAGE_ROOT/devel/sagenb"
     101mkdir -p "$SAGE_ROOT/devel" # Create if it doesn't already exist
    92102
    93 cd ..
    94 cp -pr sagenb "$SAGE_ROOT/devel/sagenb-main"
     103echo "Copying SageNB package to '$SAGE_ROOT/devel/sagenb-main'..."
     104
     105if [ -d "$SAGE_ROOT/devel/sagenb-main" ]; then
     106    echo "Moving old SageNB package to '$SAGE_ROOT/devel/sagenb-main-old'..."
     107    rm -rf "$SAGE_ROOT/devel/sagenb-main-old"
     108    mv "$SAGE_ROOT/devel/sagenb-main" "$SAGE_ROOT/devel/sagenb-main-old"
     109    if [ $? -ne 0 ]; then
     110        echo "Error moving the old 'sagenb-main' branch."
     111        exit 1
     112    fi
     113fi
     114
     115rm -f "$SAGE_ROOT/devel/sagenb" # Delete just the link itself (if it exists)
     116
     117cd .. # Back to sagenb-x.y.z/src/
     118cp -pr sagenb "$SAGE_ROOT/devel/sagenb-main" # Creates new sagenb-main dir
     119if [ $? -ne 0 ]; then
     120    echo "Error copying the new SageNB package."
     121    exit 1
     122fi
    95123
    96124cd "$SAGE_ROOT/devel"
    97 ln -snf sagenb-main sagenb
     125ln -s sagenb-main sagenb # Create new symbolic link (deleted above)
     126if [ $? -ne 0 ]; then
     127    echo "Error creating symbolic link to '$SAGE_ROOT/devel/sagenb-main'."
     128    exit 1
     129fi
    98130
    99131# We use relative paths for relocatability.
    100132cd "$SAGE_ROOT/devel/sagenb"
    101133python setup.py develop --egg-path ../../../../devel/sagenb
     134if [ $? -ne 0 ]; then
     135    echo "Error running 'setup.py develop'."
     136    exit 1
     137fi
    102138
    103139cd "$SAGE_ROOT/local/lib/python/site-packages"
    104 sed 's/^.*sagenb.*$/..\/..\/..\/..\/devel\/sagenb/' easy-install.pth > easy-install.pth.new
    105 mv -f easy-install.pth.new easy-install.pth
     140# Dave says Solaris' non-POSIX grep in the default path
     141# doesn't understand "-q" (which *is* POSIX):
     142if ! grep sagenb easy-install.pth >/dev/null; then
     143    # Ugly work-around, we haven't found the real cause yet (see #10176):
     144    echo "No sagenb path found in 'easy-install.pth'"'!'
     145    echo "Adding relative sagenb path to 'easy-install.pth'..."
     146    sed -e '$ i \../../../../devel/sagenb' easy-install.pth > easy-install.pth.$$
     147    if [ $? -ne 0 ]; then
     148        echo "Error adding relative sagenb path to 'easy-install.pth'."
     149        exit 1
     150    fi
     151else
     152    echo "Making sagenb path in 'easy-install.pth' relative..."
     153    sed 's/^.*sagenb.*$/..\/..\/..\/..\/devel\/sagenb/' easy-install.pth > easy-install.pth.$$
     154    if [ $? -ne 0 ]; then
     155        echo "Error patching 'easy-install.pth' to have relative path to SageNB."
     156        exit 1
     157    fi
     158fi
     159if true; then # Aids debugging (cf. #10176)
     160    echo "Old path: \"`grep sagenb easy-install.pth`\""
     161    echo "New path: \"`grep sagenb easy-install.pth.$$`\""
     162fi
     163# The following fails only on wrong file permissions etc.:
     164mv -f easy-install.pth.$$ easy-install.pth
     165if [ $? -ne 0 ]; then
     166    echo "Error overwriting original 'easy-install.pth'."
     167    exit 1
     168fi
    106169""")
    107170spkg_install_fd.close()
    108171os.chmod(spkg_install, stat.S_IRWXU | stat.S_IRGRP | stat.S_IXGRP |