Changeset 1357 for trunk/makeMacApp.py


Ignore:
Timestamp:
May 20, 2014 11:15:02 PM (9 years ago)
Author:
toby
Message:

more 64-bit stuff; fix OS X install

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/makeMacApp.py

    r1356 r1357  
    133133
    134134    # find the python application; must be an OS X app
    135     pythonpath,top = os.path.split(os.path.realpath(sys.executable))
     135    pythonpath = os.path.realpath(sys.executable)
     136    top = True
    136137    while top:
    137         if 'Resources' in pythonpath:
    138             pass
    139         elif os.path.exists(os.path.join(pythonpath,'Resources')):
    140             break
     138        pythonapp = os.path.join(pythonpath,'Resources','Python.app','Contents','MacOS','Python')
     139        if os.path.exists(pythonapp): break
    141140        pythonpath,top = os.path.split(pythonpath)
    142         pythonapp = os.path.join(pythonpath,'Resources','Python.app','Contents','MacOS','Python')
    143         if not os.path.exists(pythonapp):
    144             print("\nSorry, failed to find a Python app in "+str(pythonapp))
    145             pythonapp = sys.executable
    146141    else:
    147142        print("\nSorry, failed to find a Resources directory associated with "+str(sys.executable))
    148143        pythonapp = sys.executable
    149 
     144   
    150145    # create a link to the python app, but named to match the project
    151146    if os.path.exists('/tmp/testpython'): os.remove('/tmp/testpython')
     
    156151    #print testout,errout
    157152    if testout.strip() != "OK":
    158         print 'Run of python app failed, assuming Canopy <=1.4'
     153        print 'Run of python app failed, resorting to non-app version of Python, Alas!'
    159154        pythonapp = sys.executable
    160         # switch to pythonw
    161         if os.path.split(pythonapp)[1].lower() == 'python':
    162             pythonapp = os.path.join(os.path.split(pythonapp)[0],'pythonw')
     155        # is this brain-dead Canopy 1.4.0, if so, switch to pythonw
     156        try:
     157            import canopy.version
     158            if canopy.version.version == '1.4.0':
     159                print 'using pythonw for Canopy 1.4.0'
     160                pythonapp = os.path.join(os.path.split(pythonapp)[0],'pythonw')
     161                if not os.path.exists(pythonapp):
     162                    raise Exception('no pythonw here: '+pythonapp)
     163        except ImportError:
     164            pass
    163165        newpython = pythonapp
    164166    else:
     
    166168        newpython =  os.path.join(apppath,"Contents","MacOS",project)
    167169
    168     print sys.executable
    169     print newpython
    170     print pythonapp
    171     #sys.exit()
    172    
    173170    if os.path.exists(apppath): # cleanup
    174171        print("\nRemoving old "+project+" app ("+str(apppath)+")")
Note: See TracChangeset for help on using the changeset viewer.