Skip to content

Commit

Permalink
[py] Add PKG-INFO to sdist
Browse files Browse the repository at this point in the history
  • Loading branch information
jameshilliard committed Dec 9, 2022
1 parent 65e3eb6 commit e701a1b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
14 changes: 14 additions & 0 deletions py/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ load("@py_dev_requirements//:requirements.bzl", "requirement")
load("//common:defs.bzl", "copy_file")
load("//py:defs.bzl", "py_test_suite")
load("//py/private:browsers.bzl", "BROWSERS")
load("//py/private:import.bzl", "py_import")
load("@rules_python//python:pip.bzl", "compile_pip_requirements")

compile_pip_requirements(
Expand Down Expand Up @@ -164,6 +165,7 @@ pkg_files(
"README.rst",
"setup.py",
":selenium-pkg",
":selenium-pkginfo",
],
strip_prefix = strip_prefix.from_pkg(),
)
Expand All @@ -176,6 +178,18 @@ pkg_tar(
package_file_name = "selenium-%s.tar.gz" % SE_VERSION,
)

genrule(
name = "selenium-pkginfo",
srcs = [":selenium-wheel-lib"],
cmd = "cp $(location :selenium-wheel-lib)/selenium-%s.dist-info/METADATA $@" % SE_VERSION,
outs = ["PKG-INFO"],
)

py_import(
name = "selenium-wheel-lib",
wheel = ":selenium-wheel",
)

py_wheel(
name = "selenium-wheel",
classifiers = [
Expand Down
6 changes: 3 additions & 3 deletions py/private/import.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ def _py_import_impl(ctx):
runfiles = runfiles.merge(dep[DefaultInfo].default_runfiles)

imports = depset(
items = [
[
"%s/%s/%s-pyroot" % (ctx.workspace_name, ctx.label.package, ctx.label.name),
],
transitive = [dep[PyInfo].imports for dep in ctx.attr.deps],
)
transitive_sources = depset(
items = [],
[],
transitive = [dep[PyInfo].transitive_sources for dep in ctx.attr.deps],
)

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

return [
DefaultInfo(
files = depset(items = [root]),
files = depset([root]),
default_runfiles = runfiles,
),
info,
Expand Down

0 comments on commit e701a1b

Please sign in to comment.