From 68d566a937ba20a72c52cae4aa1dd4fdbbf21644 Mon Sep 17 00:00:00 2001 From: Michal Cyprian Date: Feb 21 2017 19:17:24 +0000 Subject: Add --executable option to easy_install command --- diff --git a/add-executable-option.patch b/add-executable-option.patch new file mode 100644 index 0000000..a48d28e --- /dev/null +++ b/add-executable-option.patch @@ -0,0 +1,93 @@ +diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py +index 6d85a31..cd9f9ac 100755 +--- a/setuptools/command/easy_install.py ++++ b/setuptools/command/easy_install.py +@@ -147,7 +147,9 @@ class easy_install(Command): + "allow building eggs from local checkouts"), + ('version', None, "print version information and exit"), + ('no-find-links', None, +- "Don't load find-links defined in packages being installed") ++ "Don't load find-links defined in packages being installed"), ++ ('executable=', 'e', ++ "specify final destination interpreter path") + ] + boolean_options = [ + 'zip-ok', 'multi-version', 'exclude-scripts', 'upgrade', 'always-copy', +@@ -210,6 +212,7 @@ class easy_install(Command): + self.distribution._set_command_options( + self, self.distribution.get_option_dict('easy_install') + ) ++ self.executable = None + + def delete_blockers(self, blockers): + extant_blockers = ( +@@ -359,6 +362,8 @@ class easy_install(Command): + "No urls, filenames, or requirements specified (see --help)") + + self.outputs = [] ++ if self.executable is None: ++ self.executable = os.path.normpath(sys.executable) + + def _fix_install_dir_for_user_site(self): + """ +@@ -786,7 +791,8 @@ class easy_install(Command): + def install_wrapper_scripts(self, dist): + if self.exclude_scripts: + return +- for args in ScriptWriter.best().get_args(dist): ++ for args in ScriptWriter.best().get_args( ++ dist, executable=self.executable): + self.write_script(*args) + + def install_script(self, dist, script_name, script_text, dev_path=None): +@@ -972,7 +978,7 @@ class easy_install(Command): + # delete entry-point scripts to avoid duping + self.delete_blockers([ + os.path.join(script_dir, args[0]) +- for args in ScriptWriter.get_args(dist) ++ for args in ScriptWriter.get_args(dist, executable=self.executable) + ]) + # Build .egg file from tmpdir + bdist_egg.make_zipfile( +@@ -2042,13 +2048,13 @@ class ScriptWriter(object): + return cmd.as_header() + + @classmethod +- def get_args(cls, dist, header=None): ++ def get_args(cls, dist, header=None, executable=None): + """ + Yield write_script() argument tuples for a distribution's + console_scripts and gui_scripts entry points. + """ + if header is None: +- header = cls.get_header() ++ header = cls.get_header(executable=executable) + spec = str(dist.as_requirement()) + for type_ in 'console', 'gui': + group = type_ + '_scripts' +diff --git a/setuptools/command/install.py b/setuptools/command/install.py +index 31a5ddb..e468d05 100644 +--- a/setuptools/command/install.py ++++ b/setuptools/command/install.py +@@ -99,6 +99,7 @@ class install(orig.install): + + cmd = easy_install( + self.distribution, args="x", root=self.root, record=self.record, ++ executable=self.executable, + ) + cmd.ensure_finalized() # finalize before bdist_egg munges install cmd + cmd.always_copy_from = '.' # make sure local-dir eggs get installed +diff --git a/setuptools/command/install_scripts.py b/setuptools/command/install_scripts.py +index 1623427..570415d 100755 +--- a/setuptools/command/install_scripts.py ++++ b/setuptools/command/install_scripts.py +@@ -30,7 +30,8 @@ class install_scripts(orig.install_scripts): + ei_cmd.egg_base, PathMetadata(ei_cmd.egg_base, ei_cmd.egg_info), + ei_cmd.egg_name, ei_cmd.egg_version, + ) +- bs_cmd = self.get_finalized_command('build_scripts') ++ bs_cmd = (self.get_finalized_command('build_scripts', create=False) or ++ self.get_finalized_command('install')) + exec_param = getattr(bs_cmd, 'executable', None) + bw_cmd = self.get_finalized_command("bdist_wininst") + is_wininst = getattr(bw_cmd, '_is_running', False) diff --git a/python-setuptools.spec b/python-setuptools.spec index 0ee84a1..2e915f1 100644 --- a/python-setuptools.spec +++ b/python-setuptools.spec @@ -30,7 +30,7 @@ Name: python-setuptools Version: 34.2.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Easily build and distribute Python packages Group: Applications/System @@ -38,6 +38,10 @@ License: MIT URL: https://pypi.python.org/pypi/%{srcname} Source0: https://files.pythonhosted.org/packages/source/s/%{srcname}/%{srcname}-%{version}.zip +# Add --executable option to easy_install command to make it work for +# entry_points +Patch0: add-executable-option.patch + BuildArch: noarch BuildRequires: python2-devel BuildRequires: python2-packaging @@ -140,6 +144,8 @@ rm -f setuptools/*.exe # These tests require internet connection rm setuptools/tests/test_integration.py +%patch0 -p1 + %build %if 0%{?build_wheel} %py2_build_wheel @@ -224,6 +230,9 @@ LANG=en_US.utf8 PYTHONPATH=$(pwd) py.test-%{python3_version} %endif # with_python3 %changelog +* Fri Feb 17 2017 Michal Cyprian - 34.2.0-2 +- Add --executable option to easy_install command + * Thu Feb 16 2017 Charalampos Stratakis - 34.2.0-1 - Update to 34.2.0. Fixes bug #1421676