From 67c82c0b7edc1e7012a5e2c6959b468abc69b7df Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Mon, 25 Jun 2012 13:08:20 -0700 Subject: Use the new tool created to get the version. --- setup.py | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/setup.py b/setup.py index 81468943..59548a41 100755 --- a/setup.py +++ b/setup.py @@ -27,26 +27,17 @@ import re import setuptools +import subprocess + def is_f(p): return os.path.isfile(p) -def versions(fn="ChangeLog"): - with open(fn, 'r') as fh: - lines = fh.read().splitlines() - versions = [] - for line in lines: - line = line.strip() - if line.startswith("-") or not line: - continue - if not re.match(r"[\d]", line): - continue - line = line.strip(":") - if (re.match(r"^[\d+]\.[\d+]\.[\d+]$", line) or - re.match(r"^[\d+]\.[\d+]$", line)): - versions.append(line) - return versions +def get_version(): + cmd = ['tools/read-version'] + ver = subprocess.check_output(cmd) + return ver.strip() def requires(fn='Requires'): @@ -63,7 +54,7 @@ def requires(fn='Requires'): setuptools.setup(name='cloud-init', - version=versions()[0], + version=get_version(), description='EC2 initialisation magic', author='Scott Moser', author_email='scott.moser@canonical.com', -- cgit v1.2.3