Changeset 2410 for install/bootstrap.py


Ignore:
Timestamp:
Aug 7, 2016 5:12:26 PM (5 years ago)
Author:
toby
Message:

update for new mac build

File:
1 edited

Legend:

Unmodified
Added
Removed
  • install/bootstrap.py

    r2315 r2410  
    66home = 'https://subversion.xray.aps.anl.gov/pyGSAS/'
    77print 70*'*'
     8#testing for incorrect locale code'
     9try:
     10    import locale
     11    locale.getdefaultlocale()
     12except ValueError:
     13    print 'Your location is not set properly. This causes problems for matplotlib'
     14    print '  (see https://github.com/matplotlib/matplotlib/issues/5420.)'
     15    print 'Will try to bypass problem by setting LC_ALL to en_US.UTF-8 (US English)'
     16    os.environ['LC_ALL'] = 'en_US.UTF-8'
     17    locale.getdefaultlocale()
     18print 'Preloading matplotlib to build fonts...'
     19try:
     20    import matplotlib
     21except:
     22    pass
    823print 'Checking python packages...',
    924missing = []
    10 for pkg in ['numpy','scipy','matplotlib','wx']:
     25for pkg in ['numpy','scipy','matplotlib','wx',]:
    1126    try:
    1227        exec('import '+pkg)
    13     except ImportError:
     28    except:
    1429        missing.append(pkg)
    15 # handle pyopenGl differently, because that we can install later
    16 try:
    17     import OpenGL as ogl
    18     install_with_easyinstall = None
    19 except ImportError:
    20     print '\nPyOpenGL not present. ',
    21     try:
    22         from setuptools.command import easy_install
    23     except ImportError:
    24         missing.append('setuptools')
    25     def install_with_easyinstall(package):
    26         try:
    27             print "trying system-wide ",
    28             easy_install.main(['-f',os.path.split(__file__)[0],package])
    29             return
    30         except:
    31             pass
    32         try:
    33             print "trying user level ",
    34             easy_install.main(['-f',os.path.split(__file__)[0],'--user',package])
    35             return
    36         except:
    37             print "\nInstall of "+package+" failed. Please report this information:"
    38             import traceback
    39             print traceback.format_exc()
    40             sys.exit()
    4130
    4231if missing:
     
    4635    for pkg in missing: print " ",pkg,
    4736    print
    48     print "We suggest installing the free Canopy Express package at http://www.enthought.com/downloads"
    49     print "or the free Anaconda python package at https://store.continuum.io/cshop/anaconda/"
     37    print "This should not happen as this script should be called with a "
     38    print "specially configured version of the free Anaconda python package."
     39    print "Please contact Brian Toby (toby@anl.gov)"
     40    for pkg in ['numpy','scipy','matplotlib','wx',]:
     41        exec('import '+pkg)
    5042    sys.exit()
     43try:
     44    import OpenGL
     45except:
     46    print "Missing the OpenGL Python package."
     47    print "This should not happen as this script should be called with a "
     48    print "specially configured version of the free Anaconda python package,"
     49    print "but GSAS-II can install this package anyway."
     50    print "Please contact Brian Toby (toby@anl.gov) to report this problem."
    5151
    5252# path to where this script is located
     
    6464    # add the standard location for wandisco svn to the path
    6565    pathlist.append('/opt/subversion/bin')
     66if sys.platform.startswith('win'):
     67    svn = 'svn.exe'
     68else:
     69    svn = 'svn'
     70# use svn installed via conda 1st (mac)
     71if os.path.exists(os.path.join(os.path.split(sys.executable)[0],svn)):
     72    pathlist.insert(0,os.path.split(sys.executable)[0])
     73# use svn installed via conda 1st (Windows)
     74if os.path.exists(os.path.join(os.path.split(sys.executable)[0],'Library','bin',svn)):
     75    pathlist.insert(0,os.path.join(os.path.split(sys.executable)[0],'Library','bin'))
     76
    6677for path in pathlist:
    6778    svn = os.path.join(path,'svn')
     
    7586else:
    7687    raise Exception('Subversion (svn) not found')
    77 print ' found svn in',svn
     88print ' found svn image: '+svn
    7889
    7990print 'Ready to bootstrap GSAS-II from repository\n\t',home,'\nto '+gsaspath
     
    135146
    136147#===========================================================================
    137 # install OpenGL, if needed.
    138 if install_with_easyinstall:
    139     print '\nInstalling PyOpenGL. Lots of warnings will follow... ',
    140     install_with_easyinstall('PyOpenGl')
    141     print 'done.'
    142 #===========================================================================
    143148# import all .py files so that .pyc files get created
    144149print 'Byte-compiling all .py files...',
     
    157162elif sys.platform.startswith('darwin') and os.path.exists(
    158163    os.path.join(gsaspath,"makeMacApp.py")):
     164    print('running '+os.path.join(gsaspath,"makeMacApp.py"))
    159165    execfile(os.path.join(gsaspath,"makeMacApp.py"))
    160166#===========================================================================
Note: See TracChangeset for help on using the changeset viewer.