Ticket #13459: 13459_no_cd_scripts.patch

File 13459_no_cd_scripts.patch, 5.4 KB (added by jdemeyer, 9 years ago)
  • ipy_profile_sage.py

    # HG changeset patch
    # User Jeroen Demeyer <jdemeyer@cage.ugent.be>
    # Date 1348728852 -7200
    # Node ID 4c41fe4da2fb0286f32b1b8672ad8292cc335d3e
    # Parent  176a8e7d63e7c708e43b647efc19d73ae36480e6
    Avoid useless directory changes
    
    diff --git a/ipy_profile_sage.py b/ipy_profile_sage.py
    a b  
    88    sage.all_cmdline._init_cmdline(globals())
    99   
    1010    _ip.ex('from sage.all import Integer, RealNumber')
    11     os.chdir(os.environ["CUR"])
    1211    import sage.misc.interpreter
    1312   
    1413    from sage.misc.interpreter import attached_files
  • sage-build

    diff --git a/sage-build b/sage-build
    a b  
    2424      # install
    2525      echo ""
    2626      echo "Installing c_lib"
    27       CUR=`pwd`
    28       cd "c_lib"
     27      cd c_lib
    2928      scons -Q install
    3029      # make sure c_lib install went okay
    3130      if [ $? -ne 0 ]; then
    3231          echo >&2 "Error building c_lib."
    3332          exit 1
    3433      fi
    35       cd "$CUR"
    3634
     35      cd "$SAGE_ROOT/devel/$1/"
    3736      ./install "$SAGE_ROOT"
    3837      if [ $? -ne 0 ]; then
    3938         echo >&2 "Error installing modified $1 library code."
     
    7372fi
    7473
    7574if [ $DO_BUILD_ALL = 1 ]; then
    76     CUR=`pwd`
    7775    cd "$SAGE_ROOT/devel/sage/sage"
    7876    echo "*** TOUCHING ALL CYTHON (.pyx) FILES ***"
    7977    touch */*.pyx */*/*.pyx */*/*/*.pyx */*/*/*/*.pyx */*/*/*/*/*.pyx */*/*/*/*/*.pyx  */*/*/*/*/*/*.pyx 2> /dev/null
    8078    cd ../c_lib
    8179    scons -Q install
    82     cd "$CUR"
    8380fi
    8481
    8582build "sage"
  • sage-eval

    diff --git a/sage-eval b/sage-eval
    a b  
    77
    88if len(sys.argv) > 1:
    99    s = preparse(" ".join(sys.argv[1:]))
    10     os.chdir(os.getenv("CUR"))
    1110    if s.startswith('load') or s.startswith('attach'):
    12         curdir = os.getenv("CUR")
    13         os.system('sage "' + os.path.join(curdir, s.split(None, 1)[1]) + '"')
     11        os.system('sage "' + os.path.join(os.getcwd(), s.split(None, 1)[1]) + '"')
    1412    else:
    1513        eval(compile(s,'<cmdline>','exec'))
    1614
  • sage-ipython

    diff --git a/sage-ipython b/sage-ipython
    a b  
    11#!/usr/bin/env python
    22# -*- coding: utf-8 -*-
    33"""
    4 SAGE IPython startup script.
    5 
     4Sage IPython startup script.
    65"""
    76
    87import os
    98import sys
    109
    11 #Make sure we're using the Sage profile
    12 #is one isn't specified
     10# Make sure we're using the Sage profile if one isn't specified.
    1311if '-p' not in sys.argv:
    1412    sys.argv.extend(['-p', 'sage'])
    1513
     14
     15# Import the Sage module before starting IPython, to ensure we import
     16# Sage from the correct directory (in site-packages).
     17#
     18# IPython adds the current working directory to sys.path.  If the
     19# current working directory is $SAGE_ROOT/devel/sage, sage would be
     20# imported from $SAGE_ROOT/devel/sage/sage, which is bad for example
     21# because it does not contain the Cython modules.  Importing sage before
     22# IPython changes sys.path avoids these problems.
     23import sage
     24
     25
    1626__SAGE_AUTOINJECT__ = True
    1727
    1828import IPython
     
    2333sageCH = CrashHandler(ipy_sage.IP, 'Sage', 'sage-support',
    2434                      'sage-support@googlegroups.com',
    2535                      'http://trac.sagemath.org/sage_trac',
    26                       'Sage_crash_report.txt',
     36                      'Sage_crash_report.txt',
    2737                      show_crash_traceback=False)
    2838
    2939ipy_sage.IP.set_crash_handler(sageCH)
  • sage-preparse

    diff --git a/sage-preparse b/sage-preparse
    a b  
    1111
    1212import os, sys, re
    1313
    14 # The spkg/bin/sage script that calls sage-preparse passes the current
    15 # directory in as the first argument.
    16 os.chdir(sys.argv[1])
    17 
    18 # It passes the files to be preparsed in as all other arguments.
    19 files = sys.argv[2:]
     14# The spkg/bin/sage script passes the files to be preparsed as
     15# arguments (but remove sys.argv[0]).
     16files = sys.argv[1:]
    2017
    2118# There must be at least 1 file or we display an error/usage message
    2219# and exit
  • sage-run

    diff --git a/sage-run b/sage-run
    a b  
    33import os, sys
    44from subprocess import call
    55
    6 os.chdir(sys.argv[1])
    7 
    8 if len(sys.argv) < 3:
     6if len(sys.argv) < 2:
    97    print "You must give a file argument"
    108    sys.exit(1)
    119
    12 fn = sys.argv[2]
    13 opts = sys.argv[3:]
     10fn = sys.argv[1]
     11opts = sys.argv[2:]
    1412
    1513if fn.startswith('-'):
    1614    print "sage-run received unknown option: %s " % fn
  • deleted file sage-run2

    diff --git a/sage-run2 b/sage-run2
    deleted file mode 100755
    + -  
    1 #!/usr/bin/env python
    2 
    3 import os, sys
    4 
    5 args=sys.argv[1:]
    6 
    7 files = [x for x in args if len(x) > 0 and x[0] != '-']
    8 
    9 if len(files) == 0:
    10     sys.exit(1)
    11 
    12 opts  = ' '.join([x for x in args if len(x) > 0 and x[0] == '-'])
    13 if os.system('sage-preparse %s'%(' '.join(files))):
    14     sys.exit(1)
    15 
    16 for file in files:
    17     if file[-5:] == '.sage':
    18         e = os.system('sage-python %s %s.py'%(opts, file))
    19     else:
    20         e = os.system('sage-python %s %s'%(opts, file))
    21     if e:
    22         print "sage: Error running %s using Python"%file
    23 
    24 
    25 
    26 
  • sage-sdist

    diff --git a/sage-sdist b/sage-sdist
    a b  
    3939
    4040TARGET="sage-$SAGE_VERSION"
    4141
    42 CUR=`pwd`
    43 
    4442SAGE_RELEASE_DATE=`date -u +'%Y-%m-%d'`
    4543
    4644# Update Sage version file in SAGE_ROOT.
     
    5957cd "$SAGE_ROOT"/local/bin/
    6058echo "import sage.misc.banner; sage.misc.banner.banner()" | ./python > sage-banner
    6159
    62 cd "$CUR"
    63 
    6460# Copy sage root directory.  Cloning needs to be done in an empty
    6561# directory, so we do this now.  Creating the sage_root spkg is done
    6662# in sage-make_devel_packages below.