MCPcopy Create free account
hub / github.com/AMReX-Codes/amrex / preprocess

Method preprocess

Tools/F_scripts/preprocess.py:43–67  ·  view source on GitHub ↗

preprocess the file described by a SourceFile object sf

(self, sf, add_name="F90PP")

Source from the content-addressed store, hash-verified

41 self.f90_preprocess = f90_preprocess
42
43 def preprocess(self, sf, add_name="F90PP"):
44 """ preprocess the file described by a SourceFile object sf """
45
46 # we want to do:
47 # $(FORT_CPP) $(CPPFLAGS) $< | $(F90PREP) > $(f77TempDir)/$*.f90
48 # we output to the temporary directory
49
50 processed_file = "{}/{}-{}".format(self.temp_dir, add_name,
51 os.path.basename(sf.name))
52
53 if self.f90_preprocess != "" and self.f90_preprocess is not None:
54 command = "{} {} {} | {}".format(self.cpp_cmd, self.defines,
55 sf.name, self.f90_preprocess)
56 else:
57 command = "{} {} {}".format(self.cpp_cmd, self.defines,
58 sf.name)
59
60 stdout, rc = run(command, outfile=processed_file)
61
62 #if rc == 0:
63 sf.cpp_name = processed_file
64 #else:
65 # raise ValueError("cpp process failed for {}".format(sf.name))
66
67 return command
68

Callers 1

doitFunction · 0.80

Calls 2

runFunction · 0.70
formatMethod · 0.45

Tested by

no test coverage detected