mirror of https://github.com/pypa/pip
Fixed #237 - syntax error on setup.py using DOS line endings, on Python 2.6 and previous.
This commit is contained in:
parent
69486cd969
commit
651e1af613
|
@ -236,7 +236,7 @@ def replacement_run(self):
|
|||
writer(self, ep.name, egg_info.os.path.join(self.egg_info,ep.name))
|
||||
self.find_sources()
|
||||
egg_info.egg_info.run = replacement_run
|
||||
exec(compile(open(__file__).read(), __file__, 'exec'))
|
||||
exec(compile(open(__file__).read().replace('\\r\\n', '\\n'), __file__, 'exec'))
|
||||
"""
|
||||
|
||||
def egg_info_data(self, filename):
|
||||
|
@ -544,11 +544,10 @@ exec(compile(open(__file__).read(), __file__, 'exec'))
|
|||
temp_location = tempfile.mkdtemp('-record', 'pip-')
|
||||
record_filename = os.path.join(temp_location, 'install-record.txt')
|
||||
try:
|
||||
|
||||
install_args = [
|
||||
sys.executable, '-c',
|
||||
"import setuptools;__file__=%r;"\
|
||||
"exec(compile(open(__file__).read(), __file__, 'exec'))" % self.setup_py] +\
|
||||
"exec(compile(open(__file__).read().replace('\\r\\n', '\\n'), __file__, 'exec'))" % self.setup_py] +\
|
||||
list(global_options) + [
|
||||
'install',
|
||||
'--single-version-externally-managed',
|
||||
|
@ -618,7 +617,7 @@ exec(compile(open(__file__).read(), __file__, 'exec'))
|
|||
## FIXME: should we do --install-headers here too?
|
||||
call_subprocess(
|
||||
[sys.executable, '-c',
|
||||
"import setuptools; __file__=%r; exec(compile(open(__file__).read(), __file__, 'exec'))" % self.setup_py]
|
||||
"import setuptools; __file__=%r; exec(compile(open(__file__).read().replace('\\r\\n', '\\n'), __file__, 'exec'))" % self.setup_py]
|
||||
+ list(global_options) + ['develop', '--no-deps'] + list(install_options),
|
||||
|
||||
cwd=self.source_dir, filter_stdout=self._filter_install,
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
from distutils.core import setup
|
||||
|
||||
setup()
|
|
@ -3,7 +3,8 @@ Tests for compatibility workarounds.
|
|||
|
||||
"""
|
||||
import os
|
||||
from tests.test_pip import reset_env, run_pip, pyversion, assert_all_changes
|
||||
from tests.test_pip import (here, reset_env, run_pip, pyversion,
|
||||
assert_all_changes)
|
||||
|
||||
|
||||
def test_debian_egg_name_workaround():
|
||||
|
@ -42,3 +43,14 @@ def test_debian_egg_name_workaround():
|
|||
# Try the uninstall and verify that everything is removed.
|
||||
result2 = run_pip("uninstall", "INITools", "-y")
|
||||
assert_all_changes(result, result2, [env.venv/'build', 'cache'])
|
||||
|
||||
|
||||
def test_setup_py_with_dos_line_endings():
|
||||
"""
|
||||
It doesn't choke on a setup.py file that uses DOS line endings (\\r\\n).
|
||||
|
||||
Refs https://github.com/pypa/pip/issues/237
|
||||
"""
|
||||
reset_env()
|
||||
to_install = os.path.abspath(os.path.join(here, 'packages', 'LineEndings'))
|
||||
run_pip('install', to_install, expect_error=False)
|
||||
|
|
Loading…
Reference in New Issue