2
2
import os
3
3
import sys
4
4
5
- from setuptools import Command , find_packages , setup
5
+ from setuptools import find_packages , setup
6
6
from setuptools .command .install import install as InstallCommandBase
7
7
from setuptools .command .test import test as TestCommand
8
8
from setuptools .dist import Distribution
9
9
from wheel .bdist_wheel import bdist_wheel as BDistWheelCommandBase
10
10
11
11
12
- class NoopCommand (Command ):
13
- def initialize_options (self ):
14
- pass
15
-
16
- def finalize_options (self ):
17
- pass
18
-
19
- def run (self ):
20
- pass
21
-
22
-
23
12
class BasePytestCommand (TestCommand ):
24
13
user_options = []
25
14
test_dir = None
@@ -39,7 +28,6 @@ def run_tests(self):
39
28
if src_dir :
40
29
src_dir += "/"
41
30
args = [self .test_dir , "--cov=redshift_connector" , "--cov-report=xml" , "--cov-report=html" ]
42
- print (args )
43
31
44
32
errno = pytest .main (args )
45
33
sys .exit (errno )
@@ -78,6 +66,17 @@ def get_tag(self):
78
66
return python , abi , plat
79
67
80
68
69
+ custom_cmds = {
70
+ "bdist_wheel" : BDistWheelCommand ,
71
+ "unit_test" : UnitTestCommand ,
72
+ "integration_test" : IntegrationTestCommand ,
73
+ }
74
+
75
+ if os .getenv ("CUSTOMINSTALL" , False ):
76
+ custom_cmds ["install" ] = InstallCommand
77
+ elif "install" in custom_cmds :
78
+ del custom_cmds ["install" ]
79
+
81
80
# read the contents of your README file
82
81
this_directory = os .path .abspath (os .path .dirname (__file__ ))
83
82
with open (os .path .join (this_directory , "README.rst" ), encoding = "utf-8" ) as f :
@@ -121,10 +120,5 @@ def get_tag(self):
121
120
include_package_data = True ,
122
121
package_data = {"redshift-connector" : ["*.py" , "*.crt" , "LICENSE" , "NOTICE" ]},
123
122
packages = find_packages (exclude = ["test*" ]),
124
- cmdclass = {
125
- "install" : InstallCommand ,
126
- "bdist_wheel" : BDistWheelCommand ,
127
- "unit_test" : UnitTestCommand ,
128
- "integration_test" : IntegrationTestCommand ,
129
- },
123
+ cmdclass = custom_cmds ,
130
124
)
0 commit comments