Skip to content

Commit 9e349fa

Browse files
committed
Fix astyle dependency
1 parent 0d2d17a commit 9e349fa

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

keras2c/keras2c_main.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,11 @@ def model2c(model, function_name, malloc=False, verbose=True):
9494
header.write(term_sig + '; \n')
9595
if stateful:
9696
header.write(reset_sig + '; \n')
97-
if not subprocess.run(['astyle', '--version']).returncode:
97+
try:
9898
subprocess.run(['astyle', '-n', function_name + '.h'])
9999
subprocess.run(['astyle', '-n', function_name + '.c'])
100+
except FileNotFoundError:
101+
print("astyle not found, {} and {} will not be auto-formatted".format(function_name + ".h", function_name + ".c"))
100102

101103
return malloc_vars.keys(), stateful
102104

keras2c/make_test_suite.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,5 +174,7 @@ def make_test_suite(model, function_name, malloc_vars, num_tests=10, stateful=Fa
174174
return x;}\n\n"""
175175
file.write(s)
176176
file.close()
177-
if not subprocess.run(['astyle', '--version']).returncode:
177+
try:
178178
subprocess.run(['astyle', '-n', function_name + '_test_suite.c'])
179+
except FileNotFoundError:
180+
print("astyle not found, {} will not be auto-formatted".format(function_name + "_test_suite.c"))

0 commit comments

Comments
 (0)