(self, spec)
| 1489 | compatibility with Apple's iOS App Store policies. |
| 1490 | """ |
| 1491 | def create_module(self, spec): |
| 1492 | # If the ModuleSpec has been created by the FileFinder, it will have |
| 1493 | # been created with an origin pointing to the .fwork file. We need to |
| 1494 | # redirect this to the location in the Frameworks folder, using the |
| 1495 | # content of the .fwork file. |
| 1496 | if spec.origin.endswith(".fwork"): |
| 1497 | with _io.FileIO(spec.origin, 'r') as file: |
| 1498 | framework_binary = file.read().decode().strip() |
| 1499 | bundle_path = _path_split(sys.executable)[0] |
| 1500 | spec.origin = _path_join(bundle_path, framework_binary) |
| 1501 | |
| 1502 | # If the loader is created based on the spec for a loaded module, the |
| 1503 | # path will be pointing at the Framework location. If this occurs, |
| 1504 | # get the original .fwork location to use as the module's __file__. |
| 1505 | if self.path.endswith(".fwork"): |
| 1506 | path = self.path |
| 1507 | else: |
| 1508 | with _io.FileIO(self.path + ".origin", 'r') as file: |
| 1509 | origin = file.read().decode().strip() |
| 1510 | bundle_path = _path_split(sys.executable)[0] |
| 1511 | path = _path_join(bundle_path, origin) |
| 1512 | |
| 1513 | module = _bootstrap._call_with_frames_removed(_imp.create_dynamic, spec) |
| 1514 | |
| 1515 | _bootstrap._verbose_message( |
| 1516 | "Apple framework extension module {!r} loaded from {!r} (path {!r})", |
| 1517 | spec.name, |
| 1518 | spec.origin, |
| 1519 | path, |
| 1520 | ) |
| 1521 | |
| 1522 | # Ensure that the __file__ points at the .fwork location |
| 1523 | try: |
| 1524 | module.__file__ = path |
| 1525 | except AttributeError: |
| 1526 | # Not important enough to report. |
| 1527 | # (The error is also ignored in _bootstrap._init_module_attrs or |
| 1528 | # import_run_extension in import.c) |
| 1529 | pass |
| 1530 | |
| 1531 | return module |
| 1532 | |
| 1533 | # Import setup ############################################################### |
| 1534 |
nothing calls this directly
no test coverage detected