Changeset 3bd8def in rtems-tools for wscript


Ignore:
Timestamp:
Oct 3, 2018, 1:38:09 AM (13 months ago)
Author:
Chris Johns <chrisj@…>
Branches:
master
Children:
36fde51
Parents:
5416cfa
Message:

config: Consolidate the version information into a single configuration file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wscript

    r5416cfa r3bd8def  
    4141
    4242def get_version(ctx):
    43     version = '5'
    44     revision = 'not_released'
     43    from rtemstoolkit import version as rtemsversion
     44    try:
     45        version = rtemsversion.version()
     46        revision = rtemsversion.revision()
     47    except Exception as e:
     48        ctx.fatal('invalid version file: %s' % (e))
    4549    release = '%s.%s' % (version, revision)
    46     if os.path.exists('VERSION'):
    47         try:
    48             import configparser
    49         except ImportError:
    50             import ConfigParser as configparser
    51         v = configparser.SafeConfigParser()
    52         v.read('VERSION')
    53         release = v.get('version', 'release')
    54     else:
    55         #
    56         # waf after 1.9.9 does not place the current directory in Python's
    57         # system path which means importing the RTEMS toolkit
    58         # fails. Temporarily add it so we can import the git module.
    59         #
    60         import sys
    61         current_sys_path = sys.path
    62         try:
    63             sys.path = [os.getcwd()] + sys.path
    64             from rtemstoolkit import git
    65         finally:
    66             sys.path = current_sys_path
    67         repo = git.repo('.')
    68         if repo.valid():
    69             head = repo.head()
    70             if repo.dirty():
    71                 modified = '_modified'
    72             else:
    73                 modified = ''
    74             release = '%s.%s%s' % (version, head[0:12], modified)
    75     last_dot = release.rfind('.')
    76     if last_dot == -1:
    77         ctx.fatal('invalid VERSION file')
    78     revision = release[0:last_dot]
    79     return revision, release
     50    return version, release
    8051
    8152def recurse(ctx):
Note: See TracChangeset for help on using the changeset viewer.