|
1 import os |
|
2 import re |
|
3 import shutil |
|
4 import sys |
|
5 |
|
6 try: |
|
7 from setuptools import setup |
|
8 setup_params = { |
|
9 'entry_points': { |
|
10 'console_scripts': [ |
|
11 'virtualenv=virtualenv:main', |
|
12 'virtualenv-%s.%s=virtualenv:main' % sys.version_info[:2] |
|
13 ], |
|
14 }, |
|
15 'zip_safe': False, |
|
16 'test_suite': 'nose.collector', |
|
17 'tests_require': ['nose', 'Mock'], |
|
18 } |
|
19 except ImportError: |
|
20 from distutils.core import setup |
|
21 if sys.platform == 'win32': |
|
22 print('Note: without Setuptools installed you will have to use "python -m virtualenv ENV"') |
|
23 setup_params = {} |
|
24 else: |
|
25 script = 'scripts/virtualenv' |
|
26 script_ver = script + '-%s.%s' % sys.version_info[:2] |
|
27 shutil.copy(script, script_ver) |
|
28 setup_params = {'scripts': [script, script_ver]} |
|
29 |
|
30 here = os.path.dirname(os.path.abspath(__file__)) |
|
31 |
|
32 ## Get long_description from index.txt: |
|
33 f = open(os.path.join(here, 'docs', 'index.rst')) |
|
34 long_description = f.read().strip() |
|
35 long_description = long_description.split('split here', 1)[1] |
|
36 f.close() |
|
37 f = open(os.path.join(here, 'docs', 'news.rst')) |
|
38 long_description += "\n\n" + f.read() |
|
39 f.close() |
|
40 |
|
41 |
|
42 def get_version(): |
|
43 f = open(os.path.join(here, 'virtualenv.py')) |
|
44 version_file = f.read() |
|
45 f.close() |
|
46 version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", |
|
47 version_file, re.M) |
|
48 if version_match: |
|
49 return version_match.group(1) |
|
50 raise RuntimeError("Unable to find version string.") |
|
51 |
|
52 |
|
53 # Hack to prevent stupid TypeError: 'NoneType' object is not callable error on |
|
54 # exit of python setup.py test # in multiprocessing/util.py _exit_function when |
|
55 # running python setup.py test (see |
|
56 # http://www.eby-sarna.com/pipermail/peak/2010-May/003357.html) |
|
57 try: |
|
58 import multiprocessing |
|
59 except ImportError: |
|
60 pass |
|
61 |
|
62 setup( |
|
63 name='virtualenv', |
|
64 version=get_version(), |
|
65 description="Virtual Python Environment builder", |
|
66 long_description=long_description, |
|
67 classifiers=[ |
|
68 'Development Status :: 5 - Production/Stable', |
|
69 'Intended Audience :: Developers', |
|
70 'License :: OSI Approved :: MIT License', |
|
71 'Programming Language :: Python :: 2', |
|
72 'Programming Language :: Python :: 2.5', |
|
73 'Programming Language :: Python :: 2.6', |
|
74 'Programming Language :: Python :: 2.7', |
|
75 'Programming Language :: Python :: 3', |
|
76 'Programming Language :: Python :: 3.1', |
|
77 'Programming Language :: Python :: 3.2', |
|
78 ], |
|
79 keywords='setuptools deployment installation distutils', |
|
80 author='Ian Bicking', |
|
81 author_email='ianb@colorstudy.com', |
|
82 maintainer='Jannis Leidel, Carl Meyer and Brian Rosner', |
|
83 maintainer_email='python-virtualenv@groups.google.com', |
|
84 url='http://www.virtualenv.org', |
|
85 license='MIT', |
|
86 py_modules=['virtualenv'], |
|
87 packages=['virtualenv_support'], |
|
88 package_data={'virtualenv_support': ['*.whl']}, |
|
89 **setup_params) |