diff --git a/MANIFEST.in b/MANIFEST.in index eefe078cd6..ce88137c14 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,7 +1,7 @@ recursive-include bin *.js recursive-include doc *.py *.rst *.css *.js *.html *.conf *.jpg *.gif *.png *.css_t recursive-include horizon *.html *.css *.js *.csv *.template *.tmpl *.mo *.po -recursive-include openstack_dashboard *.html *.js *.css *.less *.csv *.template *.mo *.po *.example *.eot *.svg *.ttf *.woff *.png *.gif *.ico *.wsgi +recursive-include openstack_dashboard *.html *.js *.less *.mo *.po *.example *.eot *.svg *.ttf *.woff *.png *.ico *.wsgi recursive-include tools *.py *.sh include AUTHORS diff --git a/setup.py b/setup.py index 28e053ecb0..8a1d82423a 100755 --- a/setup.py +++ b/setup.py @@ -20,23 +20,67 @@ # under the License. import os -import re -import setuptools + +from distutils.core import setup +from distutils.command.install import INSTALL_SCHEMES + from horizon import version +from horizon.openstack.common import setup as os_common_setup -from horizon.openstack.common import setup -requires = setup.parse_requirements() -depend_links = setup.parse_dependency_links() -tests_require = setup.parse_requirements(['tools/test-requires']) +requires = os_common_setup.parse_requirements() +depend_links = os_common_setup.parse_dependency_links() +tests_require = os_common_setup.parse_requirements(['tools/test-requires']) ROOT = os.path.dirname(__file__) +target_dirs = ['horizon', 'openstack_dashboard', 'bin'] + def read(fname): return open(os.path.join(ROOT, fname)).read() -setuptools.setup(name="horizon", +def split(path, result=None): + """ + Split a path into components in a platform-neutral way. + """ + if result is None: + result = [] + head, tail = os.path.split(path) + if head == '': + return [tail] + result + if head == path: + return result + return split(head, [tail] + result) + + +# Tell distutils not to put the data_files in platform-specific installation +# locations. See here for an explanation: +# https://groups.google.com/forum/#!topic/comp.lang.python/Nex7L-026uw +for scheme in INSTALL_SCHEMES.values(): + scheme['data'] = scheme['purelib'] + +# Compile the list of packages available, because distutils doesn't have +# an easy way to do this. +packages, data_files = [], [] +root_dir = os.path.dirname(__file__) +if root_dir != '': + os.chdir(root_dir) + +for target_dir in target_dirs: + for dirpath, dirnames, filenames in os.walk(target_dir): + # Ignore dirnames that start with '.' + for i, dirname in enumerate(dirnames): + if dirname.startswith('.'): + del dirnames[i] + if '__init__.py' in filenames: + packages.append('.'.join(split(dirpath))) + elif filenames: + data_files.append([dirpath, [os.path.join(dirpath, f) + for f in filenames]]) + + +setup(name="horizon", version=version.canonical_version_string(), url='https://github.com/openstack/horizon/', license='Apache 2.0', @@ -44,14 +88,15 @@ setuptools.setup(name="horizon", long_description=read('README.rst'), author='OpenStack', author_email='horizon@lists.launchpad.net', - packages=setuptools.find_packages(), - cmdclass=setup.get_cmdclass(), + packages=packages, + data_files=data_files, + cmdclass=os_common_setup.get_cmdclass(), include_package_data=True, install_requires=requires, tests_require=tests_require, dependency_links=depend_links, zip_safe=False, - classifiers=['Development Status :: 4 - Beta', + classifiers=['Development Status :: 5 - Production/Stable', 'Framework :: Django', 'Intended Audience :: Developers', 'License :: OSI Approved :: Apache Software License',