Mariusz,
Thanks for your response!
> I have the impression that more changes are needed to support "freezers".... Are we sure this is the only change that is needed?
Django will indeed require changes beyond today's proposal for full freezer support. I am pursuing an incremental approach here—apologies for being unclear on this point. My intention for this proposal, like the one in
#32177 whose PR you merged, is to remove one failure mode for frozen Django apps without adversely affecting any other users.
I led with this proposal rather than others that would make progress on freezer support because it makes Django more correct and compliant with Python's import API without affecting any existing users. That is, I believe the patch strictly improves Django regardless of PyOxidizer.
(If there's interest, I would be happy to start a new thread to explain what I patched/overrode in Django to get my Django app working in PyOxidizer.)
> how we can avoid regressions and don't break this in the future?
My PR will add the following test case to tests/migrations/test_loader.py:LoaderTests.
def test_loading_package_without__file__(self):
"""Migrations can be found even if the package's __file__ is undefined."""
from migrations import test_migrations
# __file__ == __spec__.origin or the latter is None and former undefined
file = test_migrations.__file__
origin = test_migrations.__spec__.origin
has_location = test_migrations.__spec__.has_location
try:
del test_migrations.__file__
test_migrations.__spec__.origin = None
test_migrations.__spec__.has_location = False
self.test_load()
finally:
test_migrations.__file__ = file
test_migrations.__spec__.origin = origin
test_migrations.__spec__.has_location = has_location
No changes to the existing LoaderTests.test_loading_namespace_package are required.