File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 1616Implementation for the macro to generate a console_script py_binary from an 'entry_points.txt' config.
1717"""
1818
19- load ("//python:py_binary.bzl" , "py_binary" )
19+ load ("//python:py_binary.bzl" , "py_binary" , "py_test" )
2020load (":py_console_script_gen.bzl" , "py_console_script_gen" )
2121
2222def _dist_info (pkg ):
@@ -72,8 +72,14 @@ def py_console_script_binary(
7272 """
7373 main = "rules_python_entry_point_{}.py" .format (name )
7474
75- if kwargs .pop ("srcs" , None ):
75+ srcs = kwargs .pop ("srcs" , None )
76+
77+ if binary_rule == py_test :
78+ srcs = srcs + [main ]
79+ elif srcs :
7680 fail ("passing 'srcs' attribute to py_console_script_binary is unsupported" )
81+ else :
82+ srcs = [main ]
7783
7884 py_console_script_gen (
7985 name = "_{}_gen" .format (name ),
@@ -86,7 +92,7 @@ def py_console_script_binary(
8692
8793 binary_rule (
8894 name = name ,
89- srcs = [ main ] ,
95+ srcs = srcs ,
9096 main = main ,
9197 deps = [pkg ] + kwargs .pop ("deps" , []),
9298 ** kwargs
You can’t perform that action at this time.
0 commit comments