source: install/bootstrap.py @ 4640

Last change on this file since 4640 was 4640, checked in by toby, 3 years ago

workarounds for Mac svn checksum problem

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Author Revision URL Id
File size: 24.1 KB
Line 
1#!/usr/bin/env python
2# Installs GSAS-II from network using subversion and creates platform-specific shortcuts.
3# works for Mac & Linux & Windows
4from __future__ import division, print_function
5import os, stat, sys, platform, subprocess, datetime
6
7version = "$Id: bootstrap.py 4640 2020-11-03 03:42:45Z toby $"
8g2home = 'https://subversion.xray.aps.anl.gov/pyGSAS/'
9path2GSAS2 = os.path.dirname(os.path.abspath(os.path.expanduser(__file__)))
10
11skipInstallChecks = False  # if set to True, continue installation even if current Python lacks packages and
12                           # skips platform-dependent installation steps
13skipDownloadSteps = False  # if False, svn is used to download GSAS-II files and binaries
14skipProxy = False          # if False then the script creates a prompt asking for proxy info
15showWXerror = False        # if True, errors are shown in wxPython windows (used on Windows only)
16help = False               # if True, a help message is shown
17allBinaries = False        # if True, causes all binaries to be installed
18binaryVersion=None         # if specified, gives a specific numpy version to use (such as 1.18)
19                           # for selecting a set of binaries to use
20numpyVersion=None
21
22for a in sys.argv[1:]:
23    if 'noinstall' in a.lower():
24        skipInstallChecks = True
25        if sys.platform.startswith('win'): showWXerror = True
26    elif 'nonet' in a.lower():
27        skipDownloadSteps = True
28        skipProxy = True
29    elif 'noproxy' in a.lower():
30        skipProxy = True
31    elif 'allbin' in a.lower() or 'server' in a.lower():
32        allBinaries = True
33    elif 'binary' in a.lower():
34        numpyVersion = a.split('=')[1]
35        skipInstallChecks = True
36        if sys.platform.startswith('win'): showWXerror = True
37        skipProxy = True
38    else:
39        help = True
40    if 'help' in a.lower():
41        help = True
42
43if help:
44    print('''
45  bootstrap.py options:
46
47    --noinstall   skip post-install, such as creating run shortcuts, turns on
48                  wxpython error display in Windows
49    --noproxy     do not ask for proxy information
50    --server      load all binary versions
51    --allbin      load all binary versions (same as --server)
52    --help        this message
53    --nonet       skip steps requiring internet
54    --binary=ver  specifies a specific numpy binary directory to use (such as
55                  --binary=1.18); turns on --noinstall and --noproxy
56''')
57    sys.exit()
58
59now = str(datetime.datetime.now())
60print('Running bootstrap from {} at {}\n\tId: {}'.format(path2GSAS2,now,version))
61print ("Python:     %s"%sys.version.split()[0])
62try:
63    import numpy as np
64    print ("numpy:      %s"%np.__version__)
65except:
66    pass
67fp = open(os.path.join(path2GSAS2,'bootstrap.log'),'a')
68fp.write('Running bootstrap from {} at {}\n\tId: {}\n'.format(path2GSAS2,now,version))
69fp.close()
70       
71################################################################################
72################################################################################
73def BailOut(msg):
74    '''Exit with an error message. Use a GUI to show the error when
75    showWXerror == True (on windows when --noinstall is specified)
76    '''
77    print(msg)
78    if showWXerror:
79        import wx
80        app = wx.App()
81        app.MainLoop()
82        dlg = wx.MessageDialog(None,msg,'GSAS-II installation error', 
83                wx.OK | wx.ICON_ERROR | wx.STAY_ON_TOP)
84        dlg.Raise()
85        dlg.ShowModal()
86        dlg.Destroy()
87    else:
88        print("Recreate error this using command:")
89        print("     {} {} {}".format(
90            os.path.abspath(sys.executable),
91            os.path.abspath(os.path.expanduser(__file__)),
92            ' '.join(sys.argv[1:]),
93        ),file=sys.stderr)
94        print("\nBOOTSTRAP WARNING: ",file=sys.stderr)
95        for line in msg.split('\n'):
96            print(line,file=sys.stderr)
97    sys.exit()
98       
99def GetConfigValue(*args): return True
100# routines copied from GSASIIpath.py
101proxycmds = []
102'Used to hold proxy information for subversion, set if needed in whichsvn'
103svnLocCache = None
104'Cached location of svn to avoid multiple searches for it'
105
106def MakeByte2str(arg):
107    '''Convert output from subprocess pipes (bytes) to str (unicode) in Python 3.
108    In Python 2: Leaves output alone (already str).
109    Leaves stuff of other types alone (including unicode in Py2)
110    Works recursively for string-like stuff in nested loops and tuples.
111
112    typical use::
113
114        out = MakeByte2str(out)
115
116    or::
117
118        out,err = MakeByte2str(s.communicate())
119   
120    '''
121    if isinstance(arg,str): return arg
122    if isinstance(arg,bytes):
123        try:
124            return arg.decode()
125        except:
126            print('Decode error')
127            return arg
128    if isinstance(arg,list):
129        return [MakeByte2str(i) for i in arg]
130    if isinstance(arg,tuple):
131        return tuple([MakeByte2str(i) for i in arg])
132    return arg
133
134def getsvnProxy():
135    '''Loads a proxy for subversion from the file created by bootstrap.py
136    '''
137    global proxycmds
138    proxycmds = []
139    proxyinfo = os.path.join(os.path.expanduser('~/.G2local/'),"proxyinfo.txt")
140    if not os.path.exists(proxyinfo):
141        proxyinfo = os.path.join(path2GSAS2,"proxyinfo.txt")
142    if not os.path.exists(proxyinfo):
143        return '','',''
144    fp = open(proxyinfo,'r')
145    host = fp.readline().strip()
146    # allow file to begin with comments
147    while host.startswith('#'):
148        host = fp.readline().strip()
149    port = fp.readline().strip()
150    etc = []
151    line = fp.readline()
152    while line:
153        etc.append(line.strip())
154        line = fp.readline()
155    fp.close()
156    setsvnProxy(host,port,etc)
157    return host,port,etc
158
159def setsvnProxy(host,port,etc=[]):
160    '''Sets the svn commands needed to use a proxy
161    '''
162    global proxycmds
163    proxycmds = []
164    host = host.strip()
165    port = port.strip()
166    if host: 
167        proxycmds.append('--config-option')
168        proxycmds.append('servers:global:http-proxy-host='+host)
169        if port:
170            proxycmds.append('--config-option')
171            proxycmds.append('servers:global:http-proxy-port='+port)
172    for item in etc:
173        proxycmds.append(item)
174       
175def whichsvn():
176    '''Returns a path to the subversion exe file, if any is found.
177    Searches the current path after adding likely places where GSAS-II
178    might install svn.
179
180    :returns: None if svn is not found or an absolute path to the subversion
181      executable file.
182    '''
183    # use a previosuly cached svn location
184    global svnLocCache
185    if svnLocCache: return svnLocCache
186    # prepare to find svn
187    is_exe = lambda fpath: os.path.isfile(fpath) and os.access(fpath, os.X_OK)
188    svnprog = 'svn'
189    if sys.platform.startswith('win'): svnprog += '.exe'
190    host,port,etc = getsvnProxy()
191    if GetConfigValue('debug') and host:
192        print('DBG_Using proxy host {} port {}'.format(host,port))
193    # add likely places to find subversion when installed with GSAS-II
194    pathlist = os.environ["PATH"].split(os.pathsep)
195    pathlist.insert(0,os.path.split(sys.executable)[0])
196    pathlist.insert(1,path2GSAS2)
197    for rpt in ('..','bin'),('..','Library','bin'),('svn','bin'),('svn',),('.'):
198        pt = os.path.normpath(os.path.join(path2GSAS2,*rpt))
199        if os.path.exists(pt):
200            pathlist.insert(0,pt)   
201    # search path for svn or svn.exe
202    for path in pathlist:
203        exe_file = os.path.join(path, svnprog)
204        if is_exe(exe_file):
205            try:
206                p = subprocess.Popen([exe_file,'help'],stdout=subprocess.PIPE)
207                res = p.stdout.read()
208                p.communicate()
209                svnLocCache = os.path.abspath(exe_file)
210                return svnLocCache
211            except:
212                pass       
213    svnLocCache = None
214
215def svnVersion(svn=None):
216    '''Get the version number of the current subversion executable
217
218    :returns: a string with a version number such as "1.6.6" or None if
219      subversion is not found.
220
221    '''
222    if not svn: svn = whichsvn()
223    if not svn: return
224
225    cmd = [svn,'--version','--quiet']
226    s = subprocess.Popen(cmd,
227                         stdout=subprocess.PIPE,stderr=subprocess.PIPE)
228    out,err = MakeByte2str(s.communicate())
229    if err:
230        print ('subversion error!\nout=%s'%out)
231        print ('err=%s'%err)
232        s = '\nsvn command:  '
233        for i in cmd: s += i + ' '
234        print(s)
235        return None
236    return out.strip()
237
238def svnVersionNumber(svn=None):
239    '''Get the version number of the current subversion executable
240
241    :returns: a fractional version number such as 1.6 or None if
242      subversion is not found.
243
244    '''
245    ver = svnVersion(svn)
246    if not ver: return 
247    M,m = ver.split('.')[:2]
248    return int(M)+int(m)/10.
249
250def svnChecksumPatch(svn,fpath,verstr):
251    '''This performs a fix when svn cannot finish an update because of
252    a Checksum mismatch error. This seems to be happening on OS X for
253    unclear reasons.
254    '''
255    print('\nAttempting patch for svn Checksum mismatch error\n')
256    cmd = [svn,'cleanup',fpath]
257    s = subprocess.Popen(cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
258    out,err = MakeByte2str(s.communicate())
259    #if err: print('error=',err)
260    cmd = ['svn','update','--set-depth','empty',
261               os.path.join(fpath,'bindist')]
262    s = subprocess.Popen(cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
263    out,err = MakeByte2str(s.communicate())
264    #if err: print('error=',err)
265    try:
266        import GSASIIpath
267        print('import of GSASIIpath completed')
268    except Exception as err:
269        msg = 'Failed with import of GSASIIpath. This is unexpected.'
270        msg += '\nGSAS-II will not run without correcting this. Contact toby@anl.gov'
271        BailOut(msg)
272    GSASIIpath.DownloadG2Binaries(g2home,verbose=True)
273    cmd = ['svn','update','--set-depth','infinity',
274               os.path.join(fpath,'bindist')]
275    s = subprocess.Popen(cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
276    out,err = MakeByte2str(s.communicate())
277    #if err: print('error=',err)
278    cmd = [svn,'update',fpath,verstr,
279                       '--non-interactive',
280                       '--accept','theirs-conflict','--force']
281    if svnVersionNumber() >= 1.6:
282        cmd += ['--trust-server-cert']
283    if proxycmds: cmd += proxycmds
284    #print(cmd)
285    s = subprocess.Popen(cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
286    out,err = MakeByte2str(s.communicate())
287    #if err: print('error=',err)
288    return err
289
290################################################################################
291################################################################################
292print(70*'*')
293#testing for incorrect locale code'
294try:
295    import locale
296    locale.getdefaultlocale()
297except ValueError:
298    print('Your location is not set properly. This causes problems for matplotlib')
299    print('  (see https://github.com/matplotlib/matplotlib/issues/5420.)')
300    print('Will try to bypass problem by setting LC_ALL to en_US.UTF-8 (US English)')
301    os.environ['LC_ALL'] = 'en_US.UTF-8'
302    locale.getdefaultlocale()
303print('Preloading matplotlib to build fonts...')
304try:
305    import matplotlib
306except:
307    pass
308print('Checking python packages...')
309missing = []
310for pkg in ['numpy','scipy','matplotlib','wx','OpenGL',]:
311    try:
312        exec('import '+pkg)
313    except:
314        missing.append(pkg)
315
316if missing and not skipInstallChecks:
317    msg = """Sorry, this version of Python cannot be used
318for GSAS-II. It is missing the following package(s):
319\t"""
320    for pkg in missing: msg += " "+pkg
321    msg += "\nPlease install these package(s) and try running bootstrap.py again."
322    #print("Showing first error: ")
323    #for pkg in ['numpy','scipy','matplotlib','wx','OpenGL',]:
324    #    exec('import '+pkg)
325    BailOut(msg)
326
327if not skipDownloadSteps:
328    host = None
329    port = '80'
330    print('\nChecking for subversion...')
331    svn = whichsvn() # resets host & port if proxyinfo.txt is found
332    if not svn:
333        msg ="Sorry, subversion (svn) could not be found on your system."
334        msg += "\nPlease install this or place in path and rerun this."
335        BailOut(msg)
336    else:
337        print(' found svn image: '+svn)
338
339#if install_with_easyinstall:           
340#    print('\nInstalling PyOpenGL. Lots of warnings will follow... ')
341#    install_with_easyinstall('PyOpenGl')               
342#    print('done.')
343   
344print('Ready to bootstrap GSAS-II from repository\n\t'+g2home+'\nto '+path2GSAS2)
345proxycmds = []
346host,port,etc = getsvnProxy()
347if sys.version_info[0] == 2:
348    getinput = raw_input
349else:
350    getinput = input
351
352# get proxy setting from environment variable
353key = None
354for i in os.environ.keys():
355    if 'https_proxy' == i.lower():
356        key = i
357        break
358else:
359    for i in os.environ.keys():
360        if 'http_proxy' == i.lower():
361            key = i
362            break
363val = ''
364if key:
365    val = os.environ[key].strip()
366if val:
367    if val[-1] == '/':
368        val = val[:-1]
369    if len(val.split(':')) > 2:
370        host = ':'.join(val.split(':')[:-1])
371        port = val.split(':')[-1]
372    else:
373        host = ':'.join(val.split(':')[:-1])
374        port = val.split(':')[-1]
375
376# get proxy from user, if terminal available
377try:
378    if skipProxy:
379        host = ""
380    elif host:
381        print('\n'+75*'*')
382        ans = getinput("Enter the proxy address (type none to remove) ["+host+"]: ").strip()
383        if ans.lower() == "none": host = ""
384    else:
385        ans = getinput("Enter your proxy address [none needed]: ").strip()
386        if ans: host = ans
387    if host:
388        ans = getinput("Enter the proxy port ["+port+"]: ").strip()
389        if ans == "": ans=port
390        port = ans
391        print('If your site needs additional svn commands (such as \n\t',
392                  '--config-option servers:global:http-proxy-username=*account*','\n\t',
393                  '--config-option servers:global:http-proxy-password=*password*',
394                  '\nenter them now:')
395        if etc:
396            prevetc = ' '.join(etc)
397            print('\nDefault for next input is "{}"'.format(prevetc))
398            prompt = "Enter additional svn options (if any) [use previous]: "
399        else:
400            prompt = "Enter additional svn options (if any) [none]: "
401        ans = 'start'
402        etcstr = ''
403        while ans:
404            ans = getinput(prompt).strip()
405            prompt = "more svn options (if any): "
406            if etcstr: etcstr += ' '
407            etcstr += ans
408        if etcstr.strip():
409           etc = etcstr.split()
410except EOFError:
411    host = ""
412    port = ""
413    etc = []
414setsvnProxy(host,port,etc)
415# delete old proxy files
416localproxy = os.path.join(os.path.expanduser('~/.G2local/'),"proxyinfo.txt")
417for proxyinfo in localproxy,os.path.join(path2GSAS2,"proxyinfo.txt"):
418    if os.path.exists(proxyinfo):
419        try:
420            os.remove(proxyinfo)
421            print('Deleted file {}'.format(proxyinfo))
422        except:
423            pass
424if host:
425    try:
426        fp = open(proxyinfo,'w')
427    except:
428        fp = open(localproxy,'w')
429        proxyinfo = localproxy
430    try:
431        fp.write(host.strip()+'\n')
432        fp.write(port.strip()+'\n')
433        for i in etc:
434            if i.strip():
435                fp.write(i.strip()+'\n')
436        fp.close()
437        msg = 'Proxy info written: {} port {} etc {}\n'.format(host,port,etc)
438        print(msg)
439        fp = open(os.path.join(path2GSAS2,'bootstrap.log'),'a')
440        fp.write(msg)
441        fp.close()
442    except Exception as err:
443        print('Error writing file {}:\n{}'.format(proxyinfo,err))
444       
445if not skipDownloadSteps:
446    # patch: switch GSAS-II location if linked to XOR server (relocated May/June 2017)
447    cmd = [svn, 'info']
448    p = subprocess.Popen(cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
449    res,err = p.communicate()
450    if '.xor.' in str(res):
451        print('Switching previous install with .xor. download location to\n\thttps://subversion.xray.aps.anl.gov/pyGSAS')
452        cmd = [svn, 'switch','--relocate','https://subversion.xor.aps.anl.gov/pyGSAS',
453               'https://subversion.xray.aps.anl.gov/pyGSAS']
454        if proxycmds: cmd += proxycmds
455        p = subprocess.Popen(cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
456        res,err = p.communicate()
457        if err:
458            print('Please report this error to toby@anl.gov:')
459            print(err)
460            print(res)
461    # patch: switch GSAS-II location if switched to 2frame version (removed August 2017)
462    if '2frame' in str(res):
463        print('Switching previous 2frame install to trunk\n\thttps://subversion.xray.aps.anl.gov/pyGSAS')
464        cmd = [svn, 'switch',g2home + '/trunk',path2GSAS2,
465               '--non-interactive','--trust-server-cert',
466               '--accept','theirs-conflict','--force','--ignore-ancestry']
467        if proxycmds: cmd += proxycmds
468        p = subprocess.Popen(cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
469        res,err = p.communicate()
470        if err:
471            print('Please report this error to toby@anl.gov:')
472            print(err)
473            print(res)
474
475    print('\n'+75*'*')
476    print('Now preparing to install GSAS-II')
477    tryagain = True
478    err = False
479    firstPass = 0
480    while(tryagain):
481        tryagain = False
482        if err:
483            print('Retrying after a cleanup...')
484            cmd = [svn, 'cleanup', path2GSAS2]
485            s = subprocess.Popen(cmd,stderr=subprocess.PIPE)
486            out,err = MakeByte2str(s.communicate())
487            if err:
488                print('subversion returned an error:')
489                print(out)
490                print(err)
491        cmd = [svn, 'co', g2home+ 'trunk/', path2GSAS2, '--non-interactive', '--trust-server-cert']
492        if proxycmds: cmd += proxycmds
493        msg = 'svn load command: '
494        for item in cmd: msg += " "+item
495        print(msg)
496        s = subprocess.Popen(cmd,stderr=subprocess.PIPE)
497        print('\nsubversion output:')
498        out,err = MakeByte2str(s.communicate())
499        if 'Checksum' in err:  # deal with Checksum problem
500            err = svnChecksumPatch(svn,path2GSAS2,'-rHEAD')
501            if err:
502                print('error from svnChecksumPatch\n\t',err)
503        elif err:
504            print('subversion returned an error:')
505            print(out)
506            print(err)
507            if firstPass == 0: tryagain = True
508        firstPass += 1
509    if err:
510        print('Retrying with a command for older svn version...')
511        cmd = [svn, 'co', g2home+ 'trunk/', path2GSAS2]
512        if proxycmds: cmd += proxycmds
513        msg = ""
514        for item in cmd: msg += " " + item
515        print(msg)
516        s = subprocess.Popen(cmd,stderr=subprocess.PIPE)
517        out,err = MakeByte2str(s.communicate())
518        if err:
519            msg = 'subversion returned an error:\n'
520            msg += err
521            if os.path.exists(os.path.join(path2GSAS2,"makeBat.py")):
522                msg += '\nGSAS-II appears to be installed but failed to be updated. A likely reason'
523                msg += '\nis a network access problem. If your web browser works, but this update did'
524                msg += '\nnot, the most common reason is you need to use a network proxy. Please'
525                msg += '\ncheck with a network administrator or use http://www.whatismyproxy.com/'
526                msg += '\n\nIf installing from the gsas2full dist and your computer is not connected'
527                msg += '\nto the internet, this error message can be ignored.\n'
528            else:
529                # this will happen only with initial installs where all files
530                # are to be downloaded (not gsas2full or updates)
531                msg += '\n\n  *** GSAS-II failed to be installed. A likely reason is a network access'
532                msg += '\n  *** problem, most commonly because you need to use a network proxy. Please'
533                msg += '\n  *** check with a network administrator or use http://www.whatismyproxy.com/\n'
534            BailOut(msg)
535    print('\n'+75*'*')
536
537# subsequent commands require GSASIIpath which better be here now, import it
538try:
539    import GSASIIpath
540    print('import of GSASIIpath completed')
541except Exception as err:
542    msg = 'Failed with import of GSASIIpath. This is unexpected.'
543    msg += '\nGSAS-II will not run without correcting this. Contact toby@anl.gov'
544    BailOut(msg)
545
546if skipDownloadSteps:
547    pass
548elif allBinaries:
549    print('Loading all binaries with command...')
550    if not GSASIIpath.svnSwitchDir('AllBinaries','',g2home+ 'Binaries/',None,True):
551        msg = 'Binary load failed. Subversion problem? Please seek help'
552        BailOut(msg)
553elif numpyVersion:
554    binaryVersion = GSASIIpath.GetBinaryPrefix()+'_n'+numpyVersion
555    if not GSASIIpath.svnSwitchDir('bindist','',g2home+ 'Binaries/'+binaryVersion,None,True):
556        msg = 'Binary load failed with '+binaryVersion+'. Subversion problem? Please seek help'
557        BailOut(msg)
558else:
559    GSASIIpath.DownloadG2Binaries(g2home)
560       
561#===========================================================================
562# test if the compiled files load correctly
563#===========================================================================
564GSASIItested = False
565if not skipInstallChecks:
566    script = """ 
567# commands that test each module can at least be loaded & run something in pyspg
568try:
569    import GSASIIpath
570    GSASIIpath.SetBinaryPath(loadBinary=False)
571    import pyspg
572    import histogram2d
573    import polymask
574    import pypowder
575    import pytexture
576    pyspg.sgforpy('P -1')
577    print('==OK==')
578except Exception as err:
579    print(err)
580"""
581    p = subprocess.Popen([sys.executable,'-c',script],stdout=subprocess.PIPE,stderr=subprocess.PIPE,
582                         cwd=path2GSAS2)
583    res,err = MakeByte2str(p.communicate())
584    if '==OK==' not in str(res) or p.returncode != 0:
585        #print('\n'+75*'=')
586        msg = 'Failed when testing the GSAS-II compiled files. GSAS-II will not run'
587        msg += ' without correcting this.\n\nError message:\n'
588        if res: 
589            msg += res
590            msg += '\n'
591        if err:
592            msg += err
593        #print('\nAttempting to open a web page on compiling GSAS-II...')
594        msg += '\n\nPlease see web page\nhttps://subversion.xray.aps.anl.gov/trac/pyGSAS/wiki/CompileGSASII if you wish to compile for yourself (usually not needed for windows and Mac, but sometimes required for Linux.)'
595        BailOut(msg)
596        #import webbrowser
597        #webbrowser.open_new('https://subversion.xray.aps.anl.gov/trac/pyGSAS/wiki/CompileGSASII')
598        #print(75*'=')
599    #    if '86' in platform.machine() and (sys.platform.startswith('linux')
600    #                                        or sys.platform == "darwin"
601    #                                        or sys.platform.startswith('win')):
602    #        print('Platform '+sys.platform+' with processor type '+platform.machine()+' is supported')
603    #    else:
604    #        print('Platform '+sys.platform+' with processor type '+platform.machine()+' not is supported')
605    else:
606        print('Successfully tested compiled routines')
607        GSASIItested = True
608#===========================================================================
609# import all .py files so that .pyc files get created
610if not skipInstallChecks:
611    print('Byte-compiling all .py files...')
612    import compileall
613    compileall.compile_dir(path2GSAS2,quiet=True)
614    print('done')
615#===========================================================================
616# do platform-dependent stuff
617#===========================================================================
618if sys.version_info[0] > 2:
619    def execfile(file):
620        with open(file) as source_file:
621            exec(source_file.read())
622
623if skipInstallChecks:
624    pass
625#===========================================================================
626# on Windows, make a batch file with Python and GSAS-II location hard-coded
627elif sys.platform.startswith('win') and os.path.exists(
628    os.path.join(path2GSAS2,"makeBat.py")):
629    execfile(os.path.join(path2GSAS2,"makeBat.py"))
630#===========================================================================
631# on a Mac, make an applescript
632elif sys.platform.startswith('darwin') and os.path.exists(
633    os.path.join(path2GSAS2,"makeMacApp.py")):
634    sys.argv = [os.path.join(path2GSAS2,"makeMacApp.py")]
635    print(u'running '+sys.argv[0])
636    execfile(sys.argv[0])
637#===========================================================================
638# On linux, make desktop icon
639elif sys.platform.startswith('linux') and os.path.exists(
640    os.path.join(path2GSAS2,"makeLinux.py")):
641    sys.argv = [os.path.join(path2GSAS2,"makeLinux.py")]
642    print(u'running '+sys.argv[0])
643    execfile(sys.argv[0])
644
Note: See TracBrowser for help on using the repository browser.