summaryrefslogtreecommitdiff
path: root/buildtools
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2010-11-12 17:08:09 +0100
committerJelmer Vernooij <jelmer@samba.org>2010-11-12 17:42:13 +0000
commit80e2adc9c3412ac7d22ef9ebb0c8451768841b08 (patch)
tree04b09c87d7e0cfa43d7c2aedfb5da8a19ab528bd /buildtools
parente3b7ce85e2db8cf09202fc2da843cf043e64e81c (diff)
downloadsamba-80e2adc9c3412ac7d22ef9ebb0c8451768841b08.tar.gz
samba-80e2adc9c3412ac7d22ef9ebb0c8451768841b08.tar.bz2
samba-80e2adc9c3412ac7d22ef9ebb0c8451768841b08.zip
sambaversion.py: Some cleanups, make less git-specific.
Diffstat (limited to 'buildtools')
-rw-r--r--buildtools/wafsamba/samba_version.py40
1 files changed, 22 insertions, 18 deletions
diff --git a/buildtools/wafsamba/samba_version.py b/buildtools/wafsamba/samba_version.py
index 735a70002d..bc3c6ae371 100644
--- a/buildtools/wafsamba/samba_version.py
+++ b/buildtools/wafsamba/samba_version.py
@@ -1,6 +1,7 @@
-import Utils;
+import Utils
class samba_version(object):
+
def __init__(self, version_dict, have_git=False):
'''Determine the version number of samba
@@ -16,7 +17,7 @@ also accepted as dictionary entries here
self.ALPHA_RELEASE=None
self.PRE_RELEASE=None
self.RC_RELEASE=None
- self.IS_GIT_SNAPSHOT=True
+ self.IS_SNAPSHOT=True
self.RELEASE_NICKNAME=None
self.VENDOR_SUFFIX=None
self.VENDOR_PATCH=None
@@ -28,10 +29,12 @@ also accepted as dictionary entries here
setattr(self, a, b)
if self.IS_GIT_SNAPSHOT == "yes":
- self.IS_GIT_SNAPSHOT=True
+ self.IS_SNAPSHOT=True
elif self.IS_GIT_SNAPSHOT == "no":
- self.IS_GIT_SNAPSHOT=False
-
+ self.IS_SNAPSHOT=False
+ else:
+ raise Exception("Unknown value for IS_GIT_SNAPSHOT: %s" % self.IS_GIT_SNAPSHOT)
+
##
## start with "3.0.22"
##
@@ -49,7 +52,7 @@ also accepted as dictionary entries here
SAMBA_VERSION_STRING += self.REVISION
if self.TP_RELEASE is not None:
self.TP_RELEASE = int(self.TP_RELEASE)
- SAMBA_VERSION_STRING += ("tp%u" % self.TP_RELEASE)
+ SAMBA_VERSION_STRING += "tp%u" % self.TP_RELEASE
if self.ALPHA_RELEASE is not None:
self.ALPHA_RELEASE = int(self.ALPHA_RELEASE)
SAMBA_VERSION_STRING += ("alpha%u" % self.ALPHA_RELEASE)
@@ -60,8 +63,8 @@ also accepted as dictionary entries here
self.RC_RELEASE = int(self.RC_RELEASE)
SAMBA_VERSION_STRING += ("rc%u" % self.RC_RELEASE)
- if self.IS_GIT_SNAPSHOT:
- #Get version from GIT
+ if self.IS_SNAPSHOT:
+ # Get version from GIT
if have_git:
git = Utils.cmd_output('git show --pretty=format:"%h%n%ct%n%H%n%cd" --stat HEAD', silent=True)
else:
@@ -70,7 +73,7 @@ also accepted as dictionary entries here
if git == '':
SAMBA_VERSION_STRING += "-GIT-UNKNOWN"
else:
- lines = git.splitlines();
+ lines = git.splitlines()
self.GIT_COMMIT_ABBREV = lines[0]
self.GIT_COMMIT_TIME = lines[1]
self.GIT_COMMIT_FULLREV = lines[2]
@@ -85,7 +88,7 @@ also accepted as dictionary entries here
self.GIT_COMMIT_IS_CLEAN = False
SAMBA_VERSION_STRING += "+"
- self.OFFICIAL_STRING=SAMBA_VERSION_STRING
+ self.OFFICIAL_STRING = SAMBA_VERSION_STRING
if self.VENDOR_SUFFIX is not None:
SAMBA_VERSION_STRING += ("-" + self.VENDOR_SUFFIX)
@@ -102,7 +105,7 @@ also accepted as dictionary entries here
self.RELEASE_NICKNAME = self.RELEASE_NICKNAME
else:
self.STRING_WITH_NICKNAME = self.STRING
-
+
def __str__(self):
string="/* Autogenerated by waf */\n"
string+="#define SAMBA_VERSION_MAJOR %u\n" % self.MAJOR
@@ -157,23 +160,24 @@ also accepted as dictionary entries here
class samba_version_file(samba_version):
+
def __init__(self, version_file, have_git=False):
'''Parse the version information from a VERSION file'''
f = open(version_file, 'r')
version_dict = {}
for line in f:
+ line = line.strip()
+ if line == '':
+ continue
+ if line.startswith("#"):
+ continue
try:
- line = line.strip()
- if line == '':
- continue
- if line.startswith("#"):
- continue
- split_line=line.split("=")
+ split_line = line.split("=")
if split_line[1] != "":
value = split_line[1].strip('"')
version_dict[split_line[0]] = value
except:
print("Failed to parse line %s from %s" % (line, version_file))
raise
-
+
super(samba_version_file, self).__init__(version_dict, have_git=have_git)