Changeset 4640


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

workarounds for Mac svn checksum problem

Files:
5 edited

Legend:

Unmodified
Added
Removed
  • install/bootstrap.py

    r4487 r4640  
    247247    M,m = ver.split('.')[:2]
    248248    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
    249289
    250290################################################################################
     
    457497        print('\nsubversion output:')
    458498        out,err = MakeByte2str(s.communicate())
    459         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:
    460504            print('subversion returned an error:')
    461505            print(out)
  • 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)
  • install/g2pkg/src/bootstrap.py

    r4477 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)
  • trunk/GSASIIdataGUI.py

    r4637 r4640  
    374374    else:
    375375        rev = "SVN version {}".format(rev)
    376     print ("This is GSAS-II revision {} ({})\n".format(
     376    print ("Latest GSAS-II revision (from .py files): {} ({})\n".format(
    377377        GSASIIpath.GetVersionNumber(),rev))
     378    # patch 11/2020: warn if GSASII path has not been updated past v4576.
     379    # For unknown reasons on Mac with gsas2full, there have been checksum
     380    # errors in the .so files that prevented svn from completing updates.
     381    # If GSASIIpath.svnChecksumPatch is not present, then the fix for that
     382    # has not been retrieved, so warn. Keep for a year or so.
     383    try:
     384        GSASIIpath.svnChecksumPatch
     385    except:
     386        print('Warning GSAS-II incompletely updated. Please contact toby@anl.gov')
     387    # end patch
    378388
    379389def warnNumpyVersion(application):
  • trunk/GSASIIpath.py

    r4515 r4640  
    11# -*- coding: utf-8 -*-
     2#GSASIIpath - file location & update routines
     3########### SVN repository information ###################
     4# $Date$
     5# $Author$
     6# $Revision$
     7# $URL$
     8# $Id$
     9########### SVN repository information ###################
    210'''
    311*GSASIIpath: locations & updates*
     
    474482            else:
    475483                return
     484        if 'Checksum' in err:  # deal with Checksum problem
     485            err = svnChecksumPatch(svn,fpath,verstr)
     486            if err:
     487                print('error from svnChecksumPatch\n\t',err)
     488            else:
     489                return
    476490        raise Exception('svn update failed')
    477491    elif verbose:
    478492        print(out)
    479493
     494def svnChecksumPatch(svn,fpath,verstr):
     495    '''This performs a fix when svn cannot finish an update because of
     496    a Checksum mismatch error. This seems to be happening on OS X for
     497    unclear reasons.
     498    '''
     499    print('\nAttempting patch for svn Checksum mismatch error\n')
     500    svnCleanup(fpath)
     501    cmd = ['svn','update','--set-depth','empty',
     502               os.path.join(fpath,'bindist')]
     503    s = subprocess.Popen(cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
     504    out,err = MakeByte2str(s.communicate())
     505    #if err: print('error=',err)
     506    DownloadG2Binaries(g2home,verbose=True)
     507    cmd = ['svn','update','--set-depth','infinity',
     508               os.path.join(fpath,'bindist')]
     509    s = subprocess.Popen(cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
     510    out,err = MakeByte2str(s.communicate())
     511    #if err: print('error=',err)
     512    cmd = [svn,'update',fpath,verstr,
     513                       '--non-interactive',
     514                       '--accept','theirs-conflict','--force']
     515    if svnVersionNumber() >= 1.6:
     516        cmd += ['--trust-server-cert']
     517    if proxycmds: cmd += proxycmds
     518    #print(cmd)
     519    s = subprocess.Popen(cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
     520    out,err = MakeByte2str(s.communicate())
     521    #if err: print('error=',err)
     522    return err
     523       
    480524def svnUpgrade(fpath=os.path.split(__file__)[0]):
    481525    '''This reformats subversion files, which may be needed if an upgrade of subversion is
Note: See TracChangeset for help on using the changeset viewer.