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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. --- contrib/python/importlib-metadata/py3/importlib_metadata/__init__.py (index)
  2. +++ contrib/python/importlib-metadata/py3/importlib_metadata/__init__.py (working tree)
  3. @@ -31,4 +31,10 @@ from importlib.abc import MetaPathFinder
  4. from typing import List, Mapping, Optional
  5. +try:
  6. + import __res as res
  7. + ARCADIA = True
  8. +except ImportError:
  9. + ARCADIA = False
  10. +
  11. __all__ = [
  12. @@ -712,3 +718,3 @@ class Prepared:
  13. -@install
  14. +@install(ARCADIA == False)
  15. class MetadataPathFinder(NullFinder, DistributionFinder):
  16. @@ -813,3 +819,3 @@ class ArcadiaDistribution(Distribution):
  17. -@install
  18. +@install(ARCADIA == True)
  19. class ArcadiaMetadataFinder(NullFinder, DistributionFinder):
  20. --- contrib/python/importlib-metadata/py3/importlib_metadata/_compat.py (index)
  21. +++ contrib/python/importlib-metadata/py3/importlib_metadata/_compat.py (working tree)
  22. @@ -15,11 +15,14 @@ except ImportError: # pragma: no cover
  23. -def install(cls):
  24. - """
  25. - Class decorator for installation on sys.meta_path.
  26. -
  27. - Adds the backport DistributionFinder to sys.meta_path and
  28. - attempts to disable the finder functionality of the stdlib
  29. - DistributionFinder.
  30. - """
  31. - sys.meta_path.append(cls())
  32. - disable_stdlib_finder()
  33. - return cls
  34. +def install(flag):
  35. + def dec_install(cls):
  36. + """
  37. + Class decorator for installation on sys.meta_path.
  38. +
  39. + Adds the backport DistributionFinder to sys.meta_path and
  40. + attempts to disable the finder functionality of the stdlib
  41. + DistributionFinder.
  42. + """
  43. + if flag:
  44. + sys.meta_path.append(cls())
  45. + disable_stdlib_finder()
  46. + return cls
  47. + return dec_install