FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
matplotlib/setup.py at master · captainsafia/matplotlib · GitHub
captainsafia
matplotlib
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
matplotlib
/
setup.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
398 lines (345 loc) · 13 KB
Breadcrumbs
matplotlib
/
setup.py
Copy path
File metadata and controls
398 lines (345 loc) · 13 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
"""
The matplotlib build options can be modified with a setup.cfg file. See
setup.cfg.template for more information.
"""
from
__future__
import
print_function
,
absolute_import
# This needs to be the very first thing to use distribute
from
distribute_setup
import
use_setuptools
use_setuptools
()
from
setuptools
.
command
.
test
import
test
as
TestCommand
from
setuptools
.
command
.
build_ext
import
build_ext
as
BuildExtCommand
import
sys
# distutils is breaking our sdists for files in symlinked dirs.
# distutils will copy if os.link is not available, so this is a hack
# to force copying
import
os
try
:
del
os
.
link
except
AttributeError
:
pass
# This 'if' statement is needed to prevent spawning infinite processes
# on Windows
if
__name__
==
'__main__'
:
# BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
# update it when the contents of directories change.
if
os
.
path
.
exists
(
'MANIFEST'
):
os
.
remove
(
'MANIFEST'
)
try
:
from
setuptools
import
setup
except
ImportError
:
try
:
from
setuptools
.
core
import
setup
except
ImportError
:
from
distutils
.
core
import
setup
# The setuptools version of sdist adds a setup.cfg file to the tree.
# We don't want that, so we simply remove it, and it will fall back to
# vanilla distutils.
try
:
from
setuptools
.
command
import
sdist
except
ImportError
:
pass
else
:
del
sdist
.
sdist
.
make_release_tree
from
distutils
.
dist
import
Distribution
import
setupext
from
setupext
import
print_line
,
print_raw
,
print_message
,
print_status
# Get the version from versioneer
import
versioneer
__version__
=
versioneer
.
get_version
()
# These are the packages in the order we want to display them. This
# list may contain strings to create section headers for the display.
mpl_packages
=
[
'Building Matplotlib'
,
setupext
.
Matplotlib
(),
setupext
.
Python
(),
setupext
.
Platform
(),
'Required dependencies and extensions'
,
setupext
.
Numpy
(),
setupext
.
Dateutil
(),
setupext
.
FuncTools32
(),
setupext
.
Pytz
(),
setupext
.
Cycler
(),
setupext
.
Tornado
(),
setupext
.
Pyparsing
(),
setupext
.
LibAgg
(),
setupext
.
FreeType
(),
setupext
.
FT2Font
(),
setupext
.
Png
(),
setupext
.
Qhull
(),
setupext
.
Image
(),
setupext
.
TTConv
(),
setupext
.
Path
(),
setupext
.
ContourLegacy
(),
setupext
.
Contour
(),
setupext
.
Delaunay
(),
setupext
.
QhullWrap
(),
setupext
.
Tri
(),
setupext
.
Externals
(),
'Optional subpackages'
,
setupext
.
SampleData
(),
setupext
.
Toolkits
(),
setupext
.
Tests
(),
setupext
.
Toolkits_Tests
(),
'Optional backend extensions'
,
# These backends are listed in order of preference, the first
# being the most preferred. The first one that looks like it will
# work will be selected as the default backend.
setupext
.
BackendMacOSX
(),
setupext
.
BackendQt5
(),
setupext
.
BackendQt4
(),
setupext
.
BackendGtk3Agg
(),
setupext
.
BackendGtk3Cairo
(),
setupext
.
BackendGtkAgg
(),
setupext
.
BackendTkAgg
(),
setupext
.
BackendWxAgg
(),
setupext
.
BackendGtk
(),
setupext
.
BackendAgg
(),
setupext
.
BackendCairo
(),
setupext
.
Windowing
(),
'Optional LaTeX dependencies'
,
setupext
.
DviPng
(),
setupext
.
Ghostscript
(),
setupext
.
LaTeX
(),
setupext
.
PdfToPs
(),
'Optional package data'
,
setupext
.
Dlls
(),
]
classifiers
=
[
'Development Status :: 5 - Production/Stable'
,
'Intended Audience :: Science/Research'
,
'License :: OSI Approved :: Python Software Foundation License'
,
'Programming Language :: Python'
,
'Programming Language :: Python :: 2.7'
,
'Programming Language :: Python :: 3'
,
'Programming Language :: Python :: 3.3'
,
'Programming Language :: Python :: 3.4'
,
'Programming Language :: Python :: 3.5'
,
'Topic :: Scientific/Engineering :: Visualization'
,
]
class
NoseTestCommand
(
TestCommand
):
"""Invoke unit tests using nose after an in-place build."""
description
=
"Invoke unit tests using nose after an in-place build."
user_options
=
[
(
"pep8-only"
,
None
,
"pep8 checks"
),
(
"omit-pep8"
,
None
,
"Do not perform pep8 checks"
),
(
"nocapture"
,
None
,
"do not capture stdout (nosetests)"
),
(
"nose-verbose"
,
None
,
"be verbose (nosetests)"
),
(
"processes="
,
None
,
"number of processes (nosetests)"
),
(
"process-timeout="
,
None
,
"process timeout (nosetests)"
),
(
"with-coverage"
,
None
,
"with coverage"
),
(
"detailed-error-msg"
,
None
,
"detailed error message (nosetest)"
),
(
"tests="
,
None
,
"comma separated selection of tests (nosetest)"
),
]
def
initialize_options
(
self
):
self
.
pep8_only
=
None
self
.
omit_pep8
=
None
# parameters passed to nose tests
self
.
processes
=
None
self
.
process_timeout
=
None
self
.
nose_verbose
=
None
self
.
nocapture
=
None
self
.
with_coverage
=
None
self
.
detailed_error_msg
=
None
self
.
tests
=
None
def
finalize_options
(
self
):
self
.
test_args
=
[]
if
self
.
pep8_only
:
self
.
pep8_only
=
True
if
self
.
omit_pep8
:
self
.
omit_pep8
=
True
if
self
.
pep8_only
and
self
.
omit_pep8
:
from
distutils
.
errors
import
DistutilsOptionError
raise
DistutilsOptionError
(
"You are using several options for the test command in an "
"incompatible manner. Please use either --pep8-only or "
"--omit-pep8"
)
if
self
.
processes
:
self
.
test_args
.
append
(
"--processes={prc}"
.
format
(
prc
=
self
.
processes
))
if
self
.
process_timeout
:
self
.
test_args
.
append
(
"--process-timeout={tout}"
.
format
(
tout
=
self
.
process_timeout
))
if
self
.
nose_verbose
:
self
.
test_args
.
append
(
"--verbose"
)
if
self
.
nocapture
:
self
.
test_args
.
append
(
"--nocapture"
)
if
self
.
with_coverage
:
self
.
test_args
.
append
(
"--with-coverage"
)
if
self
.
detailed_error_msg
:
self
.
test_args
.
append
(
"-d"
)
if
self
.
tests
:
self
.
test_args
.
append
(
"--tests={names}"
.
format
(
names
=
self
.
tests
))
def
run
(
self
):
if
self
.
distribution
.
install_requires
:
self
.
distribution
.
fetch_build_eggs
(
self
.
distribution
.
install_requires
)
if
self
.
distribution
.
tests_require
:
self
.
distribution
.
fetch_build_eggs
(
self
.
distribution
.
tests_require
)
self
.
announce
(
'running unittests with nose'
)
self
.
with_project_on_sys_path
(
self
.
run_tests
)
def
run_tests
(
self
):
import
matplotlib
matplotlib
.
use
(
'agg'
)
import
nose
from
matplotlib
.
testing
.
noseclasses
import
KnownFailure
from
matplotlib
import
default_test_modules
as
testmodules
from
matplotlib
import
font_manager
import
time
# Make sure the font caches are created before starting any possibly
# parallel tests
if
font_manager
.
_fmcache
is
not
None
:
while
not
os
.
path
.
exists
(
font_manager
.
_fmcache
):
time
.
sleep
(
0.5
)
plugins
=
[
KnownFailure
]
# Nose doesn't automatically instantiate all of the plugins in the
# child processes, so we have to provide the multiprocess plugin
# with a list.
from
nose
.
plugins
import
multiprocess
multiprocess
.
_instantiate_plugins
=
plugins
if
self
.
omit_pep8
:
testmodules
.
remove
(
'matplotlib.tests.test_coding_standards'
)
elif
self
.
pep8_only
:
testmodules
=
[
'matplotlib.tests.test_coding_standards'
]
nose
.
main
(
addplugins
=
[
x
()
for
x
in
plugins
],
defaultTest
=
testmodules
,
argv
=
[
'nosetests'
]
+
self
.
test_args
,
exit
=
True
)
class
BuildExtraLibraries
(
BuildExtCommand
):
def
run
(
self
):
for
package
in
good_packages
:
package
.
do_custom_build
()
return
BuildExtCommand
.
run
(
self
)
cmdclass
=
versioneer
.
get_cmdclass
()
cmdclass
[
'test'
]
=
NoseTestCommand
cmdclass
[
'build_ext'
]
=
BuildExtraLibraries
# One doesn't normally see `if __name__ == '__main__'` blocks in a setup.py,
# however, this is needed on Windows to avoid creating infinite subprocesses
# when using multiprocessing.
if
__name__
==
'__main__'
:
# These are distutils.setup parameters that the various packages add
# things to.
packages
=
[]
namespace_packages
=
[]
py_modules
=
[]
ext_modules
=
[]
package_data
=
{}
package_dir
=
{
''
:
'lib'
}
install_requires
=
[]
setup_requires
=
[]
tests_require
=
[]
default_backend
=
None
# Go through all of the packages and figure out which ones we are
# going to build/install.
print_line
()
print_raw
(
"Edit setup.cfg to change the build options"
)
required_failed
=
[]
good_packages
=
[]
for
package
in
mpl_packages
:
if
isinstance
(
package
,
str
):
print_raw
(
''
)
print_raw
(
package
.
upper
())
else
:
try
:
result
=
package
.
check
()
if
result
is
not
None
:
message
=
'yes [%s]'
%
result
print_status
(
package
.
name
,
message
)
except
setupext
.
CheckFailed
as
e
:
msg
=
str
(
e
).
strip
()
if
len
(
msg
):
print_status
(
package
.
name
,
'no [%s]'
%
msg
)
else
:
print_status
(
package
.
name
,
'no'
)
if
not
package
.
optional
:
required_failed
.
append
(
package
)
else
:
good_packages
.
append
(
package
)
if
isinstance
(
package
,
setupext
.
OptionalBackendPackage
):
if
default_backend
is
None
:
default_backend
=
package
.
name
print_raw
(
''
)
# Abort if any of the required packages can not be built.
if
required_failed
:
print_line
()
print_message
(
"The following required packages can not "
"be built: %s"
%
', '
.
join
(
x
.
name
for
x
in
required_failed
))
sys
.
exit
(
1
)
# Now collect all of the information we need to build all of the
# packages.
for
package
in
good_packages
:
packages
.
extend
(
package
.
get_packages
())
namespace_packages
.
extend
(
package
.
get_namespace_packages
())
py_modules
.
extend
(
package
.
get_py_modules
())
ext
=
package
.
get_extension
()
if
ext
is
not
None
:
ext_modules
.
append
(
ext
)
data
=
package
.
get_package_data
()
for
key
,
val
in
data
.
items
():
package_data
.
setdefault
(
key
, [])
package_data
[
key
]
=
list
(
set
(
val
+
package_data
[
key
]))
install_requires
.
extend
(
package
.
get_install_requires
())
setup_requires
.
extend
(
package
.
get_setup_requires
())
tests_require
.
extend
(
package
.
get_tests_require
())
# Write the default matplotlibrc file
if
default_backend
is
None
:
default_backend
=
'svg'
if
setupext
.
options
[
'backend'
]:
default_backend
=
setupext
.
options
[
'backend'
]
with
open
(
'matplotlibrc.template'
)
as
fd
:
template
=
fd
.
read
()
with
open
(
'lib/matplotlib/mpl-data/matplotlibrc'
,
'w'
)
as
fd
:
fd
.
write
(
template
%
{
'backend'
:
default_backend
})
# Build in verbose mode if requested
if
setupext
.
options
[
'verbose'
]:
for
mod
in
ext_modules
:
mod
.
extra_compile_args
.
append
(
'-DVERBOSE'
)
# Finalize the extension modules so they can get the Numpy include
# dirs
for
mod
in
ext_modules
:
mod
.
finalize
()
extra_args
=
{}
# Avoid installing setup_requires dependencies if the user just
# queries for information
if
(
any
(
'--'
+
opt
in
sys
.
argv
for
opt
in
Distribution
.
display_option_names
+
[
'help'
])
or
'clean'
in
sys
.
argv
):
setup_requires
=
[]
# Finally, pass this all along to distutils to do the heavy lifting.
distrib
=
setup
(
name
=
"matplotlib"
,
version
=
__version__
,
description
=
"Python plotting package"
,
author
=
"John D. Hunter, Michael Droettboom"
,
author_email
=
"matplotlib-users@python.org"
,
url
=
"http://matplotlib.org"
,
long_description
=
"""
matplotlib strives to produce publication quality 2D graphics
for interactive graphing, scientific publishing, user interface
development and web application servers targeting multiple user
interfaces and hardcopy output formats. There is a 'pylab' mode
which emulates matlab graphics.
"""
,
license
=
"BSD"
,
packages
=
packages
,
namespace_packages
=
namespace_packages
,
platforms
=
'any'
,
py_modules
=
py_modules
,
ext_modules
=
ext_modules
,
package_dir
=
package_dir
,
package_data
=
package_data
,
classifiers
=
classifiers
,
download_url
=
"http://matplotlib.org/users/installing.html"
,
# List third-party Python packages that we require
install_requires
=
install_requires
,
setup_requires
=
setup_requires
,
tests_require
=
tests_require
,
# matplotlib has C/C++ extensions, so it's not zip safe.
# Telling setuptools this prevents it from doing an automatic
# check for zip safety.
zip_safe
=
False
,
cmdclass
=
cmdclass
,
**
extra_args
)
Back
|
FazBrowse Home
|
New Git URL