Changeset 1233 for gsas/linux


Ignore:
Timestamp:
May 21, 2013 5:21:18 PM (9 years ago)
Author:
toby
Message:

add proxy support

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gsas/linux/dist/bootstrap.py

    r966 r1233  
    22import os, stat, sys, platform, subprocess
    33home = 'https://subversion.xor.aps.anl.gov/EXPGUI/'
    4 
    5 print sys.argv
     4proxycmds = []
     5if os.path.exists("proxyinfo.txt"):
     6    os.remove("proxyinfo.txt")
     7ans = raw_input("Enter the proxy address [none needed]: ")
     8if ans.strip() != "":
     9    proxycmds.append('--config-option')
     10    proxycmds.append('servers:global:http-proxy-host='+ans.strip())
     11    fp = open("proxyinfo.txt",'w')
     12    fp.write(ans.strip()+'\n')
     13    ans = raw_input("Enter the proxy port [8080]: ")
     14    if ans.strip() == "": ans="8080"
     15    proxycmds.append('--config-option')
     16    proxycmds.append('servers:global:http-proxy-port='+ans.strip())
     17    fp.write(ans.strip()+'\n')
     18    fp.close()
    619gsaspath = os.path.split(sys.argv[0])[0]
    720gsaspath = os.path.abspath(os.path.expanduser(gsaspath))
    8 
    921print 'GSAS is being bootstrapped from repository to '+gsaspath
    10 
    1122print 'Determining system type...',
    12 if sys.platform.startswith('linux') and platform.processor().endswith('86'):
     23if sys.platform.startswith('linux'):
     24    if platform.processor().find('86') <= -1:
     25        ans = raw_input("Note, GSAS requires an Intel-compatible processor and 32-bit"
     26                        "libraries.\nAre you sure want to continue? [Yes]/no: ")
     27        if ans.lower().find('no') > -1: sys.exit()
    1328    repos = 'linux'
     29    print 'Linux, Intel-compatible'
    1430elif sys.platform == "darwin" and platform.processor() == 'i386':
    1531    repos = 'osxi86'
     32    print 'Mac OS X, Intel-compatible'
     33elif sys.platform == "darwin":
     34    repos = 'osxppc'
     35    print 'Mac OS X, PowerPC'
    1636else:
    1737    raise Exception('Undefined system type')
     
    2040print 'Checking for subversion...',
    2141try:
    22     #p = subprocess.call(['svn','status'],stdout=subprocess.PIPE)
    2342    p = subprocess.Popen(['svn','help'],stdout=subprocess.PIPE)
    2443except:
     
    3756    print 70*'*'
    3857    print msg + ' from ' + cmd[2]
     58    cmd += proxycmds
    3959    for item in cmd: print item,
    4060    print ""
    4161    p = subprocess.call(cmd)
    4262
    43 if sys.platform.startswith('linux') and platform.processor().endswith('86'):
     63if sys.platform.startswith('linux'):
    4464    os.chmod(gsaspath + "/expgui/expgui",
    4565             stat.S_IXUSR | stat.S_IRUSR | stat.S_IRGRP | stat.S_IXGRP | stat.S_IXOTH)
    46     open(os.path.expanduser('~/Desktop/EXPGUI.desktop'),'w').write('''
     66    if os.path.exists(os.path.expanduser('~/Desktop/')):
     67        open(os.path.expanduser('~/Desktop/EXPGUI.desktop'),'w').write('''
    4768[Desktop Entry]
    4869Encoding=UTF-8
     
    5475Icon=%s/EXPGUI.png
    5576''' % (gsaspath,gsaspath))
    56     os.chmod(os.path.expanduser('~/Desktop/EXPGUI.desktop'),
    57               stat.S_IWUSR | stat.S_IXUSR | stat.S_IRUSR | stat.S_IRGRP | stat.S_IXGRP | stat.S_IXOTH)
    58     open(os.path.expanduser('~/Desktop/GSAS.desktop'),'w').write('''
     77        os.chmod(os.path.expanduser('~/Desktop/EXPGUI.desktop'),
     78                 stat.S_IWUSR | stat.S_IXUSR | stat.S_IRUSR | stat.S_IRGRP | stat.S_IXGRP | stat.S_IXOTH)
     79        open(os.path.expanduser('~/Desktop/GSAS.desktop'),'w').write('''
    5980[Desktop Entry]
    6081Encoding=UTF-8
     
    6687Icon=%s/GSAS.png
    6788''' % (gsaspath,gsaspath))
    68     os.chmod(os.path.expanduser('~/Desktop/GSAS.desktop'),
    69               stat.S_IWUSR | stat.S_IXUSR | stat.S_IRUSR | stat.S_IRGRP | stat.S_IXGRP | stat.S_IXOTH)
     89        os.chmod(os.path.expanduser('~/Desktop/GSAS.desktop'),
     90                 stat.S_IWUSR | stat.S_IXUSR | stat.S_IRUSR | stat.S_IRGRP | stat.S_IXGRP | stat.S_IXOTH)
Note: See TracChangeset for help on using the changeset viewer.