Show More
@@ -8,7 +8,6 | |||||
8 | # GNU General Public License version 2 or any later version. |
|
8 | # GNU General Public License version 2 or any later version. | |
9 |
|
9 | |||
10 |
|
10 | |||
11 | import _imp |
|
|||
12 | import os |
|
11 | import os | |
13 | import sys |
|
12 | import sys | |
14 |
|
13 | |||
@@ -24,7 +23,12 def mainfrozen(): | |||||
24 | return ( |
|
23 | return ( | |
25 | hasattr(sys, "frozen") # new py2exe |
|
24 | hasattr(sys, "frozen") # new py2exe | |
26 | or hasattr(sys, "importers") # old py2exe |
|
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 | assert dirs[0] == b"mercurial" |
|
48 | assert dirs[0] == b"mercurial" | |
45 | return os.path.join(_rootpath, *dirs[1:]) |
|
49 | return os.path.join(_rootpath, *dirs[1:]) | |
46 |
|
50 | |||
47 |
|
||||
48 | else: |
|
51 | else: | |
49 | datapath = os.path.dirname(os.path.dirname(pycompat.fsencode(__file__))) |
|
52 | datapath = os.path.dirname(os.path.dirname(pycompat.fsencode(__file__))) | |
50 | _rootpath = os.path.dirname(datapath) |
|
53 | _rootpath = os.path.dirname(datapath) | |
@@ -90,7 +93,6 except (ImportError, AttributeError): | |||||
90 | for p in os.listdir(path): |
|
93 | for p in os.listdir(path): | |
91 | yield pycompat.fsencode(p) |
|
94 | yield pycompat.fsencode(p) | |
92 |
|
95 | |||
93 |
|
||||
94 | else: |
|
96 | else: | |
95 | from .. import encoding |
|
97 | from .. import encoding | |
96 |
|
98 |
General Comments 0
You need to be logged in to leave comments.
Login now