From 3fe50d72e1331018909cca2716d927937a6ca463 Mon Sep 17 00:00:00 2001 From: Steven Dake Date: Tue, 5 Jun 2012 16:07:21 -0700 Subject: [PATCH] add setup.py to heat-jeos command Signed-off-by: Steven Dake --- MANIFEST.in | 8 ---- bin/heat-jeos | 23 ++++++++++- {cfntools => heat_jeos/cfntools}/README | 0 {cfntools => heat_jeos/cfntools}/__init__.py | 0 .../cfntools}/cfn-get-metadata | 0 {cfntools => heat_jeos/cfntools}/cfn-hup | 0 {cfntools => heat_jeos/cfntools}/cfn-init | 0 .../cfntools}/cfn-push-stats | 0 {cfntools => heat_jeos/cfntools}/cfn-signal | 0 .../cfntools}/cfn_helper.py | 0 .../jeos}/F16-i386-cfntools-jeos.tdl | 0 .../jeos}/F16-i386-gold-jeos.tdl | 0 .../jeos}/F16-x86_64-cfntools-jeos.tdl | 0 .../jeos}/F16-x86_64-gold-jeos.tdl | 0 .../jeos}/F17-i386-cfntools-jeos.tdl | 0 .../jeos}/F17-i386-gold-jeos.tdl | 0 .../jeos}/F17-x86_64-cfntools-jeos.tdl | 0 .../jeos}/F17-x86_64-gold-jeos.tdl | 0 .../jeos}/U10-amd64-cfntools-jeos.tdl | 0 setup.py | 41 +++++++++++++++++++ 20 files changed, 62 insertions(+), 10 deletions(-) rename {cfntools => heat_jeos/cfntools}/README (100%) rename {cfntools => heat_jeos/cfntools}/__init__.py (100%) rename {cfntools => heat_jeos/cfntools}/cfn-get-metadata (100%) rename {cfntools => heat_jeos/cfntools}/cfn-hup (100%) rename {cfntools => heat_jeos/cfntools}/cfn-init (100%) rename {cfntools => heat_jeos/cfntools}/cfn-push-stats (100%) rename {cfntools => heat_jeos/cfntools}/cfn-signal (100%) rename {cfntools => heat_jeos/cfntools}/cfn_helper.py (100%) rename {jeos => heat_jeos/jeos}/F16-i386-cfntools-jeos.tdl (100%) rename {jeos => heat_jeos/jeos}/F16-i386-gold-jeos.tdl (100%) rename {jeos => heat_jeos/jeos}/F16-x86_64-cfntools-jeos.tdl (100%) rename {jeos => heat_jeos/jeos}/F16-x86_64-gold-jeos.tdl (100%) rename {jeos => heat_jeos/jeos}/F17-i386-cfntools-jeos.tdl (100%) rename {jeos => heat_jeos/jeos}/F17-i386-gold-jeos.tdl (100%) rename {jeos => heat_jeos/jeos}/F17-x86_64-cfntools-jeos.tdl (100%) rename {jeos => heat_jeos/jeos}/F17-x86_64-gold-jeos.tdl (100%) rename {jeos => heat_jeos/jeos}/U10-amd64-cfntools-jeos.tdl (100%) create mode 100755 setup.py diff --git a/MANIFEST.in b/MANIFEST.in index c688600..e599dfe 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,12 +1,7 @@ -include AUTHORS -include ChangeLog -include HACKING.rst include LICENSE include README.rst include MANIFEST.in pylintrc -include openstack-common.conf include babel.cfg -graft templates include heat/jeos/F16-i386-gold-jeos.tdl include heat/jeos/F17-i386-gold-jeos.tdl include heat/jeos/F16-i386-cfntools-jeos.tdl @@ -23,6 +18,3 @@ include heat/cfntools/cfn-get-metadata include heat/cfntools/cfn-push-stats include heat/cloudinit/config include heat/cloudinit/part-handler.py -include heat/db/sqlalchemy/migrate_repo/migrate.cfg -graft etc -graft docs diff --git a/bin/heat-jeos b/bin/heat-jeos index 7be4cc6..599eef1 100755 --- a/bin/heat-jeos +++ b/bin/heat-jeos @@ -34,6 +34,25 @@ import time from glance.common import exception from glance import client as glance_client +possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), + os.pardir, + os.pardir)) + +jeos_path = '' +cfntools_path = '' +if os.path.exists(os.path.join(possible_topdir, 'heat_jeos', '__init__.py')): + sys.path.insert(0, possible_topdir) + jeos_path = '%s/heat/%s/' % (possible_topdir, "jeos") + cfntools_path = '%s/heat/%s/' % (possible_topdir, "cfntools") + jeos_path = os.path.join(possible_topdir, 'jeos') + cfntools_path = os.path.join(possible_topdir, 'cfntools') +else: + for p in sys.path: + jeos_path = os.path.join(p, 'heat', 'jeos') + cfntools_path = os.path.join(p, 'heat', 'cfntools') + if os.access(jeos_path, os.R_OK): + break + # TODO(shadower): split the options to TDL/image/glance # TODO(shadower): use Oz as a library, don't shell out @@ -127,7 +146,7 @@ def command_all(options, arguments): sys.exit(1) tdl_file = '%s-%s-%s-jeos.tdl' % (distro, arch, instance_type) - tdl_path = os.path.join(options.jeos_dir, tdl_file) + tdl_path = os.path.join(jeos_path, tdl_file) if options.debug: print "Using tdl: %s" % tdl_path @@ -138,7 +157,7 @@ def command_all(options, arguments): cfn_tools = ['cfn-init', 'cfn-hup', 'cfn-signal', 'cfn-get-metadata', 'cfn_helper.py', 'cfn-push-stats'] for cfnname in cfn_tools: - f = open('%s/%s' % (options.cfn_dir, cfnname), 'r') + f = open('%s/%s' % (cfntools_path, cfnname), 'r') cfscript_e64 = base64.b64encode(f.read()) f.close() cfnpath = "/template/files/file[@name='/opt/aws/bin/%s']" % cfnname diff --git a/cfntools/README b/heat_jeos/cfntools/README similarity index 100% rename from cfntools/README rename to heat_jeos/cfntools/README diff --git a/cfntools/__init__.py b/heat_jeos/cfntools/__init__.py similarity index 100% rename from cfntools/__init__.py rename to heat_jeos/cfntools/__init__.py diff --git a/cfntools/cfn-get-metadata b/heat_jeos/cfntools/cfn-get-metadata similarity index 100% rename from cfntools/cfn-get-metadata rename to heat_jeos/cfntools/cfn-get-metadata diff --git a/cfntools/cfn-hup b/heat_jeos/cfntools/cfn-hup similarity index 100% rename from cfntools/cfn-hup rename to heat_jeos/cfntools/cfn-hup diff --git a/cfntools/cfn-init b/heat_jeos/cfntools/cfn-init similarity index 100% rename from cfntools/cfn-init rename to heat_jeos/cfntools/cfn-init diff --git a/cfntools/cfn-push-stats b/heat_jeos/cfntools/cfn-push-stats similarity index 100% rename from cfntools/cfn-push-stats rename to heat_jeos/cfntools/cfn-push-stats diff --git a/cfntools/cfn-signal b/heat_jeos/cfntools/cfn-signal similarity index 100% rename from cfntools/cfn-signal rename to heat_jeos/cfntools/cfn-signal diff --git a/cfntools/cfn_helper.py b/heat_jeos/cfntools/cfn_helper.py similarity index 100% rename from cfntools/cfn_helper.py rename to heat_jeos/cfntools/cfn_helper.py diff --git a/jeos/F16-i386-cfntools-jeos.tdl b/heat_jeos/jeos/F16-i386-cfntools-jeos.tdl similarity index 100% rename from jeos/F16-i386-cfntools-jeos.tdl rename to heat_jeos/jeos/F16-i386-cfntools-jeos.tdl diff --git a/jeos/F16-i386-gold-jeos.tdl b/heat_jeos/jeos/F16-i386-gold-jeos.tdl similarity index 100% rename from jeos/F16-i386-gold-jeos.tdl rename to heat_jeos/jeos/F16-i386-gold-jeos.tdl diff --git a/jeos/F16-x86_64-cfntools-jeos.tdl b/heat_jeos/jeos/F16-x86_64-cfntools-jeos.tdl similarity index 100% rename from jeos/F16-x86_64-cfntools-jeos.tdl rename to heat_jeos/jeos/F16-x86_64-cfntools-jeos.tdl diff --git a/jeos/F16-x86_64-gold-jeos.tdl b/heat_jeos/jeos/F16-x86_64-gold-jeos.tdl similarity index 100% rename from jeos/F16-x86_64-gold-jeos.tdl rename to heat_jeos/jeos/F16-x86_64-gold-jeos.tdl diff --git a/jeos/F17-i386-cfntools-jeos.tdl b/heat_jeos/jeos/F17-i386-cfntools-jeos.tdl similarity index 100% rename from jeos/F17-i386-cfntools-jeos.tdl rename to heat_jeos/jeos/F17-i386-cfntools-jeos.tdl diff --git a/jeos/F17-i386-gold-jeos.tdl b/heat_jeos/jeos/F17-i386-gold-jeos.tdl similarity index 100% rename from jeos/F17-i386-gold-jeos.tdl rename to heat_jeos/jeos/F17-i386-gold-jeos.tdl diff --git a/jeos/F17-x86_64-cfntools-jeos.tdl b/heat_jeos/jeos/F17-x86_64-cfntools-jeos.tdl similarity index 100% rename from jeos/F17-x86_64-cfntools-jeos.tdl rename to heat_jeos/jeos/F17-x86_64-cfntools-jeos.tdl diff --git a/jeos/F17-x86_64-gold-jeos.tdl b/heat_jeos/jeos/F17-x86_64-gold-jeos.tdl similarity index 100% rename from jeos/F17-x86_64-gold-jeos.tdl rename to heat_jeos/jeos/F17-x86_64-gold-jeos.tdl diff --git a/jeos/U10-amd64-cfntools-jeos.tdl b/heat_jeos/jeos/U10-amd64-cfntools-jeos.tdl similarity index 100% rename from jeos/U10-amd64-cfntools-jeos.tdl rename to heat_jeos/jeos/U10-amd64-cfntools-jeos.tdl diff --git a/setup.py b/setup.py new file mode 100755 index 0000000..e65a02d --- /dev/null +++ b/setup.py @@ -0,0 +1,41 @@ +#!/usr/bin/python +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import gettext +import os +import subprocess + +import setuptools + +setuptools.setup( + name='heat_jeos', + version='1', + description='The heat-jeos project provides services for creating ' + '(J)ust (E)nough (O)perating (S)ystem images', + license='Apache License (2.0)', + author='Heat API Developers', + author_email='discuss@heat-api.org', + url='http://heat-api.org.org/', + packages=setuptools.find_packages(exclude=['bin']), + include_package_data=True, + classifiers=[ + 'Development Status :: 4 - Beta', + 'License :: OSI Approved :: Apache Software License', + 'Operating System :: POSIX :: Linux', + 'Programming Language :: Python :: 2.6', + 'Environment :: No Input/Output (Daemon)', + ], + scripts=['bin/heat-jeos'], + py_modules=[])