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

Method needed_modules

Tools/F_scripts/dep.py:110–134  ·  view source on GitHub ↗

determine what modules this file needs. Assume only one use statement per line. Ignore any only clauses. We work off of the preprocessed file if it exists.

(self)

Source from the content-addressed store, hash-verified

108
109
110 def needed_modules(self):
111 """determine what modules this file needs. Assume only one use
112 statement per line. Ignore any only clauses. We work off
113 of the preprocessed file if it exists."""
114
115 depends = []
116
117 with io.open(self.search_name(), "r", encoding="latin-1") as f:
118
119 for line in f:
120
121 # strip off the comments
122 idx = line.find("!")
123 line = line[:idx]
124
125 rebreak = use_re.search(line)
126 if rebreak:
127 used_module = rebreak.group(4)
128 if used_module.lower() not in IGNORES:
129 depends.append(used_module.lower())
130
131 # remove duplicates
132 depends = list(set(depends))
133
134 return depends
135
136
137def doit(prefix, search_path, files, cpp, debug=False):

Callers 1

doitFunction · 0.95

Calls 2

search_nameMethod · 0.95
appendMethod · 0.45

Tested by

no test coverage detected