##// END OF EJS Templates
utils: avoid using internal _imp.is_frozen()...
Mads Kiilerich -
r53003:c5d6a660 stable
parent child Browse files
Show More
@@ -8,7 +8,6
8 8 # GNU General Public License version 2 or any later version.
9 9
10 10
11 import _imp
12 11 import os
13 12 import sys
14 13
@@ -24,7 +23,12 def mainfrozen():
24 23 return (
25 24 hasattr(sys, "frozen") # new py2exe
26 25 or hasattr(sys, "importers") # old py2exe
27 or _imp.is_frozen("__main__") # tools/freeze
26 or getattr(
27 getattr(sys.modules.get('__main__'), '__spec__', None),
28 'origin',
29 None,
30 )
31 == 'frozen' # tools/freeze
28 32 )
29 33
30 34
@@ -44,7 +48,6 if mainfrozen() and getattr(sys, "frozen
44 48 assert dirs[0] == b"mercurial"
45 49 return os.path.join(_rootpath, *dirs[1:])
46 50
47
48 51 else:
49 52 datapath = os.path.dirname(os.path.dirname(pycompat.fsencode(__file__)))
50 53 _rootpath = os.path.dirname(datapath)
@@ -90,7 +93,6 except (ImportError, AttributeError):
90 93 for p in os.listdir(path):
91 94 yield pycompat.fsencode(p)
92 95
93
94 96 else:
95 97 from .. import encoding
96 98
General Comments 0
You need to be logged in to leave comments. Login now