@@ -21,26 +21,22 @@ migrated to Starlark, their implementations will be moved here.
21
21
22
22
load ("@bazel_tools//tools/python:srcs_version.bzl" , _find_requirements = "find_requirements" )
23
23
load ("@bazel_tools//tools/python:toolchain.bzl" , _py_runtime_pair = "py_runtime_pair" )
24
- load ("//python/private:reexports.bzl" , "internal_PyInfo" , "internal_PyRuntimeInfo" )
24
+ load (
25
+ "//python/private:reexports.bzl" ,
26
+ "internal_PyInfo" ,
27
+ "internal_PyRuntimeInfo" ,
28
+ _py_binary = "py_binary" ,
29
+ _py_library = "py_library" ,
30
+ _py_runtime = "py_runtime" ,
31
+ _py_test = "py_test" ,
32
+ )
25
33
26
34
# Exports of native-defined providers.
27
35
28
36
PyInfo = internal_PyInfo
29
37
30
38
PyRuntimeInfo = internal_PyRuntimeInfo
31
39
32
- # The implementation of the macros and tagging mechanism follows the example
33
- # set by rules_cc and rules_java.
34
-
35
- _MIGRATION_TAG = "__PYTHON_RULES_MIGRATION_DO_NOT_USE_WILL_BREAK__"
36
-
37
- def _add_tags (attrs ):
38
- if "tags" in attrs and attrs ["tags" ] != None :
39
- attrs ["tags" ] = attrs ["tags" ] + [_MIGRATION_TAG ]
40
- else :
41
- attrs ["tags" ] = [_MIGRATION_TAG ]
42
- return attrs
43
-
44
40
def _current_py_toolchain_impl (ctx ):
45
41
toolchain = ctx .toolchains [ctx .attr ._toolchain ]
46
42
@@ -84,36 +80,6 @@ current_py_toolchain = rule(
84
80
],
85
81
)
86
82
87
- def py_library (** attrs ):
88
- """See the Bazel core [py_library](https://docs.bazel.build/versions/master/be/python.html#py_library) documentation.
89
-
90
- Args:
91
- **attrs: Rule attributes
92
- """
93
-
94
- # buildifier: disable=native-python
95
- native .py_library (** _add_tags (attrs ))
96
-
97
- def py_binary (** attrs ):
98
- """See the Bazel core [py_binary](https://docs.bazel.build/versions/master/be/python.html#py_binary) documentation.
99
-
100
- Args:
101
- **attrs: Rule attributes
102
- """
103
-
104
- # buildifier: disable=native-python
105
- native .py_binary (** _add_tags (attrs ))
106
-
107
- def py_test (** attrs ):
108
- """See the Bazel core [py_test](https://docs.bazel.build/versions/master/be/python.html#py_test) documentation.
109
-
110
- Args:
111
- **attrs: Rule attributes
112
- """
113
-
114
- # buildifier: disable=native-python
115
- native .py_test (** _add_tags (attrs ))
116
-
117
83
def _py_import_impl (ctx ):
118
84
# See https://github.com/bazelbuild/bazel/blob/0.24.0/src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPythonSemantics.java#L104 .
119
85
import_paths = [
@@ -164,18 +130,16 @@ py_import = rule(
164
130
},
165
131
)
166
132
167
- def py_runtime (** attrs ):
168
- """See the Bazel core [py_runtime](https://docs.bazel.build/versions/master/be/python.html#py_runtime) documentation.
169
-
170
- Args:
171
- **attrs: Rule attributes
172
- """
173
-
174
- # buildifier: disable=native-python
175
- native .py_runtime (** _add_tags (attrs ))
176
-
177
133
# Re-exports of Starlark-defined symbols in @bazel_tools//tools/python.
178
134
179
135
py_runtime_pair = _py_runtime_pair
180
136
181
137
find_requirements = _find_requirements
138
+
139
+ py_library = _py_library
140
+
141
+ py_binary = _py_binary
142
+
143
+ py_test = _py_test
144
+
145
+ py_runtime = _py_runtime
0 commit comments