Skip to content

Commit 4f218e0

Browse files
[py] Add PKG-INFO to sdist (#11379)
Co-authored-by: David Burns <[email protected]>
1 parent 8e4e20b commit 4f218e0

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

py/BUILD.bazel

+14
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ load("@py_dev_requirements//:requirements.bzl", "requirement")
66
load("//common:defs.bzl", "copy_file")
77
load("//py:defs.bzl", "py_test_suite")
88
load("//py/private:browsers.bzl", "BROWSERS")
9+
load("//py/private:import.bzl", "py_import")
910
load("@rules_python//python:pip.bzl", "compile_pip_requirements")
1011

1112
compile_pip_requirements(
@@ -164,6 +165,7 @@ pkg_files(
164165
"README.rst",
165166
"setup.py",
166167
":selenium-pkg",
168+
":selenium-pkginfo",
167169
],
168170
strip_prefix = strip_prefix.from_pkg(),
169171
)
@@ -176,6 +178,18 @@ pkg_tar(
176178
package_file_name = "selenium-%s.tar.gz" % SE_VERSION,
177179
)
178180

181+
genrule(
182+
name = "selenium-pkginfo",
183+
srcs = [":selenium-wheel-lib"],
184+
cmd = "cp $(location :selenium-wheel-lib)/selenium-%s.dist-info/METADATA $@" % SE_VERSION,
185+
outs = ["PKG-INFO"],
186+
)
187+
188+
py_import(
189+
name = "selenium-wheel-lib",
190+
wheel = ":selenium-wheel",
191+
)
192+
179193
py_wheel(
180194
name = "selenium-wheel",
181195
classifiers = [

py/private/import.bzl

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ def _py_import_impl(ctx):
3535
runfiles = runfiles.merge(dep[DefaultInfo].default_runfiles)
3636

3737
imports = depset(
38-
items = [
38+
[
3939
"%s/%s/%s-pyroot" % (ctx.workspace_name, ctx.label.package, ctx.label.name),
4040
],
4141
transitive = [dep[PyInfo].imports for dep in ctx.attr.deps],
4242
)
4343
transitive_sources = depset(
44-
items = [],
44+
[],
4545
transitive = [dep[PyInfo].transitive_sources for dep in ctx.attr.deps],
4646
)
4747

@@ -57,7 +57,7 @@ def _py_import_impl(ctx):
5757

5858
return [
5959
DefaultInfo(
60-
files = depset(items = [root]),
60+
files = depset([root]),
6161
default_runfiles = runfiles,
6262
),
6363
info,

0 commit comments

Comments
 (0)