gh-135966: Modify iOS testbed to make app_packages a site directory (#135967)

The iOS testbed now treats the app_packages folder as a site folder. This ensures it is
on the path, but also ensures any .pth files are processed on app startup.
This commit is contained in:
Russell Keith-Magee 2025-06-27 12:46:49 +08:00 committed by GitHub
parent 34ce1920ca
commit b38810bab7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 51 additions and 14 deletions

View file

@ -298,9 +298,9 @@ To add Python to an iOS Xcode project:
* Signal handlers (:c:member:`PyConfig.install_signal_handlers`) are *enabled*;
* System logging (:c:member:`PyConfig.use_system_logger`) is *enabled*
(optional, but strongly recommended; this is enabled by default);
* ``PYTHONHOME`` for the interpreter is configured to point at the
* :envvar:`PYTHONHOME` for the interpreter is configured to point at the
``python`` subfolder of your app's bundle; and
* The ``PYTHONPATH`` for the interpreter includes:
* The :envvar:`PYTHONPATH` for the interpreter includes:
- the ``python/lib/python3.X`` subfolder of your app's bundle,
- the ``python/lib/python3.X/lib-dynload`` subfolder of your app's bundle, and
@ -324,7 +324,12 @@ modules in your app, some additional steps will be required:
the ``lib-dynload`` folder can be copied and adapted for this purpose.
* If you're using a separate folder for third-party packages, ensure that folder
is included as part of the ``PYTHONPATH`` configuration in step 10.
is included as part of the :envvar:`PYTHONPATH` configuration in step 10.
* If any of the folders that contain third-party packages will contain ``.pth``
files, you should add that folder as a *site directory* (using
:meth:`site.addsitedir`), rather than adding to :envvar:`PYTHONPATH` or
:attr:`sys.path` directly.
Testing a Python package
------------------------