diff options
author | maxim-yurchuk <maxim-yurchuk@yandex-team.com> | 2024-10-09 12:29:46 +0300 |
---|---|---|
committer | maxim-yurchuk <maxim-yurchuk@yandex-team.com> | 2024-10-09 13:14:22 +0300 |
commit | 9731d8a4bb7ee2cc8554eaf133bb85498a4c7d80 (patch) | |
tree | a8fb3181d5947c0d78cf402aa56e686130179049 /contrib/python/setuptools | |
parent | a44b779cd359f06c3ebbef4ec98c6b38609d9d85 (diff) | |
download | ydb-9731d8a4bb7ee2cc8554eaf133bb85498a4c7d80.tar.gz |
publishFullContrib: true for ydb
<HIDDEN_URL>
commit_hash:c82a80ac4594723cebf2c7387dec9c60217f603e
Diffstat (limited to 'contrib/python/setuptools')
9 files changed, 211 insertions, 0 deletions
diff --git a/contrib/python/setuptools/py2/setuptools/command/launcher manifest.xml b/contrib/python/setuptools/py2/setuptools/command/launcher manifest.xml new file mode 100644 index 0000000000..5972a96d8d --- /dev/null +++ b/contrib/python/setuptools/py2/setuptools/command/launcher manifest.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> + <assemblyIdentity version="1.0.0.0" + processorArchitecture="X86" + name="%(name)s" + type="win32"/> + <!-- Identify the application security requirements. --> + <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> + <security> + <requestedPrivileges> + <requestedExecutionLevel level="asInvoker" uiAccess="false"/> + </requestedPrivileges> + </security> + </trustInfo> +</assembly> diff --git a/contrib/python/setuptools/py2/setuptools/script (dev).tmpl b/contrib/python/setuptools/py2/setuptools/script (dev).tmpl new file mode 100644 index 0000000000..39a24b0488 --- /dev/null +++ b/contrib/python/setuptools/py2/setuptools/script (dev).tmpl @@ -0,0 +1,6 @@ +# EASY-INSTALL-DEV-SCRIPT: %(spec)r,%(script_name)r +__requires__ = %(spec)r +__import__('pkg_resources').require(%(spec)r) +__file__ = %(dev_path)r +with open(__file__) as f: + exec(compile(f.read(), __file__, 'exec')) diff --git a/contrib/python/setuptools/py2/setuptools/script.tmpl b/contrib/python/setuptools/py2/setuptools/script.tmpl new file mode 100644 index 0000000000..ff5efbcab3 --- /dev/null +++ b/contrib/python/setuptools/py2/setuptools/script.tmpl @@ -0,0 +1,3 @@ +# EASY-INSTALL-SCRIPT: %(spec)r,%(script_name)r +__requires__ = %(spec)r +__import__('pkg_resources').run_script(%(spec)r, %(script_name)r) diff --git a/contrib/python/setuptools/py3/.yandex_meta/yamaker.yaml b/contrib/python/setuptools/py3/.yandex_meta/yamaker.yaml new file mode 100644 index 0000000000..82e5cdb5ff --- /dev/null +++ b/contrib/python/setuptools/py3/.yandex_meta/yamaker.yaml @@ -0,0 +1,4 @@ +requirements: + - library/python/resource +mark_as_sources: + - setuptools/command/test.py diff --git a/contrib/python/setuptools/py3/patches/01-arcadia.patch b/contrib/python/setuptools/py3/patches/01-arcadia.patch new file mode 100644 index 0000000000..06a3fa5c28 --- /dev/null +++ b/contrib/python/setuptools/py3/patches/01-arcadia.patch @@ -0,0 +1,93 @@ +--- contrib/python/setuptools/py3/pkg_resources/__init__.py (index) ++++ contrib/python/setuptools/py3/pkg_resources/__init__.py (working tree) +@@ -3222,6 +3222,90 @@ def _mkstemp(*args, **kw): + os.open = old_open + + ++# Yandex resource support ++from __res import Y_PYTHON_SOURCE_ROOT, ResourceImporter, executable ++from library.python import resource ++ ++ ++class ResProvider(EmptyProvider): ++ _resource_fs = {} ++ ++ def __init__(self, prefix): ++ if hasattr(prefix, '__file__'): ++ key = prefix.__file__.rsplit('/', 1)[0] ++ self.module_path = 'resfs/file/{}/'.format(key) ++ # Метаданные лежат на уровень выше самого пакета ++ key = key.rsplit('/', 1)[0] ++ self.egg_info = 'resfs/file/{}/.dist-info/'.format(key) ++ else: ++ # Сюда попадаем только из ResDistribution, который работает ++ # только метаданными, поэтому self.module_path не используется ++ self.egg_info = prefix ++ ++ @staticmethod ++ def from_module(module): ++ if Y_PYTHON_SOURCE_ROOT: ++ return DefaultProvider(module) ++ else: ++ return ResProvider(module) ++ ++ def _fn(self, base, resource_name): ++ return base + resource_name ++ ++ def _has(self, path): ++ return resource.find(path) is not None ++ ++ def _get(self, path): ++ result = resource.find(path) ++ if result is None: ++ raise IOError(path) ++ return result ++ ++ @classmethod ++ def _init_resource_fs(cls): ++ for path in resource.iterkeys(b'resfs/file/'): ++ path_str = path.decode('utf-8') ++ components = path_str.split('/') ++ for l in range(len(components)): ++ subpath = os.path.normpath('/'.join(components[:l])) ++ cls._resource_fs.setdefault(subpath, set()).add(components[l]) ++ ++ def __lookup(self, path): ++ if not self._resource_fs: ++ self._init_resource_fs() ++ path = os.path.normpath(path) ++ return self._resource_fs.get(path) ++ ++ def _listdir(self, path): ++ result = self.__lookup(path) ++ if result is None: ++ return [] ++ return list(result) ++ ++ def _isdir(self, path): ++ return bool(self.__lookup(path)) ++ ++ ++class ResDistribution(DistInfoDistribution): ++ def __init__(self, prefix): ++ super(ResDistribution, self).__init__( ++ location=executable, ++ metadata=ResProvider(prefix), ++ precedence=BINARY_DIST, ++ ) ++ self.project_name = self._parsed_pkg_info.get('Name', self.project_name) ++ ++ ++def find_in_res(importer, path_item, only=False): ++ for key in resource.iterkeys(): ++ if key.endswith('.dist-info/METADATA') and not key.startswith('resfs/src/'): ++ yield ResDistribution(key[:-8]) ++ ++ ++register_finder(ResourceImporter, find_in_res) ++register_loader_type(ResourceImporter, ResProvider.from_module) ++ ++ + # Silence the PEP440Warning by default, so that end users don't get hit by it + # randomly just because they use pkg_resources. We want to append the rule + # because we want earlier uses of filterwarnings to take precedence over this diff --git a/contrib/python/setuptools/py3/patches/02-arcadia.patch b/contrib/python/setuptools/py3/patches/02-arcadia.patch new file mode 100644 index 0000000000..6443f619b8 --- /dev/null +++ b/contrib/python/setuptools/py3/patches/02-arcadia.patch @@ -0,0 +1,57 @@ +--- contrib/python/setuptools/py3/pkg_resources/__init__.py (revision 10490147) ++++ contrib/python/setuptools/py3/pkg_resources/__init__.py (revision 10490148) +@@ -3234,6 +3234,45 @@ + from library.python import resource + + ++class UnionProvider(EmptyProvider): ++ def __init__(self, *pp): ++ self.module_path = [(p, p.module_path) for p in pp] ++ ++ def _has(self, path): ++ for p, pp in path: ++ if p._has(pp): ++ return True ++ ++ return False ++ ++ def _fn(self, base, resource_name): ++ return [(p, p._fn(pp, resource_name)) for p, pp in base] ++ ++ def _get(self, path): ++ for p, pp in path: ++ if p._has(pp): ++ return p._get(pp) ++ ++ raise IOError(path) ++ ++ def _itdir(self, path): ++ for p, pp in path: ++ if not p._isdir(pp): ++ continue ++ for np in p._listdir(pp): ++ yield np ++ ++ def _listdir(self, path): ++ return list(self._itdir(path)) ++ ++ def _isdir(self, path): ++ for p, pp in path: ++ if p._has(pp): ++ return p._isdir(pp) ++ ++ return False ++ ++ + class ResProvider(EmptyProvider): + _resource_fs = {} + +@@ -3252,7 +3289,7 @@ + @staticmethod + def from_module(module): + if Y_PYTHON_SOURCE_ROOT: +- return DefaultProvider(module) ++ return UnionProvider(DefaultProvider(module), ResProvider(module)) + else: + return ResProvider(module) + diff --git a/contrib/python/setuptools/py3/patches/03-arcadia.patch b/contrib/python/setuptools/py3/patches/03-arcadia.patch new file mode 100644 index 0000000000..3629930314 --- /dev/null +++ b/contrib/python/setuptools/py3/patches/03-arcadia.patch @@ -0,0 +1,12 @@ +--- contrib/python/setuptools/py3/pkg_resources/__init__.py (index) ++++ contrib/python/setuptools/py3/pkg_resources/__init__.py (working tree) +@@ -3330,6 +3330,9 @@ class UnionProvider(EmptyProvider): + + return False + ++ def get_resource_filename(self, manager, resource_name): ++ return self._fn(self.module_path, resource_name)[0][1] ++ + + class ResProvider(EmptyProvider): + _resource_fs = {} diff --git a/contrib/python/setuptools/py3/setuptools/command/launcher manifest.xml b/contrib/python/setuptools/py3/setuptools/command/launcher manifest.xml new file mode 100644 index 0000000000..5972a96d8d --- /dev/null +++ b/contrib/python/setuptools/py3/setuptools/command/launcher manifest.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> + <assemblyIdentity version="1.0.0.0" + processorArchitecture="X86" + name="%(name)s" + type="win32"/> + <!-- Identify the application security requirements. --> + <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> + <security> + <requestedPrivileges> + <requestedExecutionLevel level="asInvoker" uiAccess="false"/> + </requestedPrivileges> + </security> + </trustInfo> +</assembly> diff --git a/contrib/python/setuptools/py3/setuptools/script (dev).tmpl b/contrib/python/setuptools/py3/setuptools/script (dev).tmpl new file mode 100644 index 0000000000..39a24b0488 --- /dev/null +++ b/contrib/python/setuptools/py3/setuptools/script (dev).tmpl @@ -0,0 +1,6 @@ +# EASY-INSTALL-DEV-SCRIPT: %(spec)r,%(script_name)r +__requires__ = %(spec)r +__import__('pkg_resources').require(%(spec)r) +__file__ = %(dev_path)r +with open(__file__) as f: + exec(compile(f.read(), __file__, 'exec')) |