Changeset 2244c9b in rtems-tools


Ignore:
Timestamp:
Dec 11, 2015, 6:01:51 AM (4 years ago)
Author:
Chris Johns <chrisj@…>
Branches:
4.11
Children:
16b33b6
Parents:
7279748
git-author:
Chris Johns <chrisj@…> (12/11/15 06:01:51)
git-committer:
Chris Johns <chrisj@…> (12/11/15 06:04:46)
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

    r7279748 r2244c9b  
    4343# Default to an internal string.
    4444#
    45 _version_str = '4.11.not_release'
     45_version = '4.11'
     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

    r7279748 r2244c9b  
    4040    if os.path.exists('VERSION'):
    4141        try:
    42             with open('VERSION') as v:
    43                 release = v.readline().strip()
    44             v.close()
    45         except:
    46             ctx.fatal('cannot access the VERSION file')
     42            import configparser
     43        except ImportError:
     44            import ConfigParser as configparser
     45        v = configparser.SafeConfigParser()
     46        v.read('VERSION')
     47        release = v.get('version', 'release')
     48    else:
     49        from rtemstoolkit import git
     50        repo = git.repo('.')
     51        if repo.valid():
     52            head = repo.head()
     53            if repo.dirty():
     54                modified = '_modified'
     55            else:
     56                modified = ''
     57            release = '%s.%s%s' % (version, head[0:12], modified)
    4758    last_dot = release.rfind('.')
    4859    if last_dot == -1:
Note: See TracChangeset for help on using the changeset viewer.