Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5783ce3

Browse filesBrowse files
Adjust whl.py for Python 2 and 3
1 parent 79b923c commit 5783ce3
Copy full SHA for 5783ce3

File tree

Expand file treeCollapse file tree

3 files changed

+8
-2
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+8
-2
lines changed

‎packaging/whl.py

Copy file name to clipboardExpand all lines: packaging/whl.py
+8-2Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import pkg_resources
2222
import re
2323
import zipfile
24+
import sys
2425

2526
EXTRA_RE = re.compile("""^(?P<package>.*?)(;\s*(?P<condition>.*?)(extra == '(?P<extra>.*?)')?)$""")
2627
MayRequiresKey = collections.namedtuple('MayRequiresKey', ('condition', 'extra'))
@@ -49,7 +50,7 @@ def version(self):
4950

5051
def repository_name(self):
5152
# Returns the canonical name of the Bazel repository for this package.
52-
canonical = 'pypi__{}_{}'.format(self.distribution(), self.version())
53+
canonical = 'pypi__py{}__{}_{}'.format(sys.version_info.major, self.distribution(), self.version())
5354
# Escape any illegal characters with underscore.
5455
return re.sub('[-.+]', '_', canonical)
5556

@@ -117,7 +118,12 @@ def expand(self, directory):
117118
# _parse_metadata parses METADATA files according to https://www.python.org/dev/peps/pep-0314/
118119
def _parse_metadata(self, content):
119120
metadata = {}
120-
pkg_info = email.parser.Parser().parse(content)
121+
content_str = content.read()
122+
try:
123+
pkg_info = email.parser.Parser().parsestr(content_str)
124+
except:
125+
pkg_info = email.parser.BytesParser().parsebytes(content_str)
126+
121127
metadata['name'] = pkg_info.get('Name')
122128
extras = pkg_info.get_all('Provides-Extra')
123129
if extras:

‎tools/piptool.par

Copy file name to clipboard
6.05 KB
Binary file not shown.

‎tools/whltool.par

Copy file name to clipboard
3.66 KB
Binary file not shown.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.