MCPcopy Create free account
hub / github.com/kivy/python-for-android / get_config_wrappers

Method get_config_wrappers

pythonforandroid/recipe.py:1470–1504  ·  view source on GitHub ↗
(self, arch, w_type: str)

Source from the content-addressed store, hash-verified

1468 return self.write_wrapper(arch, "python", file_data)
1469
1470 def get_config_wrappers(self, arch, w_type: str):
1471 wrapper_name = ""
1472 version = ""
1473 include_path = ""
1474
1475 if w_type == "pybind11":
1476 wrapper_name = "pybind11-config"
1477 include_path = join(self._host_recipe.site_dir, "pybind11/include")
1478
1479 version = None
1480 try:
1481 command = [self._host_recipe.real_hostpython_location, "-c", "import pybind11; print(pybind11.__version__)"]
1482 version = subprocess.check_output(command).decode('utf-8').strip()
1483 except Exception:
1484 warning("Unable to get pybind11 version")
1485 if version is None:
1486 version = self.pybind_version
1487
1488 elif w_type == "numpy":
1489 wrapper_name = "numpy-config"
1490 recipe = Recipe.get_recipe("numpy", self.ctx)
1491 include_path = recipe.get_include(arch)
1492 version = recipe.version
1493 else:
1494 raise ValueError(f"Unknown wrapper type: {w_type}")
1495
1496 content = (
1497 f"#!/bin/sh\n"
1498 f"if [ \"$1\" = \"--version\" ]; then\n"
1499 f" echo '{version}'\n"
1500 f"else\n"
1501 f" echo '-I{include_path}'\n"
1502 f"fi\n"
1503 )
1504 return self.write_wrapper(arch, wrapper_name, content)
1505
1506 def get_recipe_meson_options(self, arch):
1507 env = self.get_recipe_env(arch, with_flags_in_cc=True)

Callers 1

Calls 3

write_wrapperMethod · 0.95
get_recipeMethod · 0.80
get_includeMethod · 0.80

Tested by

no test coverage detected