Skip to content

Commit

Permalink
Add proof of concept fix for Unicode bug
Browse files Browse the repository at this point in the history
With these minimal changes the exmaple.zip from pypa#5972 installs
correctly on Windows.

Link: pypa#5972
Signed-off-by: Philippe Ombredanne <[email protected]>
  • Loading branch information
pombredanne committed Jun 28, 2019
1 parent 58c93ac commit 84a792b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/pip/_internal/req/constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ def install_req_from_line(
"""Creates an InstallRequirement from a name, which might be a
requirement, directory containing 'setup.py', filename, or URL.
"""
name = unicode(name)
if is_url(name):
marker_sep = '; '
else:
Expand Down
1 change: 1 addition & 0 deletions src/pip/_internal/utils/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,7 @@ def call_subprocess(
env.update(extra_environ)
for name in unset_environ:
env.pop(name, None)
env = {k: str(v) if isinstance(v, unicode) else v for k, v in env.items()}
try:
proc = subprocess.Popen(
cmd, stderr=subprocess.STDOUT, stdin=subprocess.PIPE,
Expand Down
4 changes: 2 additions & 2 deletions src/pip/_internal/utils/temp_dir.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def create(self):
# scripts, so we canonicalize the path by traversing potential
# symlinks here.
self.path = os.path.realpath(
tempfile.mkdtemp(prefix="pip-{}-".format(self.kind))
tempfile.mkdtemp(prefix=u"pip-{}-".format(self.kind))
)
logger.debug("Created temporary directory: {}".format(self.path))

Expand Down Expand Up @@ -150,6 +150,6 @@ def create(self):
if not self.path:
# Final fallback on the default behavior.
self.path = os.path.realpath(
tempfile.mkdtemp(prefix="pip-{}-".format(self.kind))
tempfile.mkdtemp(prefix=u"pip-{}-".format(self.kind))
)
logger.debug("Created temporary directory: {}".format(self.path))

0 comments on commit 84a792b

Please sign in to comment.