38
38
# We can actually import a restricted version of sklearn that
39
39
# does not need the compiled code
40
40
import sklearn
41
-
42
41
VERSION = sklearn .__version__
43
42
44
- ###############################################################################
43
+
45
44
# Optional setuptools features
46
45
# We need to import setuptools early, if we want setuptools features,
47
46
# as it monkey-patches the 'setup' function
48
-
49
47
# For some commands, use setuptools
50
48
SETUPTOOLS_COMMANDS = set ([
51
49
'develop' , 'release' , 'bdist_egg' , 'bdist_rpm' ,
52
50
'bdist_wininst' , 'install_egg_info' , 'build_sphinx' ,
53
51
'egg_info' , 'easy_install' , 'upload' , 'bdist_wheel' ,
54
52
'--single-version-externally-managed' ,
55
53
])
56
-
57
-
58
- if len (SETUPTOOLS_COMMANDS .intersection (sys .argv )) > 0 :
54
+ if SETUPTOOLS_COMMANDS .intersection (sys .argv ):
59
55
import setuptools
60
56
extra_setuptools_args = dict (
61
57
zip_safe = False , # the package can run out of an .egg file
64
60
else :
65
61
extra_setuptools_args = dict ()
66
62
67
- ###############################################################################
68
63
64
+ # Custom clean command to remove build artifacts
69
65
70
66
class CleanCommand (Clean ):
71
67
description = "Remove build artifacts from the source tree"
@@ -84,8 +80,22 @@ def run(self):
84
80
if dirname == '__pycache__' :
85
81
shutil .rmtree (os .path .join (dirpath , dirname ))
86
82
83
+ cmdclass = {'clean' : CleanCommand }
84
+
85
+
86
+ # Optional wheelhouse-uploader features
87
+ # To automate release of binary packages for scikit-learn we need a tool
88
+ # to download the packages generated by travis and appveyor workers (with
89
+ # version number matching the current release) and upload them all at once
90
+ # to PyPI at release time.
91
+ # The URL of the artifact repositories are configured in the setup.cfg file.
92
+
93
+ WHEELHOUSE_UPLOADER_COMMANDS = set (['fetch_artifacts' , 'upload_all' ])
94
+ if WHEELHOUSE_UPLOADER_COMMANDS .intersection (sys .argv ):
95
+ import wheelhouse_uploader .cmd
96
+ cmdclass .update (vars (wheelhouse_uploader .cmd ))
97
+
87
98
88
- ###############################################################################
89
99
def configuration (parent_package = '' , top_path = None ):
90
100
if os .path .exists ('MANIFEST' ):
91
101
os .remove ('MANIFEST' )
@@ -133,7 +143,7 @@ def setup_package():
133
143
'Programming Language :: Python :: 3.3' ,
134
144
'Programming Language :: Python :: 3.4' ,
135
145
],
136
- cmdclass = { 'clean' : CleanCommand } ,
146
+ cmdclass = cmdclass ,
137
147
** extra_setuptools_args )
138
148
139
149
if (len (sys .argv ) >= 2
@@ -143,7 +153,7 @@ def setup_package():
143
153
# For these actions, NumPy is not required.
144
154
#
145
155
# They are required to succeed without Numpy for example when
146
- # pip is used to install Scikit when Numpy is not yet present in
156
+ # pip is used to install Scikit-learn when Numpy is not yet present in
147
157
# the system.
148
158
try :
149
159
from setuptools import setup
0 commit comments