Setup and install improvements

* Cleaned up setup.py post install
* Moved version from cloudroast init to setup.py

Change-Id: If32781cd4e13a06d202bc8795999ac7bdbf685df
This commit is contained in:
Jose Idar 2013-08-26 18:39:42 -05:00
parent 0367060a11
commit a89ab7ef5f
2 changed files with 29 additions and 36 deletions

View File

@ -15,8 +15,6 @@ limitations under the License.
"""
__title__ = 'cloudroast'
__version__ = '0.0.1'
#__build__ = 0x010100
__author__ = 'Rackspace Cloud QE'
__license__ = 'Internal Only'
__license__ = 'Apache License Version 2.0'
__copyright__ = 'Copyright 2013 Rackspace Inc.'

View File

@ -17,11 +17,13 @@ limitations under the License.
import os
import sys
import cloudroast
try:
from setuptools import setup, find_packages
from setuptools.command.install import install as _install
except ImportError:
from distutils.core import setup, find_packages
from distutils.command.install import install as _install
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
@ -29,9 +31,31 @@ if sys.argv[-1] == 'publish':
requires = open('pip-requires').readlines()
#Post-install engine configuration
def _post_install(dir):
print('\n'.join(["\t\t (----) (----)--)",
"\t\t (--(----) (----) --)",
"\t\t (----) (--(----) (----)",
"\t\t -----------------------",
"\t\t \ /",
"\t\t \ /",
"\t\t \_________________/",
"\t\t === CloudRoast ===",
"\t\t= A CloudCAFE Test Repository ="]))
#cmdclass hook allows setup to make post install call
class install(_install):
def run(self):
_install.run(self)
self.execute(
_post_install, (self.install_lib,),
msg="Running post install tasks...")
setup(
name='cloudroast',
version=cloudroast.__version__,
version='0.0.1',
description='CloudCAFE based automated test repository for OpenStack',
long_description='{0}\n\n{1}'.format(
open('README.md').read(),
@ -46,7 +70,6 @@ setup(
install_requires=requires,
license=open('LICENSE').read(),
zip_safe=False,
#https://the-hitchhikers-guide-to-packaging.readthedocs.org/en/latest/specification.html
classifiers=(
'Development Status :: 1 - Planning',
'Intended Audience :: Developers',
@ -55,33 +78,5 @@ setup(
'Operating System :: POSIX :: Linux',
'Programming Language :: Python',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
)
)
''' @todo: need to clean this up or do it with puppet/chef '''
# Default Config Options
root_dir = "{0}/.cloudcafe".format(os.path.expanduser("~"))
config_dir = "{0}/configs".format(root_dir)
# Build Default directories
if(os.path.exists("{0}/engine.config".format(config_dir)) == False):
raise Exception("Core CAFE Engine configuration not found")
else:
# Copy over the default configurations
if(os.path.exists("~install")):
os.remove("~install")
# Report
print('\n'.join(["\t\t (----) (----)--)",
"\t\t (--(----) (----) --)",
"\t\t (----) (--(----) (----)",
"\t\t -----------------------",
"\t\t \ /",
"\t\t \ /",
"\t\t \_________________/",
"\t\t === CloudRoast ===",
"\t\t= A CloudCAFE Test Repository ="]))
else:
# State file
temp = open("~install", "w")
temp.close()
'Programming Language :: Python :: 2.7',),
cmdclass={'install': install})