@@ -70,14 +70,17 @@ def main(args):
70
70
ar_name = os .path .join (pkg_dir , '__python__' , basename + '.a' )
71
71
go_file = os .path .join (pydir , basename , 'module.go' )
72
72
gotest_file = os .path .join (pydir , basename , 'module_test.go' )
73
+ ar_deps = [go_file ]
73
74
_PrintRule (go_file ,
74
75
[os .path .join (dirpath , filename )],
75
76
['grumpc -modname={} $< > $@' .format (modname )],
76
77
echo_debug = True )
77
- _PrintRule (gotest_file ,
78
- [os .path .join (dirpath , filename )],
79
- ['gentest -modname={} > $@' .format (modname )],
80
- echo_debug = True )
78
+ if modname .endswith (('_test' , '_tests' )):
79
+ ar_deps .append (gotest_file )
80
+ _PrintRule (gotest_file ,
81
+ [os .path .join (dirpath , filename )],
82
+ ['gentest -modname={} > $@' .format (modname )],
83
+ echo_debug = True )
81
84
82
85
recipe = (r"""pydeps -modname=%s $< | awk '{gsub(/\./, "/", $$0); """
83
86
r"""print "%s: %s/__python__/" $$0 ".a"}' > $@""" )
@@ -86,8 +89,7 @@ def main(args):
86
89
[recipe % (modname , ar_name , pkg_dir )])
87
90
go_package = '__python__/' + basename .replace (os .sep , '/' )
88
91
recipe = 'go tool compile -o $@ -p {} -complete -I {} -pack $<'
89
- _PrintRule (ar_name , [go_file , gotest_file ],
90
- [recipe .format (go_package , pkg_dir )])
92
+ _PrintRule (ar_name , ar_deps , [recipe .format (go_package , pkg_dir )])
91
93
if args .all_target :
92
94
_PrintRule (args .all_target , [ar_name ], [])
93
95
print '-include {}\n ' .format (dep_file )
0 commit comments