MCPcopy Index your code
hub / github.com/pymupdf/PyMuPDF / base_compiler

Function base_compiler

pipcl.py:1971–2018  ·  view source on GitHub ↗

Returns basic compiler command and PythonFlags. Args: vs: Windows only. A `wdev.WindowsVS` instance or None to use default `wdev.WindowsVS` instance. pythonflags: A `pipcl.PythonFlags` instance or None to use default `pipcl.Py

(vs=None, pythonflags=None, cpp=False, use_env=True)

Source from the content-addressed store, hash-verified

1969
1970
1971def base_compiler(vs=None, pythonflags=None, cpp=False, use_env=True):
1972 '''
1973 Returns basic compiler command and PythonFlags.
1974
1975 Args:
1976 vs:
1977 Windows only. A `wdev.WindowsVS` instance or None to use default
1978 `wdev.WindowsVS` instance.
1979 pythonflags:
1980 A `pipcl.PythonFlags` instance or None to use default
1981 `pipcl.PythonFlags` instance.
1982 cpp:
1983 If true we return C++ compiler command instead of C. On Windows
1984 this has no effect - we always return `cl.exe`.
1985 use_env:
1986 If true we return '$CC' or '$CXX' if the corresponding
1987 environmental variable is set (without evaluating with `getenv()`
1988 or `os.environ`).
1989
1990 Returns `(cc, pythonflags)`:
1991 cc:
1992 C or C++ command. On Windows this is of the form
1993 `{vs.vcvars}&&{vs.cl}`; otherwise it is typically `cc` or `c++`.
1994 pythonflags:
1995 The `pythonflags` arg or a new `pipcl.PythonFlags` instance.
1996 '''
1997 if not pythonflags:
1998 pythonflags = PythonFlags()
1999 cc = None
2000 if use_env:
2001 if cpp:
2002 if os.environ.get( 'CXX'):
2003 cc = '$CXX'
2004 else:
2005 if os.environ.get( 'CC'):
2006 cc = '$CC'
2007 if cc:
2008 pass
2009 elif windows():
2010 if not vs:
2011 vs = wdev.WindowsVS()
2012 cc = f'"{vs.vcvars}"&&"{vs.cl}"'
2013 elif wasm():
2014 cc = 'em++' if cpp else 'emcc'
2015 else:
2016 cc = 'c++' if cpp else 'cc'
2017 cc = macos_add_cross_flags( cc)
2018 return cc, pythonflags
2019
2020
2021def base_linker(vs=None, pythonflags=None, cpp=False, use_env=True):

Callers 1

build_extensionFunction · 0.85

Calls 5

PythonFlagsClass · 0.85
windowsFunction · 0.85
wasmFunction · 0.85
macos_add_cross_flagsFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…