Definition at line 16 of file FlexpartExecutable.py.
def flextest.FlexpartExecutable.FlexpartExecutable.__init__ |
( |
|
self, |
|
|
|
srcdir = None , |
|
|
|
destdir = None , |
|
|
|
makefile = None , |
|
|
|
parmodfile = None , |
|
|
|
executable_name = None |
|
) |
| |
Set up the class
srcdir : full path to location of FLEXPART src tree
destdir : full path to copy the FLEXPART src tree into.
Files will be copied directly in here
makefile : The makefile to use - if there is no leading path, then
file is assumed to be in srcdir. Otherwise, it is
assumed to be located as defined by the path
parmodfile : full path to an external (from source code) par_mod.F90
executable_name : The name of the expected executable (stripped path)
Definition at line 21 of file FlexpartExecutable.py.
22 executable_name=
None):
26 srcdir : full path to location of FLEXPART src tree
27 destdir : full path to copy the FLEXPART src tree into.
28 Files will be copied directly in here
29 makefile : The makefile to use - if there is no leading path, then
30 file is assumed to be in srcdir. Otherwise, it is
31 assumed to be located as defined by the path
32 parmodfile : full path to an external (from source code) par_mod.F90
33 executable_name : The name of the expected executable (stripped path)
39 if os.path.isdir(srcdir):
42 msg =
'srcdir not found: ' + srcdir
48 if os.path.isdir(destdir):
49 msg =
'destdir cannot already exist: ' + destdir
54 msg =
'No destdir argument'
63 path_tuple = os.path.split(makefile)
65 if len(path_tuple[0]) == 0:
74 msg =
'source makefile not found: ' + makefile
78 msg =
'No makefile argument'
85 msg =
'No executable_name argument'
91 if os.path.isfile(parmodfile):
94 msg =
'parmodfile not found: ' + parmodfile
105 if not os.path.isdir(destdir):
109 shutil.copytree(srcdir, destdir)
110 logging.info(
'FlexpartExecutable: copying source code to temp location')
114 diffs = filecmp.dircmp(srcdir, destdir)
116 logging.warning(
'FlexpartExecutable: src and dest differ')
122 logging.warning(
'FlexpartExecutable: copy failed')
128 shutil.copy(self.
_parmodfile, destdir +
'/par_mod.F90')
131 logging.warning(
'FlexpartExecutable: parmodfile copy failed')
135 logging.warning(
'FlexpartExecutable: destdir exists')
141 extensions = (
'.o',
'.mod')
142 for current_file
in os.listdir(destdir):
143 if any(current_file.endswith(ext)
for ext
in extensions):
144 os.remove(destdir +
'/' + current_file)