mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I don't know why it doesn't work, but it avoids this fatal error on startup:
  
    > hg debugshell
    Traceback (most recent call last):
      File "hg", line 58, in <module>
      File "mercurial\dispatch.pyc", line 143, in run
      File "mercurial\dispatch.pyc", line 232, in dispatch
      File "mercurial\dispatch.pyc", line 254, in _rundispatch
      File "mercurial\ui.pyc", line 316, in load
      File "mercurial\rcutil.pyc", line 98, in rccomponents
      File "mercurial\rcutil.pyc", line 68, in default_rc_resources
      File "mercurial\utils\resourceutil.pyc", line 102, in contents
      File "<frozen zipimport>", line 775, in contents
    AssertionError
  
  I assume the py2 version of py2exe never hit this because 
`importlib.resources`
  failed to import.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12554

AFFECTED FILES
  mercurial/utils/resourceutil.py

CHANGE DETAILS

diff --git a/mercurial/utils/resourceutil.py b/mercurial/utils/resourceutil.py
--- a/mercurial/utils/resourceutil.py
+++ b/mercurial/utils/resourceutil.py
@@ -61,6 +61,10 @@
     # Force loading of the resources module
     resources.open_binary  # pytype: disable=module-attr
 
+    # py2exe raises an AssertionError if uses importlib.resources
+    if getattr(sys, "frozen", None) in ("console_exe", "windows_exe"):
+        raise ImportError
+
 except (ImportError, AttributeError):
     # importlib.resources was not found (almost definitely because we're on a
     # Python version before 3.7)



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to