# 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
|
|
8 | 8 | sage.all_cmdline._init_cmdline(globals()) |
9 | 9 | |
10 | 10 | _ip.ex('from sage.all import Integer, RealNumber') |
11 | | os.chdir(os.environ["CUR"]) |
12 | 11 | import sage.misc.interpreter |
13 | 12 | |
14 | 13 | from sage.misc.interpreter import attached_files |
diff --git a/sage-build b/sage-build
a
|
b
|
|
24 | 24 | # install |
25 | 25 | echo "" |
26 | 26 | echo "Installing c_lib" |
27 | | CUR=`pwd` |
28 | | cd "c_lib" |
| 27 | cd c_lib |
29 | 28 | scons -Q install |
30 | 29 | # make sure c_lib install went okay |
31 | 30 | if [ $? -ne 0 ]; then |
32 | 31 | echo >&2 "Error building c_lib." |
33 | 32 | exit 1 |
34 | 33 | fi |
35 | | cd "$CUR" |
36 | 34 | |
| 35 | cd "$SAGE_ROOT/devel/$1/" |
37 | 36 | ./install "$SAGE_ROOT" |
38 | 37 | if [ $? -ne 0 ]; then |
39 | 38 | echo >&2 "Error installing modified $1 library code." |
… |
… |
|
73 | 72 | fi |
74 | 73 | |
75 | 74 | if [ $DO_BUILD_ALL = 1 ]; then |
76 | | CUR=`pwd` |
77 | 75 | cd "$SAGE_ROOT/devel/sage/sage" |
78 | 76 | echo "*** TOUCHING ALL CYTHON (.pyx) FILES ***" |
79 | 77 | touch */*.pyx */*/*.pyx */*/*/*.pyx */*/*/*/*.pyx */*/*/*/*/*.pyx */*/*/*/*/*.pyx */*/*/*/*/*/*.pyx 2> /dev/null |
80 | 78 | cd ../c_lib |
81 | 79 | scons -Q install |
82 | | cd "$CUR" |
83 | 80 | fi |
84 | 81 | |
85 | 82 | build "sage" |
diff --git a/sage-eval b/sage-eval
a
|
b
|
|
7 | 7 | |
8 | 8 | if len(sys.argv) > 1: |
9 | 9 | s = preparse(" ".join(sys.argv[1:])) |
10 | | os.chdir(os.getenv("CUR")) |
11 | 10 | 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]) + '"') |
14 | 12 | else: |
15 | 13 | eval(compile(s,'<cmdline>','exec')) |
16 | 14 | |
diff --git a/sage-ipython b/sage-ipython
a
|
b
|
|
1 | 1 | #!/usr/bin/env python |
2 | 2 | # -*- coding: utf-8 -*- |
3 | 3 | """ |
4 | | SAGE IPython startup script. |
5 | | |
| 4 | Sage IPython startup script. |
6 | 5 | """ |
7 | 6 | |
8 | 7 | import os |
9 | 8 | import sys |
10 | 9 | |
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. |
13 | 11 | if '-p' not in sys.argv: |
14 | 12 | sys.argv.extend(['-p', 'sage']) |
15 | 13 | |
| 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. |
| 23 | import sage |
| 24 | |
| 25 | |
16 | 26 | __SAGE_AUTOINJECT__ = True |
17 | 27 | |
18 | 28 | import IPython |
… |
… |
|
23 | 33 | sageCH = CrashHandler(ipy_sage.IP, 'Sage', 'sage-support', |
24 | 34 | 'sage-support@googlegroups.com', |
25 | 35 | 'http://trac.sagemath.org/sage_trac', |
26 | | 'Sage_crash_report.txt', |
| 36 | 'Sage_crash_report.txt', |
27 | 37 | show_crash_traceback=False) |
28 | 38 | |
29 | 39 | ipy_sage.IP.set_crash_handler(sageCH) |
diff --git a/sage-preparse b/sage-preparse
a
|
b
|
|
11 | 11 | |
12 | 12 | import os, sys, re |
13 | 13 | |
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]). |
| 16 | files = sys.argv[1:] |
20 | 17 | |
21 | 18 | # There must be at least 1 file or we display an error/usage message |
22 | 19 | # and exit |
diff --git a/sage-run b/sage-run
a
|
b
|
|
3 | 3 | import os, sys |
4 | 4 | from subprocess import call |
5 | 5 | |
6 | | os.chdir(sys.argv[1]) |
7 | | |
8 | | if len(sys.argv) < 3: |
| 6 | if len(sys.argv) < 2: |
9 | 7 | print "You must give a file argument" |
10 | 8 | sys.exit(1) |
11 | 9 | |
12 | | fn = sys.argv[2] |
13 | | opts = sys.argv[3:] |
| 10 | fn = sys.argv[1] |
| 11 | opts = sys.argv[2:] |
14 | 12 | |
15 | 13 | if fn.startswith('-'): |
16 | 14 | print "sage-run received unknown option: %s " % fn |
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 | | |
diff --git a/sage-sdist b/sage-sdist
a
|
b
|
|
39 | 39 | |
40 | 40 | TARGET="sage-$SAGE_VERSION" |
41 | 41 | |
42 | | CUR=`pwd` |
43 | | |
44 | 42 | SAGE_RELEASE_DATE=`date -u +'%Y-%m-%d'` |
45 | 43 | |
46 | 44 | # Update Sage version file in SAGE_ROOT. |
… |
… |
|
59 | 57 | cd "$SAGE_ROOT"/local/bin/ |
60 | 58 | echo "import sage.misc.banner; sage.misc.banner.banner()" | ./python > sage-banner |
61 | 59 | |
62 | | cd "$CUR" |
63 | | |
64 | 60 | # Copy sage root directory. Cloning needs to be done in an empty |
65 | 61 | # directory, so we do this now. Creating the sage_root spkg is done |
66 | 62 | # in sage-make_devel_packages below. |