Changeset 4439


Ignore:
Timestamp:
May 26, 2020 9:34:42 AM (5 years ago)
Author:
toby
Message:

bootstrap w/selected binary; update svn switch cmd; save build output

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified install/g2complete/build.sh

    r3924 r4439  
    88mkdir -p $PREFIX/GSASII
    99cp $RECIPE_DIR/src/bootstrap.py $PREFIX/GSASII
    10 python $PREFIX/GSASII/bootstrap.py --noproxy --noinstall
     10python $PREFIX/GSASII/bootstrap.py --binary=1.18 >> $HOME/build_log.txt
  • TabularUnified install/g2complete/meta.yaml.template

    r4407 r4439  
    1818    - pillow
    1919    - pyopengl
    20     - wxpython>=4.0
     20    - wxpython>=4.
    2121    - svn
    2222    - hdf5
  • TabularUnified install/g2complete/src/bootstrap.py

    r4376 r4439  
    99path2GSAS2 = os.path.dirname(os.path.abspath(os.path.expanduser(__file__)))
    1010
    11 skipInstallSteps = False
    12 skipDownloadSteps = False
    13 skipProxy = False
    14 showWXerror = False
    15 help = False
    16 allBinaries = False
     11skipInstallChecks = False  # if set to True, continue installation even if current Python lacks packages and
     12                           # skips platform-dependent installation steps
     13skipDownloadSteps = False  # if False, svn is used to download GSAS-II files and binaries
     14skipProxy = False          # if False then the script creates a prompt asking for proxy info
     15showWXerror = False        # if True, errors are shown in wxPython windows (used on Windows only)
     16help = False               # if True, a help message is shown
     17allBinaries = False        # if True, causes all binaries to be installed
     18binaryVersion=None         # if specified, gives a specific numpy version to use (such as 1.18)
     19                           # for selecting a set of binaries to use
     20
    1721for a in sys.argv[1:]:
    1822    if 'noinstall' in a.lower():
    19         skipInstallSteps = True
     23        skipInstallChecks = True
    2024        if sys.platform.startswith('win'): showWXerror = True
    2125    elif 'nonet' in a.lower():
     
    2428    elif 'noproxy' in a.lower():
    2529        skipProxy = True
    26     elif 'help' in a.lower():
    27         help = True
    2830    elif 'allbin' in a.lower() or 'server' in a.lower():
    2931        allBinaries = True
     32    elif 'binary' in a.lower():
     33        numpyVersion = a.split('=')[1]
     34        skipInstallChecks = True
     35        if sys.platform.startswith('win'): showWXerror = True
     36        skipProxy = True
    3037    else:
     38        help = True
     39    if 'help' in a.lower():
    3140        help = True
    3241
     
    3544  bootstrap.py options:
    3645
    37     --noinstall skip post-install, such as creating run shortcuts
    38     --noproxy   do not ask for proxy information
    39     --server    load all binary versions
    40     --allbin    load all binary versions (same as --server)
    41     --help      this message
    42     --nonet     skip steps requiring internet
    43 
     46    --noinstall   skip post-install, such as creating run shortcuts, turns on
     47                  wxpython error display in Windows
     48    --noproxy     do not ask for proxy information
     49    --server      load all binary versions
     50    --allbin      load all binary versions (same as --server)
     51    --help        this message
     52    --nonet       skip steps requiring internet
     53    --binary=ver  specifies a specific numpy binary directory to use (such as
     54                  --binary=1.18); turns on --noinstall and --noproxy
    4455''')
    4556    sys.exit()
     
    4758now = str(datetime.datetime.now())
    4859print('Running bootstrap from {} at {}\n\tId: {}'.format(path2GSAS2,now,version))
     60print ("Python:     %s"%sys.version.split()[0])
     61try:
     62    import numpy as np
     63    print ("numpy:      %s"%np.__version__)
     64except:
     65    pass
    4966fp = open(os.path.join(path2GSAS2,'bootstrap.log'),'a')
    5067fp.write('Running bootstrap from {} at {}\n\tId: {}\n'.format(path2GSAS2,now,version))
     
    251268        missing.append(pkg)
    252269
    253 if missing and not skipInstallSteps:
     270if missing and not skipInstallChecks:
    254271    msg = """Sorry, this version of Python cannot be used
    255272for GSAS-II. It is missing the following package(s):
     
    379396    except Exception as err:
    380397        print('Error writing file {}:\n{}'.format(proxyinfo,err))
     398       
    381399if not skipDownloadSteps:
    382400    # patch: switch GSAS-II location if linked to XOR server (relocated May/June 2017)
     
    465483    print('\n'+75*'*')
    466484
     485# subsequent commands require GSASIIpath which better be here now, import it
    467486try:
    468487    import GSASIIpath
     
    473492    BailOut(msg)
    474493
    475 if allBinaries and not skipDownloadSteps:
     494if skipDownloadSteps:
     495    pass
     496elif allBinaries:
    476497    print('Loading all binaries with command...')
    477498    if not GSASIIpath.svnSwitchDir('AllBinaries','',g2home+ 'Binaries/',None,True):
    478499        msg = 'Binary load failed. Subversion problem? Please seek help'
    479500        BailOut(msg)
     501elif numpyVersion:
     502    binaryVersion = GSASIIpath.GetBinaryPrefix()+'n'+numpyVersion
     503    if not GSASIIpath.svnSwitchDir('bindist','',g2home+ 'Binaries/'+binaryVersion,None,True):
     504        msg = 'Binary load failed with '+binaryVersion+'. Subversion problem? Please seek help'
     505        BailOut(msg)
    480506else:
    481507    GSASIIpath.DownloadG2Binaries(g2home)
     
    484510# test if the compiled files load correctly
    485511#===========================================================================
    486 
    487 script = """  # commands that test each module can at least be loaded & run something in pyspg
    488 try:
    489     import GSASIIpath
    490     GSASIIpath.SetBinaryPath(loadBinary=False)
    491     import pyspg
    492     import histogram2d
    493     import polymask
    494     import pypowder
    495     import pytexture
    496     pyspg.sgforpy('P -1')
    497     print('==OK==')
    498 except Exception as err:
    499     print(err)
    500 """
    501 p = subprocess.Popen([sys.executable,'-c',script],stdout=subprocess.PIPE,stderr=subprocess.PIPE,
    502                      cwd=path2GSAS2)
    503 res,err = MakeByte2str(p.communicate())
    504 if '==OK==' not in str(res) or p.returncode != 0:
    505     #print('\n'+75*'=')
    506     msg = 'Failed when testing the GSAS-II compiled files. GSAS-II will not run'
    507     msg += ' without correcting this.\n\nError message:\n'
    508     if res:
    509         msg += res
    510         msg += '\n'
    511     if err:
    512         msg += err
    513     #print('\nAttempting to open a web page on compiling GSAS-II...')
    514     msg += '\n\nPlease see web page\nhttps://subversion.xray.aps.anl.gov/trac/pyGSAS/wiki/CompileGSASII if you wish to compile for yourself (usually not needed for windows and Mac, but sometimes required for Linux.)'
    515     BailOut(msg)
    516     #import webbrowser
    517     #webbrowser.open_new('https://subversion.xray.aps.anl.gov/trac/pyGSAS/wiki/CompileGSASII')
    518     #print(75*'=')
    519 #    if '86' in platform.machine() and (sys.platform.startswith('linux')
    520 #                                        or sys.platform == "darwin"
    521 #                                        or sys.platform.startswith('win')):
    522 #        print('Platform '+sys.platform+' with processor type '+platform.machine()+' is supported')
    523 #    else:
    524 #        print('Platform '+sys.platform+' with processor type '+platform.machine()+' not is supported')
    525 else:
    526     print('Successfully tested compiled routines')
     512if not skipInstallChecks:
     513    script = """  # commands that test each module can at least be loaded & run something in pyspg
     514    try:
     515        import GSASIIpath
     516        GSASIIpath.SetBinaryPath(loadBinary=False)
     517        import pyspg
     518        import histogram2d
     519        import polymask
     520        import pypowder
     521        import pytexture
     522        pyspg.sgforpy('P -1')
     523        print('==OK==')
     524    except Exception as err:
     525        print(err)
     526    """
     527    p = subprocess.Popen([sys.executable,'-c',script],stdout=subprocess.PIPE,stderr=subprocess.PIPE,
     528                         cwd=path2GSAS2)
     529    res,err = MakeByte2str(p.communicate())
     530    if '==OK==' not in str(res) or p.returncode != 0:
     531        #print('\n'+75*'=')
     532        msg = 'Failed when testing the GSAS-II compiled files. GSAS-II will not run'
     533        msg += ' without correcting this.\n\nError message:\n'
     534        if res:
     535            msg += res
     536            msg += '\n'
     537        if err:
     538            msg += err
     539        #print('\nAttempting to open a web page on compiling GSAS-II...')
     540        msg += '\n\nPlease see web page\nhttps://subversion.xray.aps.anl.gov/trac/pyGSAS/wiki/CompileGSASII if you wish to compile for yourself (usually not needed for windows and Mac, but sometimes required for Linux.)'
     541        BailOut(msg)
     542        #import webbrowser
     543        #webbrowser.open_new('https://subversion.xray.aps.anl.gov/trac/pyGSAS/wiki/CompileGSASII')
     544        #print(75*'=')
     545    #    if '86' in platform.machine() and (sys.platform.startswith('linux')
     546    #                                        or sys.platform == "darwin"
     547    #                                        or sys.platform.startswith('win')):
     548    #        print('Platform '+sys.platform+' with processor type '+platform.machine()+' is supported')
     549    #    else:
     550    #        print('Platform '+sys.platform+' with processor type '+platform.machine()+' not is supported')
     551    else:
     552        print('Successfully tested compiled routines')
    527553#===========================================================================
    528554# import all .py files so that .pyc files get created
    529 if not skipInstallSteps:
     555if not skipInstallChecks:
    530556    print('Byte-compiling all .py files...')
    531557    import compileall
     
    533559    print('done')
    534560#===========================================================================
    535 # platform-dependent stuff
     561# do platform-dependent stuff
    536562#===========================================================================
    537563if sys.version_info[0] > 2:
     
    540566            exec(source_file.read())
    541567
    542 if skipInstallSteps:
     568if skipInstallChecks:
    543569    pass
    544570#===========================================================================
  • TabularUnified trunk/GSASIIpath.py

    r4396 r4439  
    539539    cmd = [svn,'switch',URL,fpath,
    540540           '--non-interactive','--trust-server-cert',
    541            '--accept','theirs-conflict','--force']
     541           '--accept','theirs-conflict','--force','-rHEAD']
    542542    if svnVersionNumber(svn) > 1.6: cmd += ['--ignore-ancestry']
    543543    if proxycmds: cmd += proxycmds
    544     if verbose: print(u"Loading files to "+fpath+u"\n  from "+URL)
     544    if verbose:
     545        print(u"Loading files to "+fpath+u"\n  from "+URL)
    545546    s = subprocess.Popen(cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
    546547    out,err = MakeByte2str(s.communicate())
     
    566567        return False
    567568    if verbose:
    568         print('=== Output from svn switch'+(43*'='))
     569        s = '\nsvn command:  '
     570        for i in cmd: s += i + ' '
     571        print(s)
     572        print('\n=== Output from svn switch'+(43*'='))
    569573        print(out.strip())
    570574        print((70*'=')+'\n')
Note: See TracChangeset for help on using the changeset viewer.