Set version strings to 0.9.8 in source; these will be updated with major releases.
Added tools/setVersion script setup.py now auto-generates version string based on pyqtgraph/__init__ and git info, if available
This commit is contained in:
parent
c1f72b29c6
commit
6ae0892ea0
@ -50,9 +50,9 @@ copyright = '2011, Luke Campagnola'
|
|||||||
# built documents.
|
# built documents.
|
||||||
#
|
#
|
||||||
# The short X.Y version.
|
# The short X.Y version.
|
||||||
version = ''
|
version = '0.9.8'
|
||||||
# The full version, including alpha/beta/rc tags.
|
# The full version, including alpha/beta/rc tags.
|
||||||
release = ''
|
release = '0.9.8'
|
||||||
|
|
||||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||||
# for a list of supported languages.
|
# for a list of supported languages.
|
||||||
|
@ -4,7 +4,7 @@ PyQtGraph - Scientific Graphics and GUI Library for Python
|
|||||||
www.pyqtgraph.org
|
www.pyqtgraph.org
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__version__ = None
|
__version__ = '0.9.8'
|
||||||
|
|
||||||
### import all the goodies and add some helper functions for easy CLI use
|
### import all the goodies and add some helper functions for easy CLI use
|
||||||
|
|
||||||
|
49
setup.py
49
setup.py
@ -1,6 +1,7 @@
|
|||||||
from distutils.core import setup
|
from distutils.core import setup
|
||||||
import distutils.dir_util
|
import distutils.dir_util
|
||||||
import os
|
import os, re
|
||||||
|
from subprocess import check_output
|
||||||
|
|
||||||
## generate list of all sub-packages
|
## generate list of all sub-packages
|
||||||
path = os.path.abspath(os.path.dirname(__file__))
|
path = os.path.abspath(os.path.dirname(__file__))
|
||||||
@ -14,8 +15,52 @@ buildPath = os.path.join(path, 'build')
|
|||||||
if os.path.isdir(buildPath):
|
if os.path.isdir(buildPath):
|
||||||
distutils.dir_util.remove_tree(buildPath)
|
distutils.dir_util.remove_tree(buildPath)
|
||||||
|
|
||||||
|
|
||||||
|
## Determine current version string
|
||||||
|
init = open(os.path.join(path, 'pyqtgraph/__init__.py')).read()
|
||||||
|
m = re.search(r'__version__ = (\S+)\n', init)
|
||||||
|
if m is None:
|
||||||
|
raise Exception("Cannot determine version number!")
|
||||||
|
version = m.group(1).strip('\'\"')
|
||||||
|
|
||||||
|
# If this is a git checkout, append the current commit
|
||||||
|
if os.path.isdir(os.path.join(path, '.git')):
|
||||||
|
def gitCommit(name):
|
||||||
|
commit = check_output(['git', 'show', name], universal_newlines=True).split('\n')[0]
|
||||||
|
assert commit[:7] == 'commit '
|
||||||
|
return commit[7:]
|
||||||
|
|
||||||
|
# Find last tag matching "pyqtgraph-.*"
|
||||||
|
tagNames = check_output(['git', 'tag'], universal_newlines=True).strip().split('\n')
|
||||||
|
while True:
|
||||||
|
if len(tagNames) == 0:
|
||||||
|
raise Exception("Could not determine last tagged version.")
|
||||||
|
lastTagName = tagNames.pop()
|
||||||
|
if re.match(r'pyqtgraph-.*', lastTagName):
|
||||||
|
break
|
||||||
|
|
||||||
|
# is this commit an unchanged checkout of the last tagged version?
|
||||||
|
lastTag = gitCommit(lastTagName)
|
||||||
|
head = gitCommit('HEAD')
|
||||||
|
if head != lastTag:
|
||||||
|
branch = re.search(r'\* (.*)', check_output(['git', 'branch'])).group(1)
|
||||||
|
version = version + "-%s-%s" % (branch, head[:10])
|
||||||
|
|
||||||
|
# any uncommitted modifications?
|
||||||
|
modified = False
|
||||||
|
status = check_output(['git', 'status', '-s'], universal_newlines=True).strip().split('\n')
|
||||||
|
for line in status:
|
||||||
|
if line[:2] != '??':
|
||||||
|
modified = True
|
||||||
|
break
|
||||||
|
|
||||||
|
if modified:
|
||||||
|
version = version + '+'
|
||||||
|
|
||||||
|
print("PyQtGraph version: " + version)
|
||||||
|
|
||||||
setup(name='pyqtgraph',
|
setup(name='pyqtgraph',
|
||||||
version='',
|
version=version,
|
||||||
description='Scientific Graphics and GUI Library for Python',
|
description='Scientific Graphics and GUI Library for Python',
|
||||||
long_description="""\
|
long_description="""\
|
||||||
PyQtGraph is a pure-python graphics and GUI library built on PyQt4/PySide and
|
PyQtGraph is a pure-python graphics and GUI library built on PyQt4/PySide and
|
||||||
|
26
tools/setVersion.py
Normal file
26
tools/setVersion.py
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import re, os, sys
|
||||||
|
|
||||||
|
version = sys.argv[1]
|
||||||
|
|
||||||
|
replace = [
|
||||||
|
("pyqtgraph/__init__.py", r"__version__ = .*", "__version__ = '%s'" % version),
|
||||||
|
#("setup.py", r" version=.*,", " version='%s'," % version), # setup.py automatically detects version
|
||||||
|
("doc/source/conf.py", r"version = .*", "version = '%s'" % version),
|
||||||
|
("doc/source/conf.py", r"release = .*", "release = '%s'" % version),
|
||||||
|
#("tools/debian/control", r"^Version: .*", "Version: %s" % version)
|
||||||
|
]
|
||||||
|
|
||||||
|
path = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')
|
||||||
|
|
||||||
|
for filename, search, sub in replace:
|
||||||
|
filename = os.path.join(path, filename)
|
||||||
|
data = open(filename, 'r').read()
|
||||||
|
if re.search(search, data) is None:
|
||||||
|
print('Error: Search expression "%s" not found in file %s.' % (search, filename))
|
||||||
|
os._exit(1)
|
||||||
|
open(filename, 'w').write(re.sub(search, sub, data))
|
||||||
|
|
||||||
|
print("Updated version strings to %s" % version)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user