Changeset 3828e50 in rtems-tools


Ignore:
Timestamp:
Dec 11, 2015, 6:01:51 AM (4 years ago)
Author:
Chris Johns <chrisj@…>
Branches:
4.10, master
Children:
a6f5f18
Parents:
8b49f73
Message:

VERSION as an INI format file.

One section is supported [version] with a 'release' entry.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • rtemstoolkit/version.py

    r8b49f73 r3828e50  
    4343# Default to an internal string.
    4444#
    45 _version_str = '4.12.not_release'
     45_version = '4.12'
     46_revision = 'not_released'
     47_version_str = '%s.%s' % (_version, _revision)
    4648_released = False
    4749_git = False
     
    5759        if path.exists(path.join(ver, 'VERSION')):
    5860            try:
    59                 with open(path.join(ver, 'VERSION')) as v:
    60                     _version_str = v.readline().strip()
    61                 v.close()
    62                 _released = True
    63             except:
    64                 raise error.general('Cannot access the VERSION file')
     61                import configparser
     62            except ImportError:
     63                import ConfigParser as configparser
     64            v = configparser.SafeConfigParser()
     65            v.read(path.join(ver, 'VERSION'))
     66            _version_str = v.get('version', 'release')
     67            _released = True
    6568    return _released
    6669
     
    7578        else:
    7679            modified = ''
    77         _version_str = '%s (%s%s)' % (_version_str, head[0:12], modified)
     80        _version_str = '%s (%s%s)' % (_version, head[0:12], modified)
    7881        _git = True
    7982    return _git
  • wscript

    r8b49f73 r3828e50  
    4242    if os.path.exists('VERSION'):
    4343        try:
    44             with open('VERSION') as v:
    45                 release = v.readline().strip()
    46             v.close()
    47         except:
    48             ctx.fatal('cannot access the VERSION file')
     44            import configparser
     45        except ImportError:
     46            import ConfigParser as configparser
     47        v = configparser.SafeConfigParser()
     48        v.read('VERSION')
     49        release = v.get('version', 'release')
    4950    else:
    5051        from rtemstoolkit import git
     
    5657            else:
    5758                modified = ''
    58             release = '%s.%s%s)' % (version, head[0:12], modified)
     59            release = '%s.%s%s' % (version, head[0:12], modified)
    5960    last_dot = release.rfind('.')
    6061    if last_dot == -1:
Note: See TracChangeset for help on using the changeset viewer.