Skip to content

Commit 9352cb7

Browse files
[build] Fix wheel generation for multiple python versions
1 parent bc75339 commit 9352cb7

1 file changed

Lines changed: 34 additions & 1 deletion

File tree

py/rules_python_any_version_wheel.patch

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,37 @@ index 9cd6534..7802d42 100644
3333
+ doc = "Supported Python major version. 'py2' and/or 'py3'",
3434
),
3535
"version": attr.string(
36-
mandatory = True,
36+
mandatory = True,
37+
diff --git experimental/rules_python/wheelmaker.py experimental/rules_python/wheelmaker.py
38+
index 6be5d38..34b5cb0 100644
39+
--- experimental/rules_python/wheelmaker.py
40+
+++ experimental/rules_python/wheelmaker.py
41+
@@ -61,14 +61,14 @@ class WheelMaker(object):
42+
components = [self._name, self._version]
43+
if self._build_tag:
44+
components.append(self._build_tag)
45+
- components += [self._python_tag, self._abi, self._platform]
46+
+ components += [".".join(self._python_tag), self._abi, self._platform]
47+
return '-'.join(components) + '.whl'
48+
49+
def distname(self):
50+
return self._name + '-' + self._version
51+
52+
def disttags(self):
53+
- return ['-'.join([self._python_tag, self._abi, self._platform])]
54+
+ return ['-'.join([tag, self._abi, self._platform]) for tag in self._python_tag]
55+
56+
def distinfo_path(self, basename):
57+
return self.distname() + '.dist-info/' + basename
58+
@@ -206,7 +206,10 @@ def main():
59+
help="Version of the distribution")
60+
metadata_group.add_argument('--build_tag', type=str, default='',
61+
help="Optional build tag for the distribution")
62+
- metadata_group.add_argument('--python_tag', type=str, default='py3',
63+
+ metadata_group.add_argument('--python_tag',
64+
+ type=str,
65+
+ default=[],
66+
+ action="append",
67+
help="Python version, e.g. 'py2' or 'py3'")
68+
metadata_group.add_argument('--abi', type=str, default='none')
69+
metadata_group.add_argument('--platform', type=str, default='any',

0 commit comments

Comments
 (0)