|
10 | 10 |
|
11 | 11 | from time import gmtime,strftime |
12 | 12 |
|
13 | | -import commands |
| 13 | +import subprocess |
14 | 14 | import os |
15 | 15 | import re |
16 | 16 | import sys |
|
30 | 30 |
|
31 | 31 | # Check if we are in the top of the ETSF_IO source tree |
32 | 32 | if ( not os.path.exists("configure.ac") ): |
33 | | - print "%s: You must be in the top of the library source tree." % my_name |
34 | | - print "%s: Aborting now." % my_name |
| 33 | + print("%s: You must be in the top of the library source tree." % my_name) |
| 34 | + print("%s: Aborting now." % my_name) |
35 | 35 | sys.exit(1) |
36 | 36 |
|
37 | 37 | # Read config file(s) |
38 | 38 | for cnf in my_configs: |
39 | 39 | if ( os.path.exists(cnf) ): |
40 | | - execfile(cnf) |
| 40 | + exec(compile(open(cnf, "rb").read(), cnf, 'exec')) |
41 | 41 | else: |
42 | | - print "%s: Could not find config file (%s)." % (my_name,cnf) |
43 | | - print "%s: Aborting now." % my_name |
| 42 | + print("%s: Could not find config file (%s)." % (my_name,cnf)) |
| 43 | + print("%s: Aborting now." % my_name) |
44 | 44 | sys.exit(2) |
45 | 45 |
|
46 | 46 | # Global attributes |
47 | 47 | ead = " ! Global attributes" |
48 | | -for att in etsf_attributes.keys(): |
| 48 | +for att in list(etsf_attributes.keys()): |
49 | 49 | att_desc = etsf_attributes[att] |
50 | 50 |
|
51 | 51 | if ( att in etsf_properties ): |
|
236 | 236 | ivlf = 0 |
237 | 237 | vlf += " integer, parameter :: etsf_%-30s = 0\n" % "specs_none" |
238 | 238 | vlf_id = " character(len = *), parameter :: etsf_specs_names(%d) = (/ &\n" % len(etsf_specifications_files) |
239 | | -for id in etsf_specifications_files.keys(): |
| 239 | +for id in list(etsf_specifications_files.keys()): |
240 | 240 | vlf += " integer, parameter :: etsf_%-30s = %d\n" % (id, 2 ** ivlf) |
241 | 241 | vlf_id += " & \"%-25s\", &\n" % id |
242 | 242 | ivlf += 1 |
|
246 | 246 |
|
247 | 247 |
|
248 | 248 | # Import template |
249 | | -src = file("config/etsf/template.%s" % (etsf_modules["etsf_io"]),"r").read() |
| 249 | +src = open("config/etsf/template.%s" % (etsf_modules["etsf_io"]),"r").read() |
250 | 250 | src = re.sub("@SCRIPT@",my_name,src) |
251 | 251 | src = re.sub("@CONSTANTS@",ead,src) |
252 | 252 | src = re.sub("@FLAGS_GROUPS@",egc,src) |
|
260 | 260 | src = re.sub("@SPLIT_NAME_GROUP@",vsn,src) |
261 | 261 |
|
262 | 262 | # Write module |
263 | | -mod = file(etsf_file_module,"w") |
| 263 | +etsf_file_srcdir = os.path.dirname(etsf_file_module) |
| 264 | +if not os.path.exists(etsf_file_srcdir): |
| 265 | + os.mkdir(etsf_file_srcdir) |
| 266 | +mod = open(etsf_file_module,"w") |
264 | 267 | mod.write(src) |
265 | 268 | mod.close() |
0 commit comments