02-fix-for-support-system-python.patch 1.6 KB

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