Make version strings PEP440 compliant

This commit is contained in:
Luke Campagnola 2016-09-21 17:40:40 -07:00
parent 8bd940489b
commit 1899fb0473
2 changed files with 28 additions and 11 deletions

View File

@ -16,6 +16,8 @@ pyqtgraph-0.10.0 [unreleased]
the color every time the text is changed.
- FFT plots skip first sample if x-axis uses log scaling
- Multiprocessing system adds bytes and unicode to the default list of no-proxy data types
- Version number scheme changed to be PEP440-compliant (only affects installations from non-
release git commits)
Bugfixes:
- Fix for numpy API change that caused casting errors for inplace operations

View File

@ -358,18 +358,33 @@ def getGitVersion(tagPrefix):
if not os.path.isdir(os.path.join(path, '.git')):
return None
gitVersion = check_output(['git', 'describe', '--tags']).strip().decode('utf-8')
v = check_output(['git', 'describe', '--tags', '--dirty', '--match=%s*'%tagPrefix]).strip().decode('utf-8')
# any uncommitted modifications?
# chop off prefix
assert v.startswith(tagPrefix)
v = v[len(tagPrefix):]
# split up version parts
parts = v.split('-')
# has working tree been modified?
modified = False
status = check_output(['git', 'status', '--porcelain'], universal_newlines=True).strip().split('\n')
for line in status:
if line != '' and line[:2] != '??':
if parts[-1] == 'dirty':
modified = True
break
parts = parts[:-1]
# have commits been added on top of last tagged version?
# (git describe adds -NNN-gXXXXXXX if this is the case)
local = None
if len(parts) > 2 and re.match(r'\d+', parts[-2]) and re.match(r'g[0-9a-f]{7}', parts[-1]):
local = parts[-1]
parts = parts[:-2]
gitVersion = '-'.join(parts)
if local is not None:
gitVersion += '+' + local
if modified:
gitVersion = gitVersion + '+'
gitVersion += 'm'
return gitVersion
@ -393,11 +408,11 @@ def getVersionStrings(pkg):
"""
## Determine current version string from __init__.py
initVersion = getInitVersion(pkgroot='pyqtgraph')
initVersion = getInitVersion(pkgroot=pkg)
## If this is a git checkout, try to generate a more descriptive version string
try:
gitVersion = getGitVersion(tagPrefix='pyqtgraph-')
gitVersion = getGitVersion(tagPrefix=pkg+'-')
except:
gitVersion = None
sys.stderr.write("This appears to be a git checkout, but an error occurred "