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.
  • [get | view] (2009-03-17 16:33:10, 151.1 KB) [[attachment:sage-blue-logo.icns]]
  • [get | view] (2008-02-13 00:05:05, 47.6 KB) [[attachment:sage.icns]]
  • [get | view] (2008-02-13 00:05:19, 0.8 KB) [[attachment:sageMac.py]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.