def _get_version_from_pkg_resources(self): """Get the version of the package from the pkg_resources record associated with the package.""" try: requirement = pkg_resources.Requirement.parse(self.package) provider = pkg_resources.get_provider(requirement) return provider.version except pkg_resources.DistributionNotFound: # The most likely cause for this is running tests in a tree # produced from a tarball where the package itself has not been # installed into anything. Revert to setup-time logic. from cinderclient.openstack.common import setup return setup.get_version(self.package)
from cinderclient.openstack.common import setup requires = setup.parse_requirements() depend_links = setup.parse_dependency_links() tests_require = setup.parse_requirements(['tools/test-requires']) project = 'python-cinderclient' def read_file(file_name): return open(os.path.join(os.path.dirname(__file__), file_name)).read() setuptools.setup( name=project, version=setup.get_version(project), author="OpenStack Contributors", author_email="*****@*****.**", description="Client library for OpenStack Cinder API.", long_description=read_file("README.rst"), license="Apache License, Version 2.0", url="https://github.com/openstack/python-cinderclient", packages=setuptools.find_packages(exclude=['tests', 'tests.*']), cmdclass=setup.get_cmdclass(), install_requires=requires, tests_require=tests_require, setup_requires=['setuptools-git>=0.4'], include_package_data=True, dependency_links=depend_links, classifiers=[ "Development Status :: 5 - Production/Stable",