diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2014-06-15 08:14:12 -0400 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2014-06-15 08:14:12 -0400 |
commit | 80fe9c804ef7f69283cdd6e68e3b2f2da4e6f549 (patch) | |
tree | 86e48e8d5bbb5abafda5d6a8b4d6baf9f9f42c18 /setuptools/command/easy_install.py | |
parent | 1f83ddb9a7817c02cf93caceeb8b0e3d9dbebeaf (diff) | |
download | external_python_setuptools-80fe9c804ef7f69283cdd6e68e3b2f2da4e6f549.tar.gz external_python_setuptools-80fe9c804ef7f69283cdd6e68e3b2f2da4e6f549.tar.bz2 external_python_setuptools-80fe9c804ef7f69283cdd6e68e3b2f2da4e6f549.zip |
Extract embedded function as protected staticmethod.
--HG--
extra : rebase_source : 04b4807ccc7bf95d87797716f5d3488d420fa692
Diffstat (limited to 'setuptools/command/easy_install.py')
-rwxr-xr-x | setuptools/command/easy_install.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index cc5ddbd6..32852e07 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -739,14 +739,6 @@ Please make the appropriate changes for your system and try again. spec = str(dist.as_requirement()) is_script = is_python_script(script_text, script_name) - def get_template(filename): - """ - There are a couple of template scripts in the package. This - function loads one of them and prepares it for use. - """ - raw_bytes = resource_string('setuptools', template_name) - return raw_bytes.decode('utf-8') - if is_script: # See https://bitbucket.org/pypa/setuptools/issue/134 for info # on script file naming and downstream issues with SVR4 @@ -754,9 +746,18 @@ Please make the appropriate changes for your system and try again. if dev_path: template_name = template_name.replace('.tmpl', ' (dev).tmpl') script_text = (get_script_header(script_text) + - get_template(template_name) % locals()) + self._load_template(template_name) % locals()) self.write_script(script_name, _to_ascii(script_text), 'b') + @staticmethod + def _load_template(name): + """ + There are a couple of template scripts in the package. This + function loads one of them and prepares it for use. + """ + raw_bytes = resource_string('setuptools', name) + return raw_bytes.decode('utf-8') + def write_script(self, script_name, contents, mode="t", blockers=()): """Write an executable file to the scripts directory""" self.delete_blockers( # clean up old .py/.pyw w/o a script |