michael@0: import os michael@0: import re michael@0: import shutil michael@0: import sys michael@0: michael@0: try: michael@0: from setuptools import setup michael@0: setup_params = { michael@0: 'entry_points': { michael@0: 'console_scripts': [ michael@0: 'virtualenv=virtualenv:main', michael@0: 'virtualenv-%s.%s=virtualenv:main' % sys.version_info[:2] michael@0: ], michael@0: }, michael@0: 'zip_safe': False, michael@0: 'test_suite': 'nose.collector', michael@0: 'tests_require': ['nose', 'Mock'], michael@0: } michael@0: except ImportError: michael@0: from distutils.core import setup michael@0: if sys.platform == 'win32': michael@0: print('Note: without Setuptools installed you will have to use "python -m virtualenv ENV"') michael@0: setup_params = {} michael@0: else: michael@0: script = 'scripts/virtualenv' michael@0: script_ver = script + '-%s.%s' % sys.version_info[:2] michael@0: shutil.copy(script, script_ver) michael@0: setup_params = {'scripts': [script, script_ver]} michael@0: michael@0: here = os.path.dirname(os.path.abspath(__file__)) michael@0: michael@0: ## Get long_description from index.txt: michael@0: f = open(os.path.join(here, 'docs', 'index.rst')) michael@0: long_description = f.read().strip() michael@0: long_description = long_description.split('split here', 1)[1] michael@0: f.close() michael@0: f = open(os.path.join(here, 'docs', 'news.rst')) michael@0: long_description += "\n\n" + f.read() michael@0: f.close() michael@0: michael@0: michael@0: def get_version(): michael@0: f = open(os.path.join(here, 'virtualenv.py')) michael@0: version_file = f.read() michael@0: f.close() michael@0: version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", michael@0: version_file, re.M) michael@0: if version_match: michael@0: return version_match.group(1) michael@0: raise RuntimeError("Unable to find version string.") michael@0: michael@0: michael@0: # Hack to prevent stupid TypeError: 'NoneType' object is not callable error on michael@0: # exit of python setup.py test # in multiprocessing/util.py _exit_function when michael@0: # running python setup.py test (see michael@0: # http://www.eby-sarna.com/pipermail/peak/2010-May/003357.html) michael@0: try: michael@0: import multiprocessing michael@0: except ImportError: michael@0: pass michael@0: michael@0: setup( michael@0: name='virtualenv', michael@0: version=get_version(), michael@0: description="Virtual Python Environment builder", michael@0: long_description=long_description, michael@0: classifiers=[ michael@0: 'Development Status :: 5 - Production/Stable', michael@0: 'Intended Audience :: Developers', michael@0: 'License :: OSI Approved :: MIT License', michael@0: 'Programming Language :: Python :: 2', michael@0: 'Programming Language :: Python :: 2.5', michael@0: 'Programming Language :: Python :: 2.6', michael@0: 'Programming Language :: Python :: 2.7', michael@0: 'Programming Language :: Python :: 3', michael@0: 'Programming Language :: Python :: 3.1', michael@0: 'Programming Language :: Python :: 3.2', michael@0: ], michael@0: keywords='setuptools deployment installation distutils', michael@0: author='Ian Bicking', michael@0: author_email='ianb@colorstudy.com', michael@0: maintainer='Jannis Leidel, Carl Meyer and Brian Rosner', michael@0: maintainer_email='python-virtualenv@groups.google.com', michael@0: url='http://www.virtualenv.org', michael@0: license='MIT', michael@0: py_modules=['virtualenv'], michael@0: packages=['virtualenv_support'], michael@0: package_data={'virtualenv_support': ['*.whl']}, michael@0: **setup_params)