Changeset 1085 for install/bootstrap.py


Ignore:
Timestamp:
Oct 4, 2013 4:19:28 PM (8 years ago)
Author:
toby
Message:

installer uses xterm on GNOME shortcut

File:
1 edited

Legend:

Unmodified
Added
Removed
  • install/bootstrap.py

    r983 r1085  
    1717    for pkg in missing: print " ",pkg,
    1818    print
    19     print "We suggest installing the Canopy Express package (must be 32 bit) at\nhttp://www.enthought.com/store"
     19    print "We suggest installing the Canopy Express package (must be 32 bit for Mac) at\nhttp://www.enthought.com/store"
    2020    sys.exit()
    2121
     
    4848    #    if ans.lower().find('no') > -1: sys.exit()
    4949    repos = 'linux'
    50     print 'Linux, Intel-compatible'
     50    print 'Linux, assuming Intel-compatible'
    5151elif sys.platform == "darwin" and platform.processor() == 'i386':
    5252    repos = 'osxi86'
     
    5454elif sys.platform == "darwin":
    5555    repos = 'osxppc'
    56     print 'Mac OS X, PowerPC -- you will need to run f2py on fsource files'
     56    print 'Mac OS X, PowerPC -- you will need to run scons on fsource files'
    5757else:
    58     print 'Unidentifed platform -- you may need to run f2py on fsource files'
     58    print 'Unidentifed platform -- you may need to run scons on fsource files'
    5959
    6060cmds = (
     
    8080# On linux, make desktop icon
    8181if sys.platform.startswith('linux'):
    82     os.chmod(os.path.join(gsaspath, 'GSASII.py'),
    83              stat.S_IXUSR | stat.S_IRUSR | stat.S_IRGRP | stat.S_IXGRP | stat.S_IXOTH)
    84     if os.path.exists(os.path.expanduser('~/Desktop/')):
    85         open(os.path.expanduser('~/Desktop/GSASII.desktop'),'w').write('''
     82    desktop_template = """
    8683[Desktop Entry]
    8784Encoding=UTF-8
     
    8986Type=Application
    9087Terminal=false
    91 Exec=%s
     88Exec=xterm -hold -e %s
    9289Name=GSAS-II
    9390Icon=%s
    94 ''' % (os.path.join(gsaspath, 'GSASII.py'),os.path.join(gsaspath, 'gsas2.png')))
    95         os.chmod(os.path.expanduser('~/Desktop/GSASII.desktop'),
    96                  stat.S_IWUSR | stat.S_IXUSR | stat.S_IRUSR | stat.S_IRGRP | stat.S_IXGRP | stat.S_IXOTH)
     91"""
     92    loc = '~/Desktop/'
     93    eloc = os.path.expanduser(loc)
     94    dfile = os.path.join(eloc,'GSASII.desktop')
     95    icon = os.path.join(gsaspath, 'gsas2.png')
     96    script = os.path.join(gsaspath, 'GSASII.py')
     97    os.chmod(script, # make the .py file executable and readable
     98             stat.S_IXUSR | stat.S_IRUSR | stat.S_IRGRP | stat.S_IXGRP | stat.S_IXOTH)
     99    if os.path.exists(eloc):
     100        open(dfile,'w').write(desktop_template % (script,icon))
     101        os.chmod(
     102            dfile,
     103            stat.S_IWUSR | stat.S_IXUSR | stat.S_IRUSR | stat.S_IRGRP | stat.S_IXGRP | stat.S_IXOTH)
     104        print("created GNOME desktop shortcut "+dfile)
Note: See TracChangeset for help on using the changeset viewer.