summaryrefslogtreecommitdiffstats
path: root/debian/patches/remove_vendored_code.patch
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 16:04:56 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 16:04:56 +0000
commit618c9f615c23c8463dea6778481ccfa21dc874b7 (patch)
tree0ab9c8b9f692feb0c0b83851cc68a2c88474b1f0 /debian/patches/remove_vendored_code.patch
parentAdding upstream version 6.13.1. (diff)
downloadansible-lint-debian/6.13.1-1.tar.xz
ansible-lint-debian/6.13.1-1.zip
Adding debian version 6.13.1-1.debian/6.13.1-1debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/patches/remove_vendored_code.patch')
-rw-r--r--debian/patches/remove_vendored_code.patch67
1 files changed, 67 insertions, 0 deletions
diff --git a/debian/patches/remove_vendored_code.patch b/debian/patches/remove_vendored_code.patch
new file mode 100644
index 0000000..c494771
--- /dev/null
+++ b/debian/patches/remove_vendored_code.patch
@@ -0,0 +1,67 @@
+Index: ansible-lint/src/ansiblelint/_vendor/__init__.py
+===================================================================
+--- ansible-lint.orig/src/ansiblelint/_vendor/__init__.py
++++ /dev/null
+@@ -1,48 +0,0 @@
+-import os
+-import pkgutil
+-import sys
+-import warnings
+-
+-# This package exists to host vendored top-level Python packages for downstream packaging. Any Python packages
+-# installed beneath this one will be masked from the Ansible loader, and available from the front of sys.path.
+-# It is expected that the vendored packages will be loaded very early, so a warning will be fired on import of
+-# the top-level ansible package if any packages beneath this are already loaded at that point.
+-#
+-# Python packages may be installed here during downstream packaging using something like:
+-# pip install --upgrade -t (path to this dir) cryptography pyyaml packaging jinja2
+-
+-# mask vendored content below this package from being accessed as a subpackage
+-__path__ = []
+-
+-
+-def _ensure_vendored_path_entry() -> None:
+- """
+- Ensure that any downstream-bundled content beneath this package is available at the top of sys.path
+- """
+- # patch our vendored dir onto sys.path
+- vendored_path_entry = os.path.dirname(__file__)
+- vendored_module_names = {
+- m[1] for m in pkgutil.iter_modules([vendored_path_entry], "")
+- } # m[1] == m.name
+-
+- if vendored_module_names:
+- # patch us early to load vendored deps transparently
+- if vendored_path_entry in sys.path:
+- # handle reload case by removing the existing entry, wherever it might be
+- sys.path.remove(vendored_path_entry)
+- sys.path.insert(0, vendored_path_entry)
+-
+- already_loaded_vendored_modules = set(sys.modules.keys()).intersection(
+- vendored_module_names
+- )
+-
+- if already_loaded_vendored_modules:
+- warnings.warn(
+- "One or more Python packages bundled by this ansible-lint distribution were already "
+- "loaded ({}). This may result in undefined behavior.".format(
+- ", ".join(sorted(already_loaded_vendored_modules))
+- )
+- )
+-
+-
+-_ensure_vendored_path_entry()
+Index: ansible-lint/src/ansiblelint/__init__.py
+===================================================================
+--- ansible-lint.orig/src/ansiblelint/__init__.py
++++ ansible-lint/src/ansiblelint/__init__.py
+@@ -20,7 +20,8 @@
+ """Main ansible-lint package."""
+ from __future__ import annotations
+
+-import ansiblelint._vendor
++# Patched on Debian to remove vendored code.
++#import ansiblelint._vendor
+ from ansiblelint.version import __version__
+
+ # make vendored top-level modules accessible EARLY