Attachment 'sageMac.py'
Download 1 import sys, commands, string, os
2
3 # path to inside of Sage.app
4 appname = string.join(string.split(sys.argv[0], '/')[:-3], '/')
5 sageDir = appname + '/Contents/Resources/sage'
6 sageScriptOrig = sageDir + '/sage'
7 sageScriptNew = sageDir + '/sageMac.command'
8
9 # copy Sage startup script to end in .command so that OS X will launch it
10 commands.getoutput('cp -f %s %s' % (sageScriptOrig, sageScriptNew))
11
12 # edit sageScriptNew to reflect current location (sageDir)
13 f = open(sageScriptNew)
14 lines = f.read()
15 f.close()
16
17 splitLines = string.split(lines, '"')
18 newLines = [splitLines[0], sageDir]
19 newLines.extend(splitLines[2:])
20 newLines = string.join(newLines, '"')
21
22 f = open(sageScriptNew, 'w')
23 f.write(newLines)
24 f.close()
25
26 # run the script
27 os.execl('/usr/bin/open', '/usr/bin/open', sageScriptNew)
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.