summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2012-06-11 22:15:11 -0700
committerJoshua Harlow <harlowja@yahoo-inc.com>2012-06-11 22:15:11 -0700
commitae765a7182d60e0984b5ebc6684aac895b8f3c8e (patch)
treed075d7792cef506fe57d0092fdb03e73ddc34ad0 /setup.py
parentf061dd55bf755efc6caff4feeb59c62d0c8ae94b (diff)
downloadvyos-cloud-init-ae765a7182d60e0984b5ebc6684aac895b8f3c8e.tar.gz
vyos-cloud-init-ae765a7182d60e0984b5ebc6684aac895b8f3c8e.zip
Update with parsing of a requirments file, changelog for this new refactoring stuff and setup.py for both of those.
Diffstat (limited to 'setup.py')
-rwxr-xr-xsetup.py66
1 files changed, 52 insertions, 14 deletions
diff --git a/setup.py b/setup.py
index f32662b8..96f889d8 100755
--- a/setup.py
+++ b/setup.py
@@ -1,10 +1,12 @@
-#!/usr/bin/python
# vi: ts=4 expandtab
#
# Distutils magic for ec2-init
+#
# Copyright (C) 2009 Canonical Ltd.
+# Copyright (C) 2012 Yahoo! Inc.
#
# Author: Soren Hansen <soren@canonical.com>
+# Author: Joshua Harlow <harlowja@yahoo-inc.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3, as
@@ -17,24 +19,59 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-from distutils.core import setup
+
from glob import glob
-import os.path
-import subprocess
+
+import os
+import re
+
+from distutils.core import setup
+from setuptools import find_packages
+
def is_f(p):
- return(os.path.isfile(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 requires(fn='Requires'):
+ requires = []
+ with open(fn, 'r') as fh:
+ lines = fh.read().splitlines()
+ for line in lines:
+ line = line.strip()
+ if not line or line[0] == '#':
+ continue
+ else:
+ requires.append(line)
+ return requires
+
setup(name='cloud-init',
- version='0.6.3',
+ version=versions()[0],
description='EC2 initialisation magic',
author='Scott Moser',
author_email='scott.moser@canonical.com',
url='http://launchpad.net/cloud-init/',
- packages=['cloudinit', 'cloudinit.CloudConfig' ],
- scripts=['cloud-init.py',
- 'cloud-init-cfg.py',
+ packages=find_packages(),
+ scripts=['bin/cloud-init.py',
+ 'bin/cloud-init-cfg.py',
'tools/cloud-init-per',
],
data_files=[('/etc/cloud', glob('config/*.cfg')),
@@ -42,11 +79,12 @@ setup(name='cloud-init',
('/etc/cloud/templates', glob('templates/*')),
('/etc/init', glob('upstart/*.conf')),
('/usr/share/cloud-init', []),
- ('/usr/lib/cloud-init',
+ ('/usr/lib/cloud-init',
['tools/uncloud-init', 'tools/write-ssh-key-fingerprints']),
- ('/usr/share/doc/cloud-init', filter(is_f,glob('doc/*'))),
- ('/usr/share/doc/cloud-init/examples', filter(is_f,glob('doc/examples/*'))),
- ('/usr/share/doc/cloud-init/examples/seed', filter(is_f,glob('doc/examples/seed/*'))),
+ ('/usr/share/doc/cloud-init', filter(is_f, glob('doc/*'))),
+ ('/usr/share/doc/cloud-init/examples', filter(is_f, glob('doc/examples/*'))),
+ ('/usr/share/doc/cloud-init/examples/seed', filter(is_f, glob('doc/examples/seed/*'))),
('/etc/profile.d', ['tools/Z99-cloud-locale-test.sh']),
],
+ install_requires=requires(),
)