Skip to content
Merged
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
2 changes: 2 additions & 0 deletions python/private/toolchains_repo.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ def _resolved_interpreter_os_alias_impl(rctx):
package(default_visibility = ["//visibility:public"])
exports_files(["defs.bzl"])
alias(name = "files", actual = "@{py_repository}_{host_platform}//:files")
alias(name = "includes", actual = "@{py_repository}_{host_platform}//:includes")
alias(name = "py3_runtime", actual = "@{py_repository}_{host_platform}//:py3_runtime")
alias(name = "python_headers", actual = "@{py_repository}_{host_platform}//:python_headers")
alias(name = "python_runtimes", actual = "@{py_repository}_{host_platform}//:python_runtimes")
alias(name = "python3", actual = "@{py_repository}_{host_platform}//:{python3_binary_path}")
""".format(
Expand Down
18 changes: 17 additions & 1 deletion python/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def _python_repository_impl(rctx):

platform = rctx.attr.platform
python_version = rctx.attr.python_version
python_short_version = python_version.rpartition(".")[0]
release_filename = rctx.attr.release_filename
url = rctx.attr.url

Expand Down Expand Up @@ -88,7 +89,6 @@ def _python_repository_impl(rctx):
if "windows" in rctx.os.name:
distutils_path = "Lib/distutils/distutils.cfg"
else:
python_short_version = python_version.rpartition(".")[0]
distutils_path = "lib/python{}/distutils/distutils.cfg".format(python_short_version)
if rctx.attr.distutils:
rctx.file(distutils_path, rctx.read(rctx.attr.distutils))
Expand Down Expand Up @@ -130,6 +130,21 @@ filegroup(
),
)

filegroup(
name = "includes",
srcs = glob(["include/**/*.h"]),
)

cc_library(
name = "python_headers",
hdrs = [":includes"],
includes = [
"include",
"include/python{python_version}",
"include/python{python_version}m",
],
)

exports_files(["{python_path}"])

py_runtime(
Expand All @@ -146,6 +161,7 @@ py_runtime_pair(
)
""".format(
python_path = python_bin,
python_version = python_short_version,
)
rctx.file("BUILD.bazel", build_content)

Expand Down