MCPcopy Create free account
hub / github.com/cztomczak/cefpython / get_python_include_path

Function get_python_include_path

tools/common.py:270–294  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

268
269
270def get_python_include_path():
271 # 1) C:\Python27\include
272 # 2) ~/.pyenv/versions/2.7.13/bin/python
273 # ~/.pyenv/versions/2.7.13/include/python2.7
274 # 3) ~/.pyenv/versions/3.4.6/include/python2.7m
275 # 4) /usr/include/python2.7
276 base_dir = os.path.dirname(sys.executable)
277 try_dirs = ["{base_dir}/include",
278 "{base_dir}/../include/python{ver}",
279 "{base_dir}/../include/python{ver}*",
280 ("{base_dir}/../Frameworks/Python.framework/Versions/{ver}"
281 "/include/python{ver}*"),
282 "/usr/include/python{ver}"]
283 ver_tuple = sys.version_info[:2]
284 ver = "{major}.{minor}".format(major=ver_tuple[0], minor=ver_tuple[1])
285 for pattern in try_dirs:
286 pattern = pattern.format(base_dir=base_dir, ver=ver)
287 if WINDOWS:
288 pattern = pattern.replace("/", "\\")
289 results = glob.glob(pattern)
290 if len(results) == 1:
291 python_h = os.path.join(results[0], "Python.h")
292 if os.path.isfile(python_h):
293 return results[0]
294 return ".\\" if WINDOWS else "./"
295
296
297g_deleted_sample_apps = []

Callers 2

smart_compileFunction · 0.85
setup_environFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected