Commit 5249c679 authored by Luke Campagnola's avatar Luke Campagnola
Browse files

examples fix -- prevent adding invalid entry to sys.path while searching for pyqtgraph

added script for generating debian changelog from bzr log
parent d5112df8
## make this version of pyqtgraph importable before any others ## make this version of pyqtgraph importable before any others
## we do this to make sure that, when running examples, the correct library
## version is imported (if there are multiple versions present).
import sys, os import sys, os
path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
path.rstrip(os.path.sep) if not hasattr(sys, 'frozen'):
if 'pyqtgraph' in os.listdir(path): path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
sys.path.insert(0, path) ## examples adjacent to pyqtgraph (as in source) path.rstrip(os.path.sep)
elif path.endswith('pyqtgraph'): if 'pyqtgraph' in os.listdir(path):
sys.path.insert(0, os.path.abspath(os.path.join(path, '..'))) ## examples installed inside pyqtgraph package sys.path.insert(0, path) ## examples adjacent to pyqtgraph (as in source tree)
for p in sys.path:
if len(p) < 3:
if path.startswith(p): ## If the example is already in an importable location, promote that location
sys.path.insert(0, p)
## should force example to use PySide instead of PyQt ## should force example to use PySide instead of PyQt
if 'pyside' in sys.argv: if 'pyside' in sys.argv:
from subprocess import check_output
import re, time
def run(cmd):
return check_output(cmd, shell=True)
tags = run('bzr tags')
versions = []
for tag in tags.split('\n'):
if tag.strip() == '':
ver, rev = re.split(r'\s+', tag)
if ver.startswith('pyqtgraph-'):
for i in range(len(versions)-1)[::-1]:
log = run('bzr log -r tag:%s..tag:%s' % (versions[i], versions[i+1]))
changes = []
times = []
inmsg = False
for line in log.split('\n'):
if line.startswith('message:'):
inmsg = True
elif line.startswith('-----------------------'):
inmsg = False
if inmsg:
m = re.match(r'timestamp:\s+(.*)$', line)
if m is not None:
citime = time.strptime(times[0][:-6], '%a %Y-%m-%d %H:%M:%S')
print "python-pyqtgraph (%s-1) UNRELEASED; urgency=low" % versions[i+1].split('-')[1]
print ""
for line in changes:
for n in range(len(line)):
if line[n] != ' ':
n += 1
words = line.split(' ')
nextline = ''
for w in words:
if len(w) + len(nextline) > 79:
print nextline
nextline = (' '*n) + w
nextline += ' ' + w
print nextline
#print '\n'.join(changes)
print ""
print " -- Luke <> %s -0%d00" % (time.strftime('%a, %d %b %Y %H:%M:%S', citime), time.timezone/3600)
#print " -- Luke <> %s -0%d00" % (times[0], time.timezone/3600)
print ""
print """python-pyqtgraph (0.9.0-1) UNRELEASED; urgency=low
* Initial release.
-- Luke <> Thu, 27 Dec 2012 02:46:26 -0500"""
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment