From 2170df350911390a4a9a205763475dc7a7a2fb54 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 4 Jan 2015 16:21:11 -0500 Subject: Move decision logic about windows/header generation closer to install_scripts, as it doesn't appear to be used elsewhere. --- setuptools/command/install_scripts.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'setuptools/command/install_scripts.py') diff --git a/setuptools/command/install_scripts.py b/setuptools/command/install_scripts.py index eb79fa3c..eb5ed0f2 100755 --- a/setuptools/command/install_scripts.py +++ b/setuptools/command/install_scripts.py @@ -13,9 +13,9 @@ class install_scripts(orig.install_scripts): self.no_ep = False def run(self): - from setuptools.command.easy_install import get_script_args - from setuptools.command.easy_install import sys_executable - + from setuptools.command.easy_install import ( + ScriptWriter, sys_executable, get_script_header, + ) self.run_command("egg_info") if self.distribution.scripts: orig.install_scripts.run(self) # run first to set up self.outfiles @@ -35,7 +35,9 @@ class install_scripts(orig.install_scripts): is_wininst = getattr( self.get_finalized_command("bdist_wininst"), '_is_running', False ) - for args in get_script_args(dist, executable, is_wininst): + writer = ScriptWriter.get_writer(force_windows=is_wininst) + header = get_script_header("", executable, wininst=is_wininst) + for args in writer._gen_args(dist, header): self.write_script(*args) def write_script(self, script_name, contents, mode="t", *ignored): -- cgit v1.2.1 From ef9c3db451e2f24fc8821287e79a1ef48e0c5cf5 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 4 Jan 2015 16:43:55 -0500 Subject: Move get_script_header into ScriptWriter --- setuptools/command/install_scripts.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'setuptools/command/install_scripts.py') diff --git a/setuptools/command/install_scripts.py b/setuptools/command/install_scripts.py index eb5ed0f2..de74145f 100755 --- a/setuptools/command/install_scripts.py +++ b/setuptools/command/install_scripts.py @@ -35,8 +35,10 @@ class install_scripts(orig.install_scripts): is_wininst = getattr( self.get_finalized_command("bdist_wininst"), '_is_running', False ) + if is_wininst: + executable = "python.exe" writer = ScriptWriter.get_writer(force_windows=is_wininst) - header = get_script_header("", executable, wininst=is_wininst) + header = get_script_header("", executable) for args in writer._gen_args(dist, header): self.write_script(*args) -- cgit v1.2.1 From c3beddd034239005c98f7285a2936c513c5a81be Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 4 Jan 2015 17:12:37 -0500 Subject: Deprecate and remove usage of easy_install.get_script_header. --- setuptools/command/install_scripts.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'setuptools/command/install_scripts.py') diff --git a/setuptools/command/install_scripts.py b/setuptools/command/install_scripts.py index de74145f..138e4ea2 100755 --- a/setuptools/command/install_scripts.py +++ b/setuptools/command/install_scripts.py @@ -14,7 +14,7 @@ class install_scripts(orig.install_scripts): def run(self): from setuptools.command.easy_install import ( - ScriptWriter, sys_executable, get_script_header, + ScriptWriter, sys_executable, nt_quote_arg, ) self.run_command("egg_info") if self.distribution.scripts: @@ -38,7 +38,7 @@ class install_scripts(orig.install_scripts): if is_wininst: executable = "python.exe" writer = ScriptWriter.get_writer(force_windows=is_wininst) - header = get_script_header("", executable) + header = ScriptWriter.get_header("", nt_quote_arg(executable)) for args in writer._gen_args(dist, header): self.write_script(*args) -- cgit v1.2.1 From 261d57232c74954468688a76aab2caea80ed42fc Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 4 Jan 2015 17:14:11 -0500 Subject: Rename _gen_args to get_args (for consistency). --- setuptools/command/install_scripts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'setuptools/command/install_scripts.py') diff --git a/setuptools/command/install_scripts.py b/setuptools/command/install_scripts.py index 138e4ea2..1717e1cf 100755 --- a/setuptools/command/install_scripts.py +++ b/setuptools/command/install_scripts.py @@ -39,7 +39,7 @@ class install_scripts(orig.install_scripts): executable = "python.exe" writer = ScriptWriter.get_writer(force_windows=is_wininst) header = ScriptWriter.get_header("", nt_quote_arg(executable)) - for args in writer._gen_args(dist, header): + for args in writer.get_args(dist, header): self.write_script(*args) def write_script(self, script_name, contents, mode="t", *ignored): -- cgit v1.2.1 From 3ababa264dc404e9f8eae01045a4531b0b5bd692 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 4 Jan 2015 21:31:05 -0500 Subject: Update install_scripts to use CommandSpec for generating script headers. --- setuptools/command/install_scripts.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'setuptools/command/install_scripts.py') diff --git a/setuptools/command/install_scripts.py b/setuptools/command/install_scripts.py index 1717e1cf..722b0566 100755 --- a/setuptools/command/install_scripts.py +++ b/setuptools/command/install_scripts.py @@ -13,9 +13,8 @@ class install_scripts(orig.install_scripts): self.no_ep = False def run(self): - from setuptools.command.easy_install import ( - ScriptWriter, sys_executable, nt_quote_arg, - ) + from setuptools.command.easy_install import ScriptWriter, CommandSpec + self.run_command("egg_info") if self.distribution.scripts: orig.install_scripts.run(self) # run first to set up self.outfiles @@ -31,15 +30,14 @@ class install_scripts(orig.install_scripts): ei_cmd.egg_name, ei_cmd.egg_version, ) bs_cmd = self.get_finalized_command('build_scripts') - executable = getattr(bs_cmd, 'executable', sys_executable) + cmd = CommandSpec.from_param(getattr(bs_cmd, 'executable', None)) is_wininst = getattr( self.get_finalized_command("bdist_wininst"), '_is_running', False ) if is_wininst: - executable = "python.exe" + cmd = CommandSpec.from_string("python.exe") writer = ScriptWriter.get_writer(force_windows=is_wininst) - header = ScriptWriter.get_header("", nt_quote_arg(executable)) - for args in writer.get_args(dist, header): + for args in writer.get_args(dist, cmd.as_header()): self.write_script(*args) def write_script(self, script_name, contents, mode="t", *ignored): -- cgit v1.2.1 From 921fc3e28378598912d69d3f2a6ebdd090ed3e4e Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 16 Jan 2015 15:33:09 -0500 Subject: Renamed .get_writer to .best and removed boolean argument. --- setuptools/command/install_scripts.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'setuptools/command/install_scripts.py') diff --git a/setuptools/command/install_scripts.py b/setuptools/command/install_scripts.py index 722b0566..ad89c5fd 100755 --- a/setuptools/command/install_scripts.py +++ b/setuptools/command/install_scripts.py @@ -13,7 +13,7 @@ class install_scripts(orig.install_scripts): self.no_ep = False def run(self): - from setuptools.command.easy_install import ScriptWriter, CommandSpec + import setuptools.command.easy_install as ei self.run_command("egg_info") if self.distribution.scripts: @@ -30,14 +30,15 @@ class install_scripts(orig.install_scripts): ei_cmd.egg_name, ei_cmd.egg_version, ) bs_cmd = self.get_finalized_command('build_scripts') - cmd = CommandSpec.from_param(getattr(bs_cmd, 'executable', None)) + cmd = ei.CommandSpec.from_param(getattr(bs_cmd, 'executable', None)) is_wininst = getattr( self.get_finalized_command("bdist_wininst"), '_is_running', False ) + writer = ei.ScriptWriter if is_wininst: - cmd = CommandSpec.from_string("python.exe") - writer = ScriptWriter.get_writer(force_windows=is_wininst) - for args in writer.get_args(dist, cmd.as_header()): + cmd = ei.CommandSpec.from_string("python.exe") + writer = ei.WindowsScriptWriter + for args in writer.best().get_args(dist, cmd.as_header()): self.write_script(*args) def write_script(self, script_name, contents, mode="t", *ignored): -- cgit v1.2.1 From 7cf2343ad9f5b77992422598d27d1f70e9473db0 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 18 Jan 2015 19:45:22 -0500 Subject: Extract variable for bdist_wininst command --- setuptools/command/install_scripts.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'setuptools/command/install_scripts.py') diff --git a/setuptools/command/install_scripts.py b/setuptools/command/install_scripts.py index ad89c5fd..cad524ec 100755 --- a/setuptools/command/install_scripts.py +++ b/setuptools/command/install_scripts.py @@ -31,9 +31,8 @@ class install_scripts(orig.install_scripts): ) bs_cmd = self.get_finalized_command('build_scripts') cmd = ei.CommandSpec.from_param(getattr(bs_cmd, 'executable', None)) - is_wininst = getattr( - self.get_finalized_command("bdist_wininst"), '_is_running', False - ) + bw_cmd = self.get_finalized_command("bdist_wininst") + is_wininst = getattr(bw_cmd, '_is_running', False) writer = ei.ScriptWriter if is_wininst: cmd = ei.CommandSpec.from_string("python.exe") -- cgit v1.2.1 From 0d32bf350dce5cf21c821b9216799fa53550c5c1 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 18 Jan 2015 19:46:46 -0500 Subject: Extract variable for exec_param --- setuptools/command/install_scripts.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'setuptools/command/install_scripts.py') diff --git a/setuptools/command/install_scripts.py b/setuptools/command/install_scripts.py index cad524ec..f85f4520 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_name, ei_cmd.egg_version, ) bs_cmd = self.get_finalized_command('build_scripts') - cmd = ei.CommandSpec.from_param(getattr(bs_cmd, 'executable', None)) + exec_param = getattr(bs_cmd, 'executable', None) + cmd = ei.CommandSpec.from_param(exec_param) bw_cmd = self.get_finalized_command("bdist_wininst") is_wininst = getattr(bw_cmd, '_is_running', False) writer = ei.ScriptWriter -- cgit v1.2.1 From 0a0f7d5816fa7e42fd787d4923265adc965e1360 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 18 Jan 2015 19:54:01 -0500 Subject: Defer resolution of the CommandSpec and do it exactly once. --- setuptools/command/install_scripts.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'setuptools/command/install_scripts.py') diff --git a/setuptools/command/install_scripts.py b/setuptools/command/install_scripts.py index f85f4520..af079fbb 100755 --- a/setuptools/command/install_scripts.py +++ b/setuptools/command/install_scripts.py @@ -31,13 +31,13 @@ class install_scripts(orig.install_scripts): ) bs_cmd = self.get_finalized_command('build_scripts') exec_param = getattr(bs_cmd, 'executable', None) - cmd = ei.CommandSpec.from_param(exec_param) bw_cmd = self.get_finalized_command("bdist_wininst") is_wininst = getattr(bw_cmd, '_is_running', False) writer = ei.ScriptWriter if is_wininst: - cmd = ei.CommandSpec.from_string("python.exe") + exec_param = "python.exe" writer = ei.WindowsScriptWriter + cmd = ei.CommandSpec.from_param(exec_param) for args in writer.best().get_args(dist, cmd.as_header()): self.write_script(*args) -- cgit v1.2.1 From 97f96e8cd4d1938095101f26a28f17d6a3f97435 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 18 Jan 2015 19:55:09 -0500 Subject: Extract writer resolution as a variable --- setuptools/command/install_scripts.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'setuptools/command/install_scripts.py') diff --git a/setuptools/command/install_scripts.py b/setuptools/command/install_scripts.py index af079fbb..8d251ee7 100755 --- a/setuptools/command/install_scripts.py +++ b/setuptools/command/install_scripts.py @@ -37,8 +37,10 @@ class install_scripts(orig.install_scripts): if is_wininst: exec_param = "python.exe" writer = ei.WindowsScriptWriter + # resolve the writer to the environment + writer = writer.best() cmd = ei.CommandSpec.from_param(exec_param) - for args in writer.best().get_args(dist, cmd.as_header()): + for args in writer.get_args(dist, cmd.as_header()): self.write_script(*args) def write_script(self, script_name, contents, mode="t", *ignored): -- cgit v1.2.1 From 43ffa78752de38190b2480b68d9ad908cf1b7fa5 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 18 Jan 2015 19:57:02 -0500 Subject: Allow the CommandSpec class to be resolved by the writer. --- setuptools/command/install_scripts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'setuptools/command/install_scripts.py') diff --git a/setuptools/command/install_scripts.py b/setuptools/command/install_scripts.py index 8d251ee7..9d4ac420 100755 --- a/setuptools/command/install_scripts.py +++ b/setuptools/command/install_scripts.py @@ -39,7 +39,7 @@ class install_scripts(orig.install_scripts): writer = ei.WindowsScriptWriter # resolve the writer to the environment writer = writer.best() - cmd = ei.CommandSpec.from_param(exec_param) + cmd = writer.command_spec_cls.from_param(exec_param) for args in writer.get_args(dist, cmd.as_header()): self.write_script(*args) -- cgit v1.2.1 From e584d52bc8080aa0e1dfec9514068bfef175b7fd Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 18 Jan 2015 20:46:32 -0500 Subject: Correct command reference. --- setuptools/command/install_scripts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'setuptools/command/install_scripts.py') diff --git a/setuptools/command/install_scripts.py b/setuptools/command/install_scripts.py index 9d4ac420..20c2cce9 100755 --- a/setuptools/command/install_scripts.py +++ b/setuptools/command/install_scripts.py @@ -39,7 +39,7 @@ class install_scripts(orig.install_scripts): writer = ei.WindowsScriptWriter # resolve the writer to the environment writer = writer.best() - cmd = writer.command_spec_cls.from_param(exec_param) + cmd = writer.command_spec_class.from_param(exec_param) for args in writer.get_args(dist, cmd.as_header()): self.write_script(*args) -- cgit v1.2.1 From ad794c2809cc2ad0a48a14129dca82996f14af28 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Tue, 20 Jan 2015 20:33:29 -0500 Subject: Use a .best classmethod to resolve JythonCommandSpec when relevant. --- setuptools/command/install_scripts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'setuptools/command/install_scripts.py') diff --git a/setuptools/command/install_scripts.py b/setuptools/command/install_scripts.py index 20c2cce9..be66cb22 100755 --- a/setuptools/command/install_scripts.py +++ b/setuptools/command/install_scripts.py @@ -39,7 +39,7 @@ class install_scripts(orig.install_scripts): writer = ei.WindowsScriptWriter # resolve the writer to the environment writer = writer.best() - cmd = writer.command_spec_class.from_param(exec_param) + cmd = writer.command_spec_class.best().from_param(exec_param) for args in writer.get_args(dist, cmd.as_header()): self.write_script(*args) -- cgit v1.2.1