MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / get_binary_info

Function get_binary_info

src/bonsai/bonsai/__init__.py:226–257  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

224 initialize_bbim_semver()
225
226 def get_binary_info() -> dict[str, Any]:
227 info = {}
228 py_version = sys.version_info
229 site_path = (
230 Path(bpy.utils.user_resource("EXTENSIONS"))
231 / ".local"
232 / "lib"
233 / f"python{py_version.major}.{py_version.minor}"
234 / "site-packages"
235 )
236 lib = site_path / "ifcopenshell"
237 binary = next((i for i in lib.glob("_ifcopenshell_wrapper.*")), None)
238 if binary is None:
239 info["binary_error"] = "Couldn't find ifcopenshell wrapper binary."
240 return info
241
242 # Examples:
243 # _ifcopenshell_wrapper.cp311-win_amd64.pyd
244 # _ifcopenshell_wrapper.cpython-311-darwin.so
245 # _ifcopenshell_wrapper.cpython-311-x86_64-linux-gnu.so
246 binary = binary.name
247 info["binary_file_name"] = binary
248 pattern = re.compile(r"cp(\d+)|cpython-(\d+)")
249 match = pattern.search(binary)
250 if not match:
251 info["binary_error"] = f"Couldn't parse binary version from '{binary}'."
252 return info
253
254 version = match.group(1) or match.group(2)
255 version = f"{version[0]}.{version[1:]}"
256 info["binary_python_version"] = version
257 return info
258
259 def update_commit_data() -> None:
260 try:

Callers 2

drawMethod · 0.85
executeMethod · 0.85

Calls 1

groupMethod · 0.45

Tested by

no test coverage detected