--- a/mercurial/utils/procutil.py Thu Nov 14 17:36:01 2019 -0800
+++ b/mercurial/utils/procutil.py Thu Nov 14 11:52:22 2019 -0800
@@ -11,7 +11,6 @@
import contextlib
import errno
-import imp
import io
import os
import signal
@@ -32,6 +31,9 @@
pycompat,
)
+# Import like this to keep import-checker happy
+from ..utils import resourceutil
+
osutil = policy.importmod('osutil')
stderr = pycompat.stderr
@@ -254,19 +256,6 @@
return pipefilter(s, cmd)
-def mainfrozen():
- """return True if we are a frozen executable.
-
- The code supports py2exe (most common, Windows only) and tools/freeze
- (portable, not much used).
- """
- return (
- pycompat.safehasattr(sys, "frozen")
- or pycompat.safehasattr(sys, "importers") # new py2exe
- or imp.is_frozen("__main__") # old py2exe
- ) # tools/freeze
-
-
_hgexecutable = None
@@ -280,7 +269,7 @@
mainmod = sys.modules['__main__']
if hg:
_sethgexecutable(hg)
- elif mainfrozen():
+ elif resourceutil.mainfrozen():
if getattr(sys, 'frozen', None) == 'macosx_app':
# Env variable set by py2app
_sethgexecutable(encoding.environ[b'EXECUTABLEPATH'])
@@ -456,7 +445,7 @@
to avoid things opening new shell windows like batch files, so we
get either the python call or current executable.
"""
- if mainfrozen():
+ if resourceutil.mainfrozen():
if getattr(sys, 'frozen', None) == 'macosx_app':
# Env variable set by py2app
return [encoding.environ[b'EXECUTABLEPATH']]