Ignore:
Timestamp:
Nov 2, 2020 9:42:45 PM (12 months ago)
Author:
toby
Message:

workarounds for Mac svn checksum problem

File:
1 edited

Legend:

Unmodified
Added
Removed
  • install/g2complete/src/bootstrap.py

    r4446 r4640  
    120120    '''
    121121    if isinstance(arg,str): return arg
    122     if isinstance(arg,bytes): return arg.decode()
     122    if isinstance(arg,bytes):
     123        try:
     124            return arg.decode()
     125        except:
     126            print('Decode error')
     127            return arg
    123128    if isinstance(arg,list):
    124129        return [MakeByte2str(i) for i in arg]
     
    242247    M,m = ver.split('.')[:2]
    243248    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
    244289
    245290################################################################################
     
    452497        print('\nsubversion output:')
    453498        out,err = MakeByte2str(s.communicate())
    454         if err:
     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:
    455504            print('subversion returned an error:')
    456505            print(out)
Note: See TracChangeset for help on using the changeset viewer.