Changeset 4352 for trunk/GSASIIpath.py


Ignore:
Timestamp:
Mar 9, 2020 4:49:58 PM (21 months ago)
Author:
toby
Message:

expand proxy GUI for more lines

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIpath.py

    r4346 r4352  
    164164    '''Loads a proxy for subversion from the file created by bootstrap.py
    165165    '''
    166     proxyinfo = os.path.join(path2GSAS2,"proxyinfo.txt")
    167     if os.path.exists(proxyinfo):
    168         global proxycmds
    169         proxycmds = []
    170         fp = open(proxyinfo,'r')
     166    global proxycmds
     167    proxycmds = []
     168    proxyinfo = os.path.join(os.path.expanduser('~/.G2local/'),"proxyinfo.txt")
     169    if not os.path.exists(proxyinfo):
     170        proxyinfo = os.path.join(path2GSAS2,"proxyinfo.txt")
     171    if not os.path.exists(proxyinfo):
     172        return '','',''
     173    fp = open(proxyinfo,'r')
     174    host = fp.readline().strip()
     175    # allow file to begin with comments
     176    while host.startswith('#'):
    171177        host = fp.readline().strip()
    172         # allow file to begin with comments
    173         while host.startswith('#'):
    174             host = fp.readline().strip()
    175         port = fp.readline().strip()
    176         etc = []
     178    port = fp.readline().strip()
     179    etc = []
     180    line = fp.readline()
     181    while line:
     182        etc.append(line.strip())
    177183        line = fp.readline()
    178         while line:
    179             etc.append(line.strip())
    180             line = fp.readline()
    181         fp.close()
    182         setsvnProxy(host,port,etc)
    183         if not host.strip(): return '',''
    184         return host,port,etc
    185     return '','',''
     184    fp.close()
     185    setsvnProxy(host,port,etc)
     186    return host,port,etc
    186187
    187188def setsvnProxy(host,port,etc=[]):
     
    195196        proxycmds.append('--config-option')
    196197        proxycmds.append('servers:global:http-proxy-host='+host)
    197     if port:
    198         proxycmds.append('--config-option')
    199         proxycmds.append('servers:global:http-proxy-port='+port)
     198        if port:
     199            proxycmds.append('--config-option')
     200            proxycmds.append('servers:global:http-proxy-port='+port)
    200201    for item in etc:
    201202        proxycmds.append(item)
Note: See TracChangeset for help on using the changeset viewer.