python/virtualenv/setup.py

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/python/virtualenv/setup.py	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,89 @@
     1.4 +import os
     1.5 +import re
     1.6 +import shutil
     1.7 +import sys
     1.8 +
     1.9 +try:
    1.10 +    from setuptools import setup
    1.11 +    setup_params = {
    1.12 +        'entry_points': {
    1.13 +            'console_scripts': [
    1.14 +                'virtualenv=virtualenv:main',
    1.15 +                'virtualenv-%s.%s=virtualenv:main' % sys.version_info[:2]
    1.16 +            ],
    1.17 +        },
    1.18 +        'zip_safe': False,
    1.19 +        'test_suite': 'nose.collector',
    1.20 +        'tests_require': ['nose', 'Mock'],
    1.21 +    }
    1.22 +except ImportError:
    1.23 +    from distutils.core import setup
    1.24 +    if sys.platform == 'win32':
    1.25 +        print('Note: without Setuptools installed you will have to use "python -m virtualenv ENV"')
    1.26 +        setup_params = {}
    1.27 +    else:
    1.28 +        script = 'scripts/virtualenv'
    1.29 +        script_ver = script + '-%s.%s' % sys.version_info[:2]
    1.30 +        shutil.copy(script, script_ver)
    1.31 +        setup_params = {'scripts': [script, script_ver]}
    1.32 +
    1.33 +here = os.path.dirname(os.path.abspath(__file__))
    1.34 +
    1.35 +## Get long_description from index.txt:
    1.36 +f = open(os.path.join(here, 'docs', 'index.rst'))
    1.37 +long_description = f.read().strip()
    1.38 +long_description = long_description.split('split here', 1)[1]
    1.39 +f.close()
    1.40 +f = open(os.path.join(here, 'docs', 'news.rst'))
    1.41 +long_description += "\n\n" + f.read()
    1.42 +f.close()
    1.43 +
    1.44 +
    1.45 +def get_version():
    1.46 +    f = open(os.path.join(here, 'virtualenv.py'))
    1.47 +    version_file = f.read()
    1.48 +    f.close()
    1.49 +    version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
    1.50 +                              version_file, re.M)
    1.51 +    if version_match:
    1.52 +        return version_match.group(1)
    1.53 +    raise RuntimeError("Unable to find version string.")
    1.54 +
    1.55 +
    1.56 +# Hack to prevent stupid TypeError: 'NoneType' object is not callable error on
    1.57 +# exit of python setup.py test # in multiprocessing/util.py _exit_function when
    1.58 +# running python setup.py test (see
    1.59 +# http://www.eby-sarna.com/pipermail/peak/2010-May/003357.html)
    1.60 +try:
    1.61 +    import multiprocessing
    1.62 +except ImportError:
    1.63 +    pass
    1.64 +
    1.65 +setup(
    1.66 +    name='virtualenv',
    1.67 +    version=get_version(),
    1.68 +    description="Virtual Python Environment builder",
    1.69 +    long_description=long_description,
    1.70 +    classifiers=[
    1.71 +        'Development Status :: 5 - Production/Stable',
    1.72 +        'Intended Audience :: Developers',
    1.73 +        'License :: OSI Approved :: MIT License',
    1.74 +        'Programming Language :: Python :: 2',
    1.75 +        'Programming Language :: Python :: 2.5',
    1.76 +        'Programming Language :: Python :: 2.6',
    1.77 +        'Programming Language :: Python :: 2.7',
    1.78 +        'Programming Language :: Python :: 3',
    1.79 +        'Programming Language :: Python :: 3.1',
    1.80 +        'Programming Language :: Python :: 3.2',
    1.81 +    ],
    1.82 +    keywords='setuptools deployment installation distutils',
    1.83 +    author='Ian Bicking',
    1.84 +    author_email='ianb@colorstudy.com',
    1.85 +    maintainer='Jannis Leidel, Carl Meyer and Brian Rosner',
    1.86 +    maintainer_email='python-virtualenv@groups.google.com',
    1.87 +    url='http://www.virtualenv.org',
    1.88 +    license='MIT',
    1.89 +    py_modules=['virtualenv'],
    1.90 +    packages=['virtualenv_support'],
    1.91 +    package_data={'virtualenv_support': ['*.whl']},
    1.92 +    **setup_params)

mercurial