summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2011-02-28 12:32:02 +0100
committerJelmer Vernooij <jelmer@samba.org>2011-02-28 12:32:02 +0100
commit60c6049e12e9b86b6b1bc4ba65e101c80f2d237b (patch)
tree5234a26bf6ef97bfce27daa4a8747edb34194c26 /setup.py
parenta8200b24700b372eab579ca9144ea2ff6fa4b814 (diff)
downloadtesttools-60c6049e12e9b86b6b1bc4ba65e101c80f2d237b.tar.gz
Support building a snapshot from something that is not a bzr working tree.
Diffstat (limited to 'setup.py')
-rwxr-xr-xsetup.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/setup.py b/setup.py
index 9ea67b5..aa35993 100755
--- a/setup.py
+++ b/setup.py
@@ -7,10 +7,16 @@ import os
import testtools
+
def get_revno():
+ import bzrlib.errors
import bzrlib.workingtree
- t = bzrlib.workingtree.WorkingTree.open_containing(__file__)[0]
- return t.branch.revno()
+ try:
+ t = bzrlib.workingtree.WorkingTree.open_containing(__file__)[0]
+ except bzrlib.errors.NotBranchError:
+ return None
+ else:
+ return t.branch.revno()
def get_version_from_pkg_info():
@@ -38,6 +44,8 @@ def get_version():
if pkg_info_version:
return pkg_info_version
revno = get_revno()
+ if revno is None:
+ return "snapshot"
if phase == 'alpha':
# No idea what the next version will be
return 'next-r%s' % revno