mirror of https://github.com/pulumi/pulumi.git
133 lines
3.0 KiB
Python
133 lines
3.0 KiB
Python
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
|
|
load("@rules_python//python:defs.bzl", "py_binary", "py_library", "py_test")
|
|
load("@rules_python//python:packaging.bzl", "py_wheel")
|
|
load("@pip//:requirements.bzl", "requirement")
|
|
|
|
go_library(
|
|
name = "python",
|
|
srcs = [
|
|
"python.go",
|
|
"shim_unix.go",
|
|
"shim_windows.go",
|
|
],
|
|
importpath = "github.com/pulumi/pulumi/sdk/v3/python",
|
|
visibility = ["//visibility:public"],
|
|
deps = ["//sdk/go/common/util/contract"],
|
|
)
|
|
|
|
alias(
|
|
name = "go_default_library",
|
|
actual = ":python",
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
go_test(
|
|
name = "python_test",
|
|
srcs = ["python_test.go"],
|
|
embed = [":python"],
|
|
deps = ["@com_github_stretchr_testify//assert"],
|
|
)
|
|
|
|
py_library(
|
|
name = "sdk",
|
|
srcs = glob(["lib/setup.py", "lib/pulumi/**/*.py"]),
|
|
imports = ["lib"],
|
|
deps = [
|
|
requirement("dill"),
|
|
requirement("grpcio"),
|
|
requirement("protobuf"),
|
|
requirement("pyyaml"),
|
|
requirement("semver"),
|
|
requirement("six"),
|
|
],
|
|
)
|
|
|
|
py_wheel(
|
|
name = "sdk_wheel",
|
|
deps = [
|
|
":sdk",
|
|
],
|
|
distribution = "pulumi",
|
|
version = "0.0.1",
|
|
summary = "Pulumi's Python SDK",
|
|
description_content_type = "text/markdown",
|
|
description_file = ":README.md",
|
|
homepage = "https://github.com/pulumi/pulumi",
|
|
license = "Apache-2.0",
|
|
python_requires = ">=3.8",
|
|
strip_path_prefixes = [
|
|
"sdk/python/lib",
|
|
],
|
|
)
|
|
|
|
test_srcs = glob([
|
|
"lib/test/**/__init__.py",
|
|
"lib/test/**/test_*.py",
|
|
],
|
|
exclude=[
|
|
#"lib/test/automation/**/*",
|
|
"lib/test/data/**/*",
|
|
#"lib/test/langhost/**/*",
|
|
#"lib/test/provider/**/*",
|
|
#"lib/test/runtime/**/*",
|
|
],
|
|
)
|
|
|
|
langhost_data = glob([
|
|
"lib/test/langhost/**/*.py",
|
|
], exclude=[
|
|
"lib/test/langhost/test_*.py",
|
|
])
|
|
|
|
py_test(
|
|
name = "sdk_test",
|
|
srcs = [
|
|
":pytest.py",
|
|
] + test_srcs,
|
|
main = ":pytest.py",
|
|
args = [
|
|
"--capture=no",
|
|
] + [
|
|
"$(location :{})".format(s) for s in test_srcs
|
|
],
|
|
data = [
|
|
"lib/test/conftest.py",
|
|
"lib/test/helpers.py",
|
|
|
|
"//pkg/cmd/pulumi",
|
|
"//sdk/python/cmd/pulumi-language-python",
|
|
":executor",
|
|
] + langhost_data,
|
|
deps = [
|
|
":sdk",
|
|
|
|
":lazy_import_test",
|
|
|
|
requirement("pytest"),
|
|
requirement("pytest-asyncio"),
|
|
requirement("pytest-timeout"),
|
|
],
|
|
env = {
|
|
"LANGUAGE_HOST": "$(location //sdk/python/cmd/pulumi-language-python)",
|
|
"PULUMI_HACK": "$(location //pkg/cmd/pulumi)",
|
|
},
|
|
legacy_create_init = False,
|
|
)
|
|
|
|
py_library(
|
|
name = "lazy_import_test",
|
|
srcs = glob(["lib/test/data/lazy_import_test/**/*.py"]),
|
|
imports = ["lib/test/data"],
|
|
)
|
|
|
|
py_binary(
|
|
name = "executor",
|
|
srcs = [":cmd/pulumi-language-python-exec.py"],
|
|
main = ":cmd/pulumi-language-python-exec.py",
|
|
deps = [
|
|
":sdk",
|
|
],
|
|
visibility = ["//visibility:public"],
|
|
legacy_create_init = False,
|
|
)
|