MCPcopy Create free account
hub / github.com/PyTables/PyTables / get_default_dirs

Function get_default_dirs

setup.py:269–327  ·  view source on GitHub ↗
(conda_prefix: Path | None = None)

Source from the content-addressed store, hash-verified

267
268
269def get_default_dirs(conda_prefix: Path | None = None) -> DefaultDirs:
270 # Order:
271 # * C/CXX flags
272 # * conda prefix
273 # * hardcoded system paths
274
275 header_dirs = None
276 library_dirs = None
277 runtime_dirs = None
278 if conda_prefix:
279 conda_prefix = Path(conda_prefix)
280
281 if os.name == "posix":
282 prefixes = ("/usr/local", "/sw", "/opt", "/opt/local", "/usr", "/")
283 prefix_paths = [Path(x) for x in prefixes]
284
285 header_dirs = []
286 # C/CXX flags
287 add_from_path("CPATH", header_dirs)
288 add_from_path("C_INCLUDE_PATH", header_dirs)
289 add_from_flags("CPPFLAGS", "-I", header_dirs)
290 add_from_flags("CFLAGS", "-I", header_dirs)
291 # conda prefix
292 if conda_prefix:
293 header_dirs.append(conda_prefix / "include")
294 # hardcoded system paths
295 header_dirs.extend(_tree / "include" for _tree in prefix_paths)
296
297 library_dirs = []
298 # C/CXX flags
299 add_from_flags("LDFLAGS", "-L", library_dirs)
300 _archs = ("lib64", "lib")
301 # conda prefix
302 if conda_prefix:
303 library_dirs.extend(conda_prefix / _arch for _arch in _archs)
304 # hardcoded system paths
305 library_dirs.extend(
306 _tree / _arch for _tree in prefix_paths for _arch in _archs
307 )
308 runtime_dirs = library_dirs
309
310 elif os.name == "nt":
311 header_dirs = [] # no default, must be given explicitly
312 library_dirs = [] # no default, must be given explicitly
313 runtime_dirs = [] # look for DLL files in ``%PATH%``
314 if conda_prefix:
315 runtime_dirs.append(conda_prefix / "Library")
316 header_dirs.append(conda_prefix / "Library" / "include")
317 runtime_dirs.extend(
318 Path(_path) for _path in os.environ["PATH"].split(";")
319 )
320 # Add the \Windows\system to the runtime list (necessary for Vista)
321 runtime_dirs.append(Path("\\windows\\system"))
322 # Add the \path_to_python\DLLs and tables package to the list
323 runtime_dirs.append(
324 Path(sys.prefix) / "Lib" / "site-packages" / "tables"
325 )
326

Callers 1

setup.pyFile · 0.85

Calls 4

add_from_pathFunction · 0.85
add_from_flagsFunction · 0.85
DefaultDirsClass · 0.85
appendMethod · 0.45

Tested by

no test coverage detected