Peano
Loading...
Searching...
No Matches
InvokeExternalTool.py
Go to the documentation of this file.
1
# This file is part of the Peano project. For conditions of distribution and
2
# use, please see the copyright notice at www.peano-framework.org
3
import
os
4
import
re
5
import
subprocess
6
7
class
InvokeExternalTool
(object):
8
def
__init__
(self,instruction_stream,subdirectory):
9
"""
10
call_string How to invoke tool. The invokation will change into subdirectory
11
prior to the program launch.
12
"""
13
self.
instruction_stream
= instruction_stream
14
self.
subdirectory
= subdirectory
15
16
def
generate
(self,overwrite,directory):
17
if
not
os.path.exists( directory +
"/"
+ self.
subdirectory
):
18
os.mkdir(directory +
"/"
+ self.
subdirectory
)
19
20
try
:
21
print(
"invoke "
+ self.
instruction_stream
)
22
returnCode = subprocess.check_call( self.
instruction_stream
, stdout=subprocess.PIPE, shell=
True
, cwd=self.
subdirectory
)
23
if
returnCode!=0:
24
print(
"Error: something went wrong with the program invocation (error code="
+ str(returnCode) +
")"
)
25
except
Exception
as
e:
26
print(
"Error: "
+ str(e) )
peano4.output.InvokeExternalTool.InvokeExternalTool
Definition
InvokeExternalTool.py:7
peano4.output.InvokeExternalTool.InvokeExternalTool.subdirectory
subdirectory
Definition
InvokeExternalTool.py:14
peano4.output.InvokeExternalTool.InvokeExternalTool.generate
generate(self, overwrite, directory)
Definition
InvokeExternalTool.py:16
peano4.output.InvokeExternalTool.InvokeExternalTool.__init__
__init__(self, instruction_stream, subdirectory)
call_string How to invoke tool.
Definition
InvokeExternalTool.py:8
peano4.output.InvokeExternalTool.InvokeExternalTool.instruction_stream
instruction_stream
Definition
InvokeExternalTool.py:13
python
peano4
output
InvokeExternalTool.py
Generated on Thu Mar 6 2025 23:03:25 for Peano by
1.10.0