Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix UnicodeDecodeError in Py2.7 #451

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion piptools/_compat/tempfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ class TemporaryDirectory(object):
def __init__(self, suffix="", prefix="tmp", dir=None):
self._closed = False
self.name = None # Handle mkdtemp raising an exception
self.name = mkdtemp(suffix, prefix, dir)
self.name = mkdtemp(
suffix.encode(), prefix.encode(), dir.encode() if dir else None)

def __repr__(self):
return "<{} {!r}>".format(self.__class__.__name__, self.name)
Expand Down
7 changes: 6 additions & 1 deletion piptools/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import json
import os
import re
import sys

from pkg_resources import Requirement
Expand Down Expand Up @@ -159,6 +160,10 @@ def _reverse_dependencies(self, cache_keys):
"""
# First, collect all the dependencies into a sequence of (parent, child) tuples, like [('flake8', 'pep8'),
# ('flake8', 'mccabe'), ...]
return lookup_table((key_from_req(Requirement.parse(dep_name)), name)
return lookup_table((key_from_req(parse(dep_name)), name)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is not related to the issue you are trying to fix. Please open another PR for the package extras related modification, and remove this commit.

for name, version_and_extras in cache_keys
for dep_name in self.cache[name][version_and_extras])


def parse(dep_name):
return Requirement.parse(re.sub(r';.*$', '', dep_name))