Skip to content
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
13 changes: 12 additions & 1 deletion rules_python/whl.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ def version(self):
parts = self.basename().split('-')
return parts[1]

def build_tag(self):
# See https://www.python.org/dev/peps/pep-0427/#file-name-convention
parts = self.basename().split('-')
if len(parts) == 5:
return None
return parts[2]

def repository_name(self):
# Returns the canonical name of the Bazel repository for this package.
canonical = 'pypi__{}_{}'.format(self.distribution(), self.version())
Expand All @@ -52,7 +59,11 @@ def _dist_info(self):
# Return the name of the dist-info directory within the .whl file.
# e.g. google_cloud-0.27.0-py2.py3-none-any.whl ->
# google_cloud-0.27.0.dist-info
return '{}-{}.dist-info'.format(self.distribution(), self.version())
build_tag = self.build_tag()
name = '{}-{}'.format(self.distribution(), self.version())
if build_tag is not None:
name += '-' + build_tag
return '{}.dist-info'.format(name)

def metadata(self):
# Extract the structured data from metadata.json in the WHL's dist-info
Expand Down
Binary file modified tools/piptool.par
Binary file not shown.
Binary file modified tools/whltool.par
Binary file not shown.