summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Stanley <fungi@yuggoth.org>2020-09-19 13:33:52 +0000
committerJeremy Stanley <fungi@yuggoth.org>2020-09-19 13:47:41 +0000
commit013ca172c996bf90f42f54c1f7ae9c2e9639abbd (patch)
tree57c109b4a0f7ae197681413c99ff9f6badbe461d
parent16f19608c446db67e2ad0950a3209078ec6be18b (diff)
downloadpbr-013ca172c996bf90f42f54c1f7ae9c2e9639abbd.tar.gz
More easy_install.ScriptWriter.get_header()
Setuptools 12.0 deprecated easy_install.get_script_header() when it was released five years ago, and if called with PYTHONWARNINGS=error raises a deprecation exception. Switch to the preferred class method, but keep the original call as a fallback since it won't work on older Setuptools versions (such as the 3.3 shipped with Ubuntu Trusty). This continues 9a219f9a4f47243123d50d30938506bcc792e55d to remove a second call for the same deprecated function. Change-Id: I365075c2cff88283f92298ce2f5e53d263dc7f4b
-rw-r--r--pbr/packaging.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/pbr/packaging.py b/pbr/packaging.py
index 90b9933..ae07796 100644
--- a/pbr/packaging.py
+++ b/pbr/packaging.py
@@ -433,7 +433,11 @@ def generate_script(group, entry_point, header, template):
def override_get_script_args(
dist, executable=os.path.normpath(sys.executable)):
"""Override entrypoints console_script."""
- header = easy_install.get_script_header("", executable)
+ # get_script_header() is deprecated since Setuptools 12.0
+ try:
+ header = easy_install.ScriptWriter.get_header("", executable)
+ except AttributeError:
+ header = easy_install.get_script_header("", executable)
for group, template in ENTRY_POINTS_MAP.items():
for name, ep in dist.get_entry_map(group).items():
yield (name, generate_script(group, ep, header, template))