Changeset 4346


Ignore:
Timestamp:
Mar 6, 2020 5:17:15 PM (20 months ago)
Author:
toby
Message:

implement additional proxy access (documented in https://subversion.xray.aps.anl.gov/trac/pyGSAS/wiki/ProxyInfo)

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIdataGUI.py

    r4334 r4346  
    21232123        '''Edit the proxy information used by subversion
    21242124        '''
    2125         h,p = host,port = GSASIIpath.getsvnProxy()
     2125        h,p,e = host,port,etc = GSASIIpath.getsvnProxy()
     2126        if e:
     2127            proxyinfo = os.path.join(GSASIIpath.path2GSAS2,"proxyinfo.txt")
     2128            G2G.G2MessageBox(self,'File {} has manually-'.format(proxyinfo)+
     2129                'entered information. Please edit this by hand',
     2130                                 'Unable to edit')
     2131            return
    21262132        dlg = G2G.MultiStringDialog(self,'Enter proxy values',
    21272133                                        ['Proxy address','proxy port'],
    21282134                                        [host,port],size=300)
    2129         #dlg.SetSize((300,-1))
    21302135        if dlg.Show():
    21312136            h,p = dlg.GetValues()
  • trunk/GSASIIpath.py

    r4213 r4346  
    170170        fp = open(proxyinfo,'r')
    171171        host = fp.readline().strip()
     172        # allow file to begin with comments
     173        while host.startswith('#'):
     174            host = fp.readline().strip()
    172175        port = fp.readline().strip()
     176        etc = []
     177        line = fp.readline()
     178        while line:
     179            etc.append(line.strip())
     180            line = fp.readline()
    173181        fp.close()
    174         setsvnProxy(host,port)
     182        setsvnProxy(host,port,etc)
    175183        if not host.strip(): return '',''
    176         return host,port
    177     return '',''
    178 
    179 def setsvnProxy(host,port):
     184        return host,port,etc
     185    return '','',''
     186
     187def setsvnProxy(host,port,etc=[]):
    180188    '''Sets the svn commands needed to use a proxy
    181189    '''
     
    184192    host = host.strip()
    185193    port = port.strip()
    186     if not host: return
    187     proxycmds.append('--config-option')
    188     proxycmds.append('servers:global:http-proxy-host='+host)
     194    if host:
     195        proxycmds.append('--config-option')
     196        proxycmds.append('servers:global:http-proxy-host='+host)
    189197    if port:
    190198        proxycmds.append('--config-option')
    191199        proxycmds.append('servers:global:http-proxy-port='+port)
     200    for item in etc:
     201        proxycmds.append(item)
    192202       
    193203def whichsvn():
     
    206216    svnprog = 'svn'
    207217    if sys.platform.startswith('win'): svnprog += '.exe'
    208     host,port = getsvnProxy()
     218    host,port,etc = getsvnProxy()
    209219    if GetConfigValue('debug') and host:
    210220        print('DBG_Using proxy host {} port {}'.format(host,port))
     
    333343        cmd += ['--non-interactive', '--trust-server-cert']
    334344    if proxycmds: cmd += proxycmds
     345    # if GetConfigValue('debug'):
     346    #     s = 'subversion command:\n  '
     347    #     for i in cmd: s += i + ' '
     348    #     print(s)
    335349    s = subprocess.Popen(cmd, stdout=subprocess.PIPE,stderr=subprocess.PIPE)
    336350    out,err = MakeByte2str(s.communicate())
     
    429443        cmd += ['--trust-server-cert']
    430444    if proxycmds: cmd += proxycmds
     445    #if verbose or GetConfigValue('debug'):
    431446    if verbose:
    432447        s = 'subversion command:\n  '
Note: See TracChangeset for help on using the changeset viewer.