| OLD | NEW | 
|---|
|  | (Empty) | 
| 1 import os |  | 
| 2 import re |  | 
| 3 import shutil |  | 
| 4 import sys |  | 
| 5 |  | 
| 6 if sys.version_info[:2] < (2, 6): |  | 
| 7     sys.exit('virtualenv requires Python 2.6 or higher.') |  | 
| 8 |  | 
| 9 try: |  | 
| 10     from setuptools import setup |  | 
| 11     from setuptools.command.test import test as TestCommand |  | 
| 12 |  | 
| 13     class PyTest(TestCommand): |  | 
| 14         user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")] |  | 
| 15 |  | 
| 16         def initialize_options(self): |  | 
| 17             TestCommand.initialize_options(self) |  | 
| 18             self.pytest_args = None |  | 
| 19 |  | 
| 20         def finalize_options(self): |  | 
| 21             TestCommand.finalize_options(self) |  | 
| 22             self.test_args = [] |  | 
| 23             self.test_suite = True |  | 
| 24 |  | 
| 25         def run_tests(self): |  | 
| 26             # import here, because outside the eggs aren't loaded |  | 
| 27             import pytest |  | 
| 28             errno = pytest.main(self.pytest_args) |  | 
| 29             sys.exit(errno) |  | 
| 30 |  | 
| 31     setup_params = { |  | 
| 32         'entry_points': { |  | 
| 33             'console_scripts': [ |  | 
| 34                 'virtualenv=virtualenv:main', |  | 
| 35                 'virtualenv-%s.%s=virtualenv:main' % sys.version_info[:2] |  | 
| 36             ], |  | 
| 37         }, |  | 
| 38         'zip_safe': False, |  | 
| 39         'cmdclass': {'test': PyTest}, |  | 
| 40         'tests_require': ['pytest', 'mock'], |  | 
| 41     } |  | 
| 42 except ImportError: |  | 
| 43     from distutils.core import setup |  | 
| 44     if sys.platform == 'win32': |  | 
| 45         print('Note: without Setuptools installed you will ' |  | 
| 46               'have to use "python -m virtualenv ENV"') |  | 
| 47         setup_params = {} |  | 
| 48     else: |  | 
| 49         script = 'scripts/virtualenv' |  | 
| 50         script_ver = script + '-%s.%s' % sys.version_info[:2] |  | 
| 51         shutil.copy(script, script_ver) |  | 
| 52         setup_params = {'scripts': [script, script_ver]} |  | 
| 53 |  | 
| 54 |  | 
| 55 def read_file(*paths): |  | 
| 56     here = os.path.dirname(os.path.abspath(__file__)) |  | 
| 57     with open(os.path.join(here, *paths)) as f: |  | 
| 58         return f.read() |  | 
| 59 |  | 
| 60 # Get long_description from index.rst: |  | 
| 61 long_description = read_file('docs', 'index.rst') |  | 
| 62 long_description = long_description.strip().split('split here', 1)[0] |  | 
| 63 # Add release history |  | 
| 64 long_description += "\n\n" + read_file('docs', 'changes.rst') |  | 
| 65 |  | 
| 66 |  | 
| 67 def get_version(): |  | 
| 68     version_file = read_file('virtualenv.py') |  | 
| 69     version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", |  | 
| 70                               version_file, re.M) |  | 
| 71     if version_match: |  | 
| 72         return version_match.group(1) |  | 
| 73     raise RuntimeError("Unable to find version string.") |  | 
| 74 |  | 
| 75 |  | 
| 76 # Hack to prevent stupid TypeError: 'NoneType' object is not callable error on |  | 
| 77 # exit of python setup.py test # in multiprocessing/util.py _exit_function when |  | 
| 78 # running python setup.py test (see |  | 
| 79 # http://www.eby-sarna.com/pipermail/peak/2010-May/003357.html) |  | 
| 80 try: |  | 
| 81     import multiprocessing  # noqa |  | 
| 82 except ImportError: |  | 
| 83     pass |  | 
| 84 |  | 
| 85 setup( |  | 
| 86     name='virtualenv', |  | 
| 87     version=get_version(), |  | 
| 88     description="Virtual Python Environment builder", |  | 
| 89     long_description=long_description, |  | 
| 90     classifiers=[ |  | 
| 91         'Development Status :: 5 - Production/Stable', |  | 
| 92         'Intended Audience :: Developers', |  | 
| 93         'License :: OSI Approved :: MIT License', |  | 
| 94         'Programming Language :: Python :: 2', |  | 
| 95         'Programming Language :: Python :: 2.6', |  | 
| 96         'Programming Language :: Python :: 2.7', |  | 
| 97         'Programming Language :: Python :: 3', |  | 
| 98         'Programming Language :: Python :: 3.1', |  | 
| 99         'Programming Language :: Python :: 3.2', |  | 
| 100     ], |  | 
| 101     keywords='setuptools deployment installation distutils', |  | 
| 102     author='Ian Bicking', |  | 
| 103     author_email='ianb@colorstudy.com', |  | 
| 104     maintainer='Jannis Leidel, Carl Meyer and Brian Rosner', |  | 
| 105     maintainer_email='python-virtualenv@groups.google.com', |  | 
| 106     url='https://virtualenv.pypa.io/', |  | 
| 107     license='MIT', |  | 
| 108     py_modules=['virtualenv'], |  | 
| 109     packages=['virtualenv_support'], |  | 
| 110     package_data={'virtualenv_support': ['*.whl']}, |  | 
| 111     **setup_params) |  | 
| OLD | NEW | 
|---|