Skip to content

Commit

Permalink
setup: fix usage of deprecated get_script_header()
Browse files Browse the repository at this point in the history
For now we catch the AttributeError and use the new
function if the deprecated function does not exist
so that we don't break older versions.
  • Loading branch information
tobias-urdin committed Jul 31, 2023
1 parent 042db9b commit b52f741
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,12 @@ def run(self):
# replaced by the correct interpreter. We do the same here.
bs_cmd = self.get_finalized_command('build_scripts')
executable = getattr(bs_cmd, 'executable', easy_install.sys_executable)
script = easy_install.get_script_header("", executable) + SCRIPT_TMPL
try:
script = easy_install.get_script_header(
"", executable) + SCRIPT_TMPL
except AttributeError:
script = easy_install.ScriptWriter.get_header(
"", executable) + SCRIPT_TMPL
if PY3:
script = script.encode('ascii')
self.write_script("gnocchi-api", script, 'b')
Expand All @@ -74,7 +79,10 @@ def install_wrapper_scripts(self, dist):
develop.develop.install_wrapper_scripts(self, dist)
if self.exclude_scripts:
return
script = easy_install.get_script_header("") + SCRIPT_TMPL
try:
script = easy_install.get_script_header("") + SCRIPT_TMPL
except AttributeError:
script = easy_install.ScriptWriter.get_header("") + SCRIPT_TMPL
if PY3:
script = script.encode('ascii')
self.write_script("gnocchi-api", script, 'b')
Expand Down

0 comments on commit b52f741

Please sign in to comment.