Skip to content
This repository was archived by the owner on Mar 23, 2023. It is now read-only.

Commit 9dc9d03

Browse files
committed
Generate _test.go only for _test.py files
1 parent bbf6cb4 commit 9dc9d03

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

tools/genmake

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,17 @@ def main(args):
7070
ar_name = os.path.join(pkg_dir, '__python__', basename + '.a')
7171
go_file = os.path.join(pydir, basename, 'module.go')
7272
gotest_file = os.path.join(pydir, basename, 'module_test.go')
73+
ar_deps = [go_file]
7374
_PrintRule(go_file,
7475
[os.path.join(dirpath, filename)],
7576
['grumpc -modname={} $< > $@'.format(modname)],
7677
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)
8184

8285
recipe = (r"""pydeps -modname=%s $< | awk '{gsub(/\./, "/", $$0); """
8386
r"""print "%s: %s/__python__/" $$0 ".a"}' > $@""")
@@ -86,8 +89,7 @@ def main(args):
8689
[recipe % (modname, ar_name, pkg_dir)])
8790
go_package = '__python__/' + basename.replace(os.sep, '/')
8891
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)])
9193
if args.all_target:
9294
_PrintRule(args.all_target, [ar_name], [])
9395
print '-include {}\n'.format(dep_file)

0 commit comments

Comments
 (0)