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
This commit is contained in:
Jeremy Stanley 2020-06-13 15:19:33 +00:00 committed by Stephen Finucane
parent 206b795517
commit 9a219f9a4f
1 changed files with 5 additions and 1 deletions

View File

@ -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(