Changeset 4710 for install/setversion.py


Ignore:
Timestamp:
Jan 4, 2021 12:50:48 PM (11 months ago)
Author:
toby
Message:

set package versions from conda versions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • install/setversion.py

    r4705 r4710  
    3434    if line.startswith('Rev'):
    3535        version = line.split()[1].strip()
     36        print ('Version is {}'.format(out))
    3637        break
    3738else:
    3839    print ('Version not found!\nout=%s'%out)
    3940    sys.exit(1)
    40 for fil in 'g2complete/meta.yaml','g2full/construct.yaml':
    41     fp = open(fil+'.template','r')
    42     out = fp.read().replace('**Version**',version)
     41
     42import numpy as np
     43import wx
     44import matplotlib as mpl
     45import platform
     46npversion = np.__version__[:np.__version__.find('.',2)]
     47#wxversion = wx.__version__[:wx.__version__.find('.',2)]
     48wxversion = wx.__version__
     49mplversion = mpl.__version__[:mpl.__version__.find('.',2)]
     50pyversion = platform.python_version()
     51if pyversion.find('.',2) > 0: pyversion = pyversion[:pyversion.find('.',2)]
     52print ('SVN version is    {}'.format(version))
     53print ('python version is {}'.format(pyversion))
     54print ('numpy version is  {}'.format(npversion))
     55print ('wx version is     {}'.format(wxversion))
     56print ('MPL version is    {}'.format(mplversion))
     57
     58for fil in ('g2complete/meta.yaml','g2complete/build.sh',
     59                'g2complete/bld.bat',
     60                'g2full/construct.yaml',
     61                ):
     62    try:
     63        fp = open(fil+'.template','r')
     64        out = fp.read().replace('**Version**',version)
     65        fp.close()
     66    except FileNotFoundError:
     67        print('Skipping ',fil)
     68        continue
    4369    if sys.platform == "win32" and platform.architecture()[0] != '64bit':
    4470        print('changing for 32-bit windows')
    4571        out = out.replace('win-64','win-32')
    46     if sys.platform == "win32" and platform.architecture()[0] != '32bit':
     72    if sys.platform.startswith("linux") and platform.architecture()[0] != '32bit':
    4773        print('changing for 32-bit linux')
    4874        out = out.replace('linux-64','linux-32')
    49     fp.close()
     75    out = out.replace('**pyversion**',pyversion)
     76    out = out.replace('**npversion**',npversion)
     77    out = out.replace('**wxversion**',wxversion)
     78    out = out.replace('**mplversion**',mplversion)
    5079    print('Creating',fil)
    5180    fp = open(fil,'w')
Note: See TracChangeset for help on using the changeset viewer.