diff options
author | Jeremy Stanley <fungi@yuggoth.org> | 2020-06-13 15:19:33 +0000 |
---|---|---|
committer | Stephen Finucane <stephenfin@redhat.com> | 2020-08-06 08:32:13 +0000 |
commit | 9a219f9a4f47243123d50d30938506bcc792e55d (patch) | |
tree | e3cef115a7eceecc37c9f43f6f171da81bc41693 | |
parent | 206b795517a13d759f60ed9605eb03ca785ce10a (diff) | |
download | pbr-9a219f9a4f47243123d50d30938506bcc792e55d.tar.gz |
Use 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).
Change-Id: I2ba68a47dd3f309e356a6e88bf890ac2f80d99a0
-rw-r--r-- | pbr/packaging.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/pbr/packaging.py b/pbr/packaging.py index a697992..68747b6 100644 --- a/pbr/packaging.py +++ b/pbr/packaging.py @@ -456,7 +456,11 @@ class LocalInstallScripts(install_scripts.install_scripts): command_name = 'install_scripts' def _make_wsgi_scripts_only(self, dist, executable, is_wininst): - header = easy_install.get_script_header("", executable, is_wininst) + # 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, is_wininst) wsgi_script_template = ENTRY_POINTS_MAP['wsgi_scripts'] for name, ep in dist.get_entry_map('wsgi_scripts').items(): content = generate_script( |