1 | |
---|
2 | # FlexpartExecutable |
---|
3 | |
---|
4 | |
---|
5 | ## Overview |
---|
6 | |
---|
7 | This is a class intended for testing the compilation of a FLEXPART distribution. An example of its usage follows |
---|
8 | |
---|
9 | |
---|
10 | import FlexpartExecutable |
---|
11 | |
---|
12 | src_distro = '/home/me/flexpart' |
---|
13 | dest_dir = '/tmp/me/test_compile' |
---|
14 | makefile_name = 'makefile.ecmwf_gfortran' |
---|
15 | expected_exec_name = 'FLEXPART_GFORTRAN' |
---|
16 | |
---|
17 | exec_obj = FlexpartExecutable.FlexpartExecutable( |
---|
18 | srcdir=src_distro, |
---|
19 | destdir=dest_dir, |
---|
20 | makefile=makefile_name, |
---|
21 | executable_name=expected_exec_name) |
---|
22 | |
---|
23 | compile_success = exec_obj.compile_it() |
---|
24 | |
---|
25 | print 'compile_success: ' + str(compile_success) |
---|
26 | |
---|
27 | |
---|
28 | |
---|
29 | The FlexpartExecutable class expects the following arguments |
---|
30 | |
---|
31 | * *srcdir* - location of the FLEXPART distribution to be tested |
---|
32 | * *destdir* - a temporary directory to be used for the actual compile test. The contents of *srcdir* will be copied in here before the compile test. If *destdir* already exists, this will abort. We don't want to accidentally overwrite an important directory that the user might have mistakenly put in as an argument. |
---|
33 | * *makefile_name* - the name of the makefile (in the distribution) to be used for compilation |
---|
34 | * *executable_name* - the expected name of the executable. Its presence will dictate whether compilation was successful or not. |
---|
35 | |
---|
36 | |
---|
37 | |
---|
38 | The pydoc representation: |
---|
39 | |
---|
40 | CLASSES |
---|
41 | FlexpartExecutable |
---|
42 | |
---|
43 | class FlexpartExecutable |
---|
44 | | Methods defined here: |
---|
45 | | |
---|
46 | | __init__(self, srcdir=None, destdir=None, makefile=None, executable_name=None) |
---|
47 | | Set up the class |
---|
48 | | |
---|
49 | | srcdir : full path to location of FLEXPART src tree |
---|
50 | | destdir : full path to copy the FLEXPART src tree into. |
---|
51 | | Files will be copied directly in here |
---|
52 | | makefile : The makefile in destdir to use |
---|
53 | | executable_name : The name of the expected executable (stripped path) |
---|
54 | | |
---|
55 | | compile_it(self) |
---|
56 | | Compile the code. Return True or False depending on success |
---|
57 | | |
---|
58 | | executable_exists(self) |
---|
59 | | Returns True or False depending on whether the expected |
---|
60 | | executable exists. Note that this says nothing about whether it |
---|
61 | | is a good executable or not - simply that an executable file of the |
---|
62 | | expected name exists in the expected location |
---|
63 | | |
---|
64 | | get_expected_executable_path(self) |
---|
65 | | Return path to expected executable. Note that this does not |
---|
66 | | imply that the executable actually exists |
---|
67 | | |
---|
68 | | modify_makefile(self) |
---|
69 | | Can't remember why I might have considered this method |
---|
70 | |
---|
71 | |
---|
72 | |
---|
73 | ## Issues |
---|
74 | |
---|
75 | * For the *makefile* argument, it's probably not a good idea to have it look in destdir for the makefile. Since the intent of this is to test a new version, it's likely that the makefile already in the distribution won't work on the user's machine. So, we might want to specify a makefile that's outside of the new distribution, but known to work on the machine. |
---|
76 | |
---|
77 | |
---|
78 | |
---|
79 | |
---|
80 | |
---|