forked from bazel-contrib/bazel-mypy-integration
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.bzl
43 lines (38 loc) · 1.17 KB
/
config.bzl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
"""
Provides functions to support (optionally) passing the MyPy configuration file
to this integration.
"""
def _create_config_impl(ctx):
if ctx.attr.config_filepath:
user_mypy_config_contents = ctx.read(ctx.attr.config_filepath)
else:
user_mypy_config_contents = "[mypy]"
ctx.file(
"mypy.ini",
content = user_mypy_config_contents,
executable = False,
)
ctx.file(
"BUILD",
content = "exports_files(['mypy.ini'])",
executable = False,
)
create_config = repository_rule(
implementation = _create_config_impl,
attrs = {
"config_filepath": attr.label(
mandatory = False,
allow_single_file = True,
doc = "The path to the mypy.ini, if one is used..",
),
},
)
def mypy_configuration(mypy_config_file = None):
"""**Deprecated**: Instead, see https://github.com/bazel-contrib/bazel-mypy-integration/blob/main/README.md#configuration
Args:
mypy_config_file (Label, optional): The label of a mypy configuration file
"""
create_config(
name = "mypy_integration_config",
config_filepath = mypy_config_file,
)