python/virtualenv/setup.py

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial