3
3
import sys
4
4
5
5
if sys .version_info [:2 ] < (2 , 7 ):
6
- sys .exit (' virtualenv requires Python 2.7 or higher.' )
6
+ sys .exit (" virtualenv requires Python 2.7 or higher." )
7
7
try :
8
8
from setuptools import setup , find_packages
9
9
from setuptools .command .test import test as TestCommand
10
10
11
11
class PyTest (TestCommand ):
12
- user_options = [(' pytest-args=' , 'a' , "Arguments to pass to py.test" )]
12
+ user_options = [(" pytest-args=" , "a" , "Arguments to pass to py.test" )]
13
13
14
14
def initialize_options (self ):
15
15
TestCommand .initialize_options (self )
16
16
self .pytest_args = []
17
17
18
18
def finalize_options (self ):
19
19
TestCommand .finalize_options (self )
20
- #self.test_args = []
21
- #self.test_suite = True
20
+ # self.test_args = []
21
+ # self.test_suite = True
22
22
23
23
def run_tests (self ):
24
24
# import here, because outside the eggs aren't loaded
25
25
import pytest
26
+
26
27
sys .exit (pytest .main (self .pytest_args ))
27
28
28
29
setup_params = {
29
- 'entry_points' : {
30
- 'console_scripts' : ['virtualenv=virtualenv:main' ],
31
- },
32
- 'zip_safe' : False ,
33
- 'cmdclass' : {'test' : PyTest },
34
- 'tests_require' : ['pytest' , 'mock' ],
30
+ "entry_points" : {"console_scripts" : ["virtualenv=virtualenv:main" ]},
31
+ "zip_safe" : False ,
32
+ "cmdclass" : {"test" : PyTest },
33
+ "tests_require" : ["pytest" , "mock" ],
35
34
}
36
35
except ImportError :
37
36
from distutils .core import setup
38
- if sys . platform == 'win32' :
39
- print ( 'Note: without Setuptools installed you will '
40
- 'have to use "python -m virtualenv ENV"' )
37
+
38
+ if sys . platform == "win32" :
39
+ print ( "Note: without Setuptools installed you will " 'have to use "python -m virtualenv ENV"' )
41
40
setup_params = {}
42
41
else :
43
- script = ' src/scripts/virtualenv'
44
- setup_params = {' scripts' : [script ]}
42
+ script = " src/scripts/virtualenv"
43
+ setup_params = {" scripts" : [script ]}
45
44
46
45
47
46
def read_file (* paths ):
@@ -51,33 +50,32 @@ def read_file(*paths):
51
50
52
51
53
52
# Get long_description from index.rst:
54
- long_description_full = read_file (' docs' , ' index.rst' )
55
- long_description = long_description_full .strip ().split (' split here' , 1 )[0 ]
53
+ long_description_full = read_file (" docs" , " index.rst" )
54
+ long_description = long_description_full .strip ().split (" split here" , 1 )[0 ]
56
55
# Add release history
57
- changes = read_file (' docs' , ' changes.rst' )
56
+ changes = read_file (" docs" , " changes.rst" )
58
57
# Only report last two releases for brevity
59
58
releases_found = 0
60
59
change_lines = []
61
60
for line in changes .splitlines ():
62
61
change_lines .append (line )
63
- if line .startswith (' --------------' ):
62
+ if line .startswith (" --------------" ):
64
63
releases_found += 1
65
64
if releases_found > 2 :
66
65
break
67
66
68
- changes = ' \n ' .join (change_lines [:- 2 ]) + ' \n '
69
- changes += ' `Full Changelog <https://virtualenv.pypa.io/en/latest/changes.html>`_.'
67
+ changes = " \n " .join (change_lines [:- 2 ]) + " \n "
68
+ changes += " `Full Changelog <https://virtualenv.pypa.io/en/latest/changes.html>`_."
70
69
# Replace issue/pull directives
71
- changes = re .sub (r' :pull:`(\d+)`' , r' PR #\1' , changes )
72
- changes = re .sub (r' :issue:`(\d+)`' , r' #\1' , changes )
70
+ changes = re .sub (r" :pull:`(\d+)`" , r" PR #\1" , changes )
71
+ changes = re .sub (r" :issue:`(\d+)`" , r" #\1" , changes )
73
72
74
- long_description += ' \n \n ' + changes
73
+ long_description += " \n \n " + changes
75
74
76
75
77
76
def get_version ():
78
- version_file = read_file (os .path .join ('src' , 'virtualenv.py' ))
79
- version_match = re .search (r"^__version__ = ['\"]([^'\"]*)['\"]" ,
80
- version_file , re .M )
77
+ version_file = read_file (os .path .join ("src" , "virtualenv.py" ))
78
+ version_match = re .search (r"^__version__ = ['\"]([^'\"]*)['\"]" , version_file , re .M )
81
79
if version_match :
82
80
return version_match .group (1 )
83
81
raise RuntimeError ("Unable to find version string." )
@@ -93,32 +91,33 @@ def get_version():
93
91
pass
94
92
95
93
setup (
96
- name = ' virtualenv' ,
94
+ name = " virtualenv" ,
97
95
version = get_version (),
98
96
description = "Virtual Python Environment builder" ,
99
97
long_description = long_description ,
100
98
classifiers = [
101
- ' Development Status :: 5 - Production/Stable' ,
102
- ' Intended Audience :: Developers' ,
103
- ' License :: OSI Approved :: MIT License' ,
104
- ' Programming Language :: Python :: 2' ,
105
- ' Programming Language :: Python :: 2.7' ,
106
- ' Programming Language :: Python :: 3' ,
107
- ' Programming Language :: Python :: 3.4' ,
108
- ' Programming Language :: Python :: 3.5' ,
109
- ' Programming Language :: Python :: 3.6' ,
110
- ' Programming Language :: Python :: 3.7' ,
99
+ " Development Status :: 5 - Production/Stable" ,
100
+ " Intended Audience :: Developers" ,
101
+ " License :: OSI Approved :: MIT License" ,
102
+ " Programming Language :: Python :: 2" ,
103
+ " Programming Language :: Python :: 2.7" ,
104
+ " Programming Language :: Python :: 3" ,
105
+ " Programming Language :: Python :: 3.4" ,
106
+ " Programming Language :: Python :: 3.5" ,
107
+ " Programming Language :: Python :: 3.6" ,
108
+ " Programming Language :: Python :: 3.7" ,
111
109
],
112
- keywords = 'setuptools deployment installation distutils' ,
113
- author = 'Ian Bicking' ,
114
-
115
- maintainer = 'Jannis Leidel, Carl Meyer and Brian Rosner' ,
116
- maintainer_email = '[email protected] ' ,
117
- url = 'https://virtualenv.pypa.io/' ,
118
- license = 'MIT' ,
119
- package_dir = {'' : 'src' },
120
- py_modules = ['virtualenv' ],
121
- packages = find_packages ('src' ),
122
- package_data = {'virtualenv_support' : ['*.whl' ]},
123
- python_requires = '>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*' ,
124
- ** setup_params )
110
+ keywords = "setuptools deployment installation distutils" ,
111
+ author = "Ian Bicking" ,
112
+
113
+ maintainer = "Jannis Leidel, Carl Meyer and Brian Rosner" ,
114
+ maintainer_email = "[email protected] " ,
115
+ url = "https://virtualenv.pypa.io/" ,
116
+ license = "MIT" ,
117
+ package_dir = {"" : "src" },
118
+ py_modules = ["virtualenv" ],
119
+ packages = find_packages ("src" ),
120
+ package_data = {"virtualenv_support" : ["*.whl" ]},
121
+ python_requires = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*" ,
122
+ ** setup_params
123
+ )
0 commit comments