Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 72b38e8

Browse filesBrowse files
committed
Don't explicitly pass the default include and lib paths.
1 parent d56e916 commit 72b38e8
Copy full SHA for 72b38e8

File tree

Expand file treeCollapse file tree

9 files changed

+42
-113
lines changed
Filter options
Expand file treeCollapse file tree

9 files changed

+42
-113
lines changed

‎.appveyor.yml

Copy file name to clipboardExpand all lines: .appveyor.yml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,14 @@ install:
8484
# and for the wheels
8585
- del %LIBRARY_LIB%\png.lib
8686
- del %LIBRARY_LIB%\z.lib
87-
- set MPLBASEDIRLIST=%CONDA_PREFIX%\Library\;.
8887
# enables the local freetype build
8988
- set MPLLOCALFREETYPE=1
9089
# Show the installed packages + versions
9190
- conda list
9291

9392
test_script:
9493
# Now build the thing..
94+
- set LINK=/LIBPATH:%cd%\lib
9595
- pip install -ve .
9696
# these should show no z, png, or freetype dll...
9797
- set "DUMPBIN=%VS140COMNTOOLS%\..\..\VC\bin\dumpbin.exe"

‎build_alllocal.cmd

Copy file name to clipboardExpand all lines: build_alllocal.cmd
-4Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,5 @@ mkdir lib || cmd /c "exit /b 0"
2323
copy %LIBRARY_LIB%\zlibstatic.lib lib\z.lib
2424
copy %LIBRARY_LIB%\libpng_static.lib lib\png.lib
2525

26-
:: Make the header files and the rest of the static libs available during the build
27-
:: CONDA_PREFIX is a env variable which is set to the currently active environment path
28-
set MPLBASEDIRLIST=%CONDA_PREFIX%\Library\;.
29-
3026
:: build the target
3127
python setup.py %TARGET%

‎setup.cfg.template

Copy file name to clipboardExpand all lines: setup.cfg.template
-5Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@
33

44
[egg_info]
55

6-
[directories]
7-
# Uncomment to override the default basedir in setupext.py.
8-
# This can be a single directory or a comma-delimited list of directories.
9-
#basedirlist = /usr
10-
116
[test]
127
# If you plan to develop Matplotlib and run or add to the test suite,
138
# set this to True. It will download and build a specific version of

‎setupext.py

Copy file name to clipboardExpand all lines: setupext.py
+31-93Lines changed: 31 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ def write_cache(local_fn, data):
177177
options = {
178178
'display_status': True,
179179
'backend': None,
180-
'basedirlist': None
181180
}
182181

183182

@@ -192,11 +191,6 @@ def write_cache(local_fn, data):
192191
if config.has_option('rc_options', 'backend'):
193192
options['backend'] = config.get("rc_options", "backend")
194193

195-
if config.has_option('directories', 'basedirlist'):
196-
options['basedirlist'] = [
197-
x.strip() for x in
198-
config.get("directories", "basedirlist").split(',')]
199-
200194
if config.has_option('test', 'local_freetype'):
201195
options['local_freetype'] = config.getboolean("test", "local_freetype")
202196
else:
@@ -206,52 +200,6 @@ def write_cache(local_fn, data):
206200
options['local_freetype'] = lft or options.get('local_freetype', False)
207201

208202

209-
def get_base_dirs():
210-
"""
211-
Returns a list of standard base directories on this platform.
212-
"""
213-
if options['basedirlist']:
214-
return options['basedirlist']
215-
216-
if os.environ.get('MPLBASEDIRLIST'):
217-
return os.environ.get('MPLBASEDIRLIST').split(os.pathsep)
218-
219-
win_bases = ['win32_static']
220-
# on conda windows, we also add the <conda_env_dir>\Library,
221-
# as conda installs libs/includes there
222-
# env var names mess: https://github.com/conda/conda/issues/2312
223-
conda_env_path = os.getenv('CONDA_PREFIX') # conda >= 4.1
224-
if not conda_env_path:
225-
conda_env_path = os.getenv('CONDA_DEFAULT_ENV') # conda < 4.1
226-
if conda_env_path and os.path.isdir(conda_env_path):
227-
win_bases.append(os.path.join(conda_env_path, "Library"))
228-
229-
basedir_map = {
230-
'win32': win_bases,
231-
'darwin': ['/usr/local/', '/usr', '/usr/X11',
232-
'/opt/X11', '/opt/local'],
233-
'sunos5': [os.getenv('MPLIB_BASE') or '/usr/local', ],
234-
'gnu0': ['/usr'],
235-
'aix5': ['/usr/local'],
236-
}
237-
return basedir_map.get(sys.platform, ['/usr/local', '/usr'])
238-
239-
240-
def get_include_dirs():
241-
"""
242-
Returns a list of standard include directories on this platform.
243-
"""
244-
include_dirs = [os.path.join(d, 'include') for d in get_base_dirs()]
245-
if sys.platform != 'win32':
246-
# gcc includes these dirs automatically, so also look for headers in
247-
# these dirs
248-
include_dirs.extend(
249-
os.environ.get('CPATH', '').split(os.pathsep))
250-
include_dirs.extend(
251-
os.environ.get('CPLUS_INCLUDE_PATH', '').split(os.pathsep))
252-
return include_dirs
253-
254-
255203
def is_min_version(found, minversion):
256204
"""
257205
Returns whether *found* is a version at least as high as *minversion*.
@@ -285,32 +233,6 @@ def print_line(*args, **kwargs):
285233
print_status = print_message = print_raw = print_line
286234

287235

288-
def make_extension(name, files, *args, **kwargs):
289-
"""
290-
Make a new extension. Automatically sets include_dirs and
291-
library_dirs to the base directories appropriate for this
292-
platform.
293-
294-
`name` is the name of the extension.
295-
296-
`files` is a list of source files.
297-
298-
Any additional arguments are passed to the
299-
`distutils.core.Extension` constructor.
300-
"""
301-
ext = Extension(name, files, *args, **kwargs)
302-
for dir in get_base_dirs():
303-
include_dir = os.path.join(dir, 'include')
304-
if os.path.exists(include_dir):
305-
ext.include_dirs.append(include_dir)
306-
for lib in ('lib', 'lib64'):
307-
lib_dir = os.path.join(dir, lib)
308-
if os.path.exists(lib_dir):
309-
ext.library_dirs.append(lib_dir)
310-
ext.include_dirs.append('.')
311-
return ext
312-
313-
314236
def get_buffer_hash(fd):
315237
BLOCKSIZE = 1 << 16
316238
hasher = hashlib.sha256()
@@ -354,8 +276,10 @@ def set_pkgconfig_path(self):
354276
def setup_extension(self, ext, package,
355277
alt_exec=None, default_libraries=()):
356278
"""Add parameters to the given *ext* for the given *package*."""
357-
cmd = ([self.pkg_config, package] if self.pkg_config
358-
else alt_exec)
279+
280+
# First, try to get the flags from pkg-config.
281+
282+
cmd = ([self.pkg_config, package] if self.pkg_config else alt_exec)
359283
if cmd is not None:
360284
try:
361285
flags = shlex.split(subprocess.check_output(
@@ -371,7 +295,21 @@ def setup_extension(self, ext, package,
371295
ext.extra_compile_args.extend(flags)
372296
ext.extra_link_args.extend(flags)
373297
return
374-
# Else, fall back on the defaults.
298+
299+
# If that fails, fall back on the defaults.
300+
301+
# conda Windows header and library paths.
302+
# https://github.com/conda/conda/issues/2312 re: getting the env dir.
303+
if sys.platform == 'win32':
304+
conda_env_path = (os.getenv('CONDA_PREFIX') # conda >= 4.1
305+
or os.getenv('CONDA_DEFAULT_ENV')) # conda < 4.1
306+
if conda_env_path and os.path.isdir(conda_env_path):
307+
ext.include_dirs.append(os.fspath(
308+
pathlib.Path(conda_env_path, "Library/include")))
309+
ext.library_dirs.append(os.fspath(
310+
pathlib.Path(conda_env_path, "Library/lib")))
311+
312+
# Default linked libs.
375313
ext.libraries.extend(default_libraries)
376314

377315
def get_version(self, package):
@@ -897,7 +835,7 @@ def get_extension(self):
897835
'src/mplutils.cpp',
898836
'src/py_converters.cpp',
899837
]
900-
ext = make_extension('matplotlib.ft2font', sources)
838+
ext = Extension('matplotlib.ft2font', sources)
901839
FreeType().add_flags(ext)
902840
Numpy().add_flags(ext)
903841
LibAgg().add_flags(ext, add_sources=False)
@@ -921,7 +859,7 @@ def get_extension(self):
921859
'src/_png.cpp',
922860
'src/mplutils.cpp',
923861
]
924-
ext = make_extension('matplotlib._png', sources)
862+
ext = Extension('matplotlib._png', sources)
925863
pkg_config.setup_extension(
926864
ext, 'libpng',
927865
alt_exec=['libpng-config', '--cflags', '--ldflags'],
@@ -953,7 +891,7 @@ def get_extension(self):
953891
'extern/ttconv/pprdrv_tt2.cpp',
954892
'extern/ttconv/ttutil.cpp'
955893
]
956-
ext = make_extension('matplotlib.ttconv', sources)
894+
ext = Extension('matplotlib.ttconv', sources)
957895
Numpy().add_flags(ext)
958896
ext.include_dirs.insert(0, 'extern')
959897
return ext
@@ -968,7 +906,7 @@ def get_extension(self):
968906
'src/_path_wrapper.cpp'
969907
]
970908

971-
ext = make_extension('matplotlib._path', sources)
909+
ext = Extension('matplotlib._path', sources)
972910
Numpy().add_flags(ext)
973911
LibAgg().add_flags(ext)
974912
return ext
@@ -984,7 +922,7 @@ def get_extension(self):
984922
'src/_image_wrapper.cpp',
985923
'src/py_converters.cpp'
986924
]
987-
ext = make_extension('matplotlib._image', sources)
925+
ext = Extension('matplotlib._image', sources)
988926
Numpy().add_flags(ext)
989927
LibAgg().add_flags(ext)
990928

@@ -1000,7 +938,7 @@ def get_extension(self):
1000938
"src/_contour_wrapper.cpp",
1001939
'src/py_converters.cpp',
1002940
]
1003-
ext = make_extension('matplotlib._contour', sources)
941+
ext = Extension('matplotlib._contour', sources)
1004942
Numpy().add_flags(ext)
1005943
LibAgg().add_flags(ext, add_sources=False)
1006944
return ext
@@ -1011,8 +949,8 @@ class QhullWrap(SetupPackage):
1011949

1012950
def get_extension(self):
1013951
sources = ['src/qhull_wrap.c']
1014-
ext = make_extension('matplotlib._qhull', sources,
1015-
define_macros=[('MPL_DEVNULL', os.devnull)])
952+
ext = Extension('matplotlib._qhull', sources,
953+
define_macros=[('MPL_DEVNULL', os.devnull)])
1016954
Numpy().add_flags(ext)
1017955
Qhull().add_flags(ext)
1018956
return ext
@@ -1027,7 +965,7 @@ def get_extension(self):
1027965
"src/tri/_tri_wrapper.cpp",
1028966
"src/mplutils.cpp"
1029967
]
1030-
ext = make_extension('matplotlib._tri', sources)
968+
ext = Extension('matplotlib._tri', sources)
1031969
Numpy().add_flags(ext)
1032970
return ext
1033971

@@ -1043,7 +981,7 @@ def get_extension(self):
1043981
"src/_backend_agg.cpp",
1044982
"src/_backend_agg_wrapper.cpp"
1045983
]
1046-
ext = make_extension('matplotlib.backends._backend_agg', sources)
984+
ext = Extension('matplotlib.backends._backend_agg', sources)
1047985
Numpy().add_flags(ext)
1048986
LibAgg().add_flags(ext)
1049987
FreeType().add_flags(ext)
@@ -1063,7 +1001,7 @@ def get_extension(self):
10631001
'src/py_converters.cpp',
10641002
]
10651003

1066-
ext = make_extension('matplotlib.backends._tkagg', sources)
1004+
ext = Extension('matplotlib.backends._tkagg', sources)
10671005
self.add_flags(ext)
10681006
Numpy().add_flags(ext)
10691007
LibAgg().add_flags(ext, add_sources=False)
@@ -1094,7 +1032,7 @@ def get_extension(self):
10941032
'src/_macosx.m'
10951033
]
10961034

1097-
ext = make_extension('matplotlib.backends._macosx', sources)
1035+
ext = Extension('matplotlib.backends._macosx', sources)
10981036
ext.extra_link_args.extend(['-framework', 'Cocoa'])
10991037
if platform.python_implementation().lower() == 'pypy':
11001038
ext.extra_compile_args.append('-DPYPY=1')

‎src/_contour.cpp

Copy file name to clipboardExpand all lines: src/_contour.cpp
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
// to the appropriate make_extension call in setupext.py, and then rebuilding.
77
#define NO_IMPORT_ARRAY
88

9-
#include "src/mplutils.h"
10-
#include "src/_contour.h"
9+
#include "mplutils.h"
10+
#include "_contour.h"
1111
#include <algorithm>
1212

1313

‎src/_contour.h

Copy file name to clipboardExpand all lines: src/_contour.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
#ifndef MPL_CONTOUR_H
143143
#define MPL_CONTOUR_H
144144

145-
#include "src/numpy_cpp.h"
145+
#include "numpy_cpp.h"
146146
#include <stdint.h>
147147
#include <list>
148148
#include <iostream>

‎src/_contour_wrapper.cpp

Copy file name to clipboardExpand all lines: src/_contour_wrapper.cpp
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
#include "src/_contour.h"
2-
#include "src/mplutils.h"
3-
#include "src/py_converters.h"
4-
#include "src/py_exceptions.h"
1+
#include "_contour.h"
2+
#include "mplutils.h"
3+
#include "py_converters.h"
4+
#include "py_exceptions.h"
55

66
/* QuadContourGenerator */
77

‎src/tri/_tri.h

Copy file name to clipboardExpand all lines: src/tri/_tri.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
#ifndef MPL_TRI_H
6464
#define MPL_TRI_H
6565

66-
#include "src/numpy_cpp.h"
66+
#include "../numpy_cpp.h"
6767

6868
#include <iostream>
6969
#include <list>

‎src/tri/_tri_wrapper.cpp

Copy file name to clipboardExpand all lines: src/tri/_tri_wrapper.cpp
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "_tri.h"
2-
#include "src/mplutils.h"
3-
#include "src/py_exceptions.h"
2+
#include "../mplutils.h"
3+
#include "../py_exceptions.h"
44

55

66
/* Triangulation */

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.