def git_version(file): '''Fetch from Git: {tag} {distance-from-tag} {current commit hash} Return as semantic version string compliant with PEP440''' root = os.path.dirname(os.path.realpath(file)) tag, distance, commit = g.gitDescribe(root) # 5.6b2, 55, e1129da ctag = clean_git_tag(tag) version = get_semver(ctag) if int(distance) > 0: version = '{}-dev{}'.format(version, distance) return version
def git_version(file, version=None): '''Fetch from Git: {tag} {distance-from-tag} {current commit hash} Return as semantic version string compliant with PEP440''' root = os.path.dirname(os.path.realpath(file)) try: tag, distance, commit = g.gitDescribe(root) # 5.6b2, 55, e1129da ctag = clean_git_tag(tag) #version = get_semver(ctag) version = ctag if int(distance) > 0: version = '{}-dev{}'.format(version, distance) except IndexError: print('Attempt to `git describe` failed with IndexError') except FileNotFoundError: print('Attempt to `git describe` failed with FileNotFoundError') return version
def git_version(): ''' Fetch from Git: {tag} {distance-from-tag} {current commit hash} Increment minor # by 1 and Return as single string compliant with PEP440 ''' root = os.path.dirname(os.path.realpath(__file__)) tag, distance, commit = g.gitDescribe(root) # 5.6, 55, e1129da major, minor = tag.split('.') minor = int(minor) + 1 # version = '{}.{}.dev{}+{}'.format(major, minor, distance, commit) # # 5.7.dev55+e1129da # disabled. Can't use local PEP440 names on pypi! # https://github.com/pypa/pypi-legacy/issues/731 version = '{}.{}.dev{}'.format(major, minor, distance) # 5.7.dev55 return version
def git_version(file): ''' Fetch from Git: {tag} {distance-from-tag} {current commit hash} Increment minor # by 1 and Return as single string compliant with PEP440 ''' root = os.path.dirname(os.path.realpath(file)) tag, distance, commit = g.gitDescribe(root) # 5.6, 55, e1129da semver = semantic_version.Version.coerce(tag, partial=True) #major, minor = semver.split('.') #minor = int(minor) + 1 # version = '{}.{}.dev{}+{}'.format(major, minor, distance, commit) # # 5.7.dev55+e1129da # disabled. Can't use local PEP440 names on pypi! # https://github.com/pypa/pypi-legacy/issues/731 version = '{}.{}.dev{}'.format(semver.major, semver.minor, distance) # 5.7.dev55 return version