File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ Implementation for the macro to generate a console_script py_binary from an 'ent
1717"""
1818
1919load ("//python:py_binary.bzl" , "py_binary" )
20+ load ("//python:py_test.bzl" , "py_test" )
2021load (":py_console_script_gen.bzl" , "py_console_script_gen" )
2122
2223def _dist_info (pkg ):
@@ -72,8 +73,14 @@ def py_console_script_binary(
7273 """
7374 main = "rules_python_entry_point_{}.py" .format (name )
7475
75- if kwargs .pop ("srcs" , None ):
76+ srcs = kwargs .pop ("srcs" , [])
77+
78+ if binary_rule == py_test :
79+ srcs = srcs + [main ]
80+ elif srcs :
7681 fail ("passing 'srcs' attribute to py_console_script_binary is unsupported" )
82+ else :
83+ srcs = [main ]
7784
7885 py_console_script_gen (
7986 name = "_{}_gen" .format (name ),
@@ -86,7 +93,7 @@ def py_console_script_binary(
8693
8794 binary_rule (
8895 name = name ,
89- srcs = [ main ] ,
96+ srcs = srcs ,
9097 main = main ,
9198 deps = [pkg ] + kwargs .pop ("deps" , []),
9299 ** kwargs
You can’t perform that action at this time.
0 commit comments