aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/importlib-metadata/py2/patches/02-fix-for-support-system-python.patch
blob: b45958358cd31208b073b389f7cd1553f38c1900 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
--- contrib/python/importlib-metadata/py2/importlib_metadata/__init__.py	(index)
+++ contrib/python/importlib-metadata/py2/importlib_metadata/__init__.py	(working tree)
@@ -33,6 +33,11 @@ from ._compat import (
 from importlib import import_module
 from itertools import starmap
 
+try:
+    import library.python.resource
+    ARCADIA = True
+except ImportError:
+    ARCADIA = False
 
 __metaclass__ = type
 
@@ -524,7 +529,7 @@ class Prepared:
             and base.endswith('.egg'))
 
 
-#@install
+@install(ARCADIA == False)
 class MetadataPathFinder(NullFinder, DistributionFinder):
     """A degenerate finder for distribution packages on the file system.
 
@@ -588,7 +593,7 @@ class ArcadiaDistribution(Distribution):
         return '{}{}'.format(self.prefix, path)
 
 
-@install
+@install(ARCADIA == True)
 class ArcadiaMetadataFinder(NullFinder, DistributionFinder):
 
     prefixes = {}
--- contrib/python/importlib-metadata/py2/importlib_metadata/_compat.py	(index)
+++ contrib/python/importlib-metadata/py2/importlib_metadata/_compat.py	(working tree)
@@ -56,7 +56,7 @@ __all__ = [
     ]
 
 
-def install(cls):
+def install(flag):
     """
     Class decorator for installation on sys.meta_path.
 
@@ -64,9 +64,12 @@ def install(cls):
     attempts to disable the finder functionality of the stdlib
     DistributionFinder.
     """
-    sys.meta_path.append(cls())
-    disable_stdlib_finder()
-    return cls
+    def dec_install(cls):
+        if flag:
+            sys.meta_path.append(cls())
+            disable_stdlib_finder()
+        return cls
+    return dec_install
 
 
 def disable_stdlib_finder():