mirror of
https://gitlab.com/scemama/irpf90.git
synced 2024-10-30 10:48:15 +01:00
Merge branch 'Python3'
This commit is contained in:
commit
50cc3413e4
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
# IRPF90 is a Fortran90 preprocessor written in Python for programming using
|
||||
# the Implicit Reference to Parameters (IRP) method.
|
||||
# Copyright (C) 2009 Anthony SCEMAMA
|
||||
|
@ -37,7 +37,7 @@ case "$0" in
|
||||
echo "source " $0
|
||||
fi
|
||||
else
|
||||
exec python2 $(dirname $0)/../src/irpman.py $1
|
||||
exec python3 $(dirname $0)/../src/irpman.py $1
|
||||
fi
|
||||
;;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
# IRPF90 is a Fortran90 preprocessor written in Python for programming using
|
||||
# the Implicit Reference to Parameters (IRP) method.
|
||||
# Copyright (C) 2009 Anthony SCEMAMA
|
||||
|
@ -1,4 +1,4 @@
|
||||
IRPF90 = python2 ../src/irpf90.py -I input
|
||||
IRPF90 = python3 ../src/irpf90.py -I input
|
||||
FC = ifort
|
||||
FCFLAGS= -O2
|
||||
NINJA =
|
||||
|
Binary file not shown.
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import sys, os
|
||||
wd = os.path.abspath(os.path.dirname(__file__))
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
function run ()
|
||||
{
|
||||
cat << EOF | exec python2 - $@
|
||||
cat << EOF | exec python3 - $@
|
||||
import sys, os
|
||||
|
||||
from irpf90_libs.irpf90_t import mandir
|
||||
|
@ -0,0 +1,4 @@
|
||||
# For relative imports to work in Python 3.6
|
||||
import os, sys
|
||||
sys.path = [ os.path.dirname(os.path.realpath(__file__)) ] + sys.path
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
# IRPF90 is a Fortran90 preprocessor written in Python for programming using
|
||||
# the Implicit Reference to Parameters (IRP) method.
|
||||
# Copyright (C) 2009 Anthony SCEMAMA
|
||||
@ -36,10 +36,10 @@ FILENAME=irpdir+'irp_checkpoint.irp.F90'
|
||||
|
||||
def create():
|
||||
out_write = [ "subroutine irp_checkpoint_write" ]
|
||||
l = variables.keys()
|
||||
l = list(variables.keys())
|
||||
l.sort
|
||||
main_modules = filter(lambda x: modules[x].is_main, modules)
|
||||
for m in filter(lambda x: not modules[x].is_main, modules):
|
||||
main_modules = [x for x in modules if modules[x].is_main]
|
||||
for m in [x for x in modules if not modules[x].is_main]:
|
||||
out_write += [ " use %s"%(modules[m].name) ]
|
||||
out_write += [ " implicit none" ]
|
||||
out_write += [ " integer, parameter :: iunit = %d"%(CHECKPOINT_UNIT_NUMBER) ]
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
# IRPF90 is a Fortran90 preprocessor written in Python for programming using
|
||||
# the Implicit Reference to Parameters (IRP) method.
|
||||
# Copyright (C) 2009 Anthony SCEMAMA
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
# IRPF90 is a Fortran90 preprocessor written in Python for programming using
|
||||
# the Implicit Reference to Parameters (IRP) method.
|
||||
# Copyright (C) 2009 Anthony SCEMAMA
|
||||
@ -76,7 +76,7 @@ class CommandLine(object):
|
||||
for o,a in self.opts:
|
||||
if o in [ "-I", '--'+options['I'][0] ]:
|
||||
if len(a) < 1:
|
||||
print "Error: -I option needs a directory"
|
||||
print("Error: -I option needs a directory")
|
||||
if a[-1] != '/':
|
||||
a = a+'/'
|
||||
self._include_dir.append(a)
|
||||
@ -116,12 +116,12 @@ class CommandLine(object):
|
||||
elif len(buffer) == 3:
|
||||
self._codelet = [buffer[0], int(buffer[2]), buffer[1], filename]
|
||||
else:
|
||||
print """
|
||||
print("""
|
||||
Error in codelet definition. Use:
|
||||
--codelet=provider:NMAX
|
||||
or
|
||||
--codelet=provider:precondition:NMAX
|
||||
"""
|
||||
""")
|
||||
sys.exit(1)
|
||||
return self._codelet
|
||||
codelet = property(fget=codelet)
|
||||
@ -209,11 +209,11 @@ Options:
|
||||
"""
|
||||
t = t.replace("$EXE",self.executable_name)
|
||||
t = t.replace("$DESCR",description)
|
||||
print t
|
||||
print(t)
|
||||
print_options()
|
||||
print ""
|
||||
print "Version : ", version
|
||||
print ""
|
||||
print("")
|
||||
print("Version : ", version)
|
||||
print("")
|
||||
|
||||
def opts(self):
|
||||
if self._opts is None:
|
||||
@ -228,10 +228,10 @@ Options:
|
||||
|
||||
try:
|
||||
self._opts, args = getopt.getopt(self.argv[1:], optlist[0], optlist[1])
|
||||
except getopt.GetoptError, err:
|
||||
except getopt.GetoptError as err:
|
||||
# print help information and exit:
|
||||
self.usage()
|
||||
print str(err) # will print something like "option -a not recognized"
|
||||
print(str(err)) # will print something like "option -a not recognized"
|
||||
sys.exit(2)
|
||||
|
||||
return self._opts
|
||||
@ -248,9 +248,9 @@ def do_$LONG(self):
|
||||
return self._do_$LONG
|
||||
do_$LONG = property(fget=do_$LONG)
|
||||
"""
|
||||
for short in options:
|
||||
long = options[short][0]
|
||||
exec t.replace("$LONG",long).replace("$SHORT",short) #in locals()
|
||||
for short_opt in options:
|
||||
long_opt = options[short_opt][0]
|
||||
exec(t.replace("$LONG",long_opt).replace("$SHORT",short_opt)) #in locals()
|
||||
|
||||
def do_run(self):
|
||||
if '_do_run' not in self.__dict__:
|
||||
@ -267,16 +267,16 @@ do_$LONG = property(fget=do_$LONG)
|
||||
command_line = CommandLine()
|
||||
|
||||
def print_options():
|
||||
keys = options.keys()
|
||||
keys = list(options.keys())
|
||||
keys.sort()
|
||||
import subprocess
|
||||
for k in keys:
|
||||
description = options[k][1]
|
||||
p1 = subprocess.Popen(["fold", "-s", "-w", "40"],stdout=subprocess.PIPE,stdin=subprocess.PIPE)
|
||||
p1 = subprocess.Popen(["fold", "-s", "-w", "40"],stdout=subprocess.PIPE,stdin=subprocess.PIPE, encoding='utf8')
|
||||
description = p1.communicate(description)[0]
|
||||
description = description.replace('\n','\n'.ljust(27))
|
||||
print ("-%s, --%s"%(k,options[k][0])).ljust(25), description+'\n'
|
||||
print "\n"
|
||||
print(("-%s, --%s"%(k,options[k][0])).ljust(25), description+'\n')
|
||||
print("\n")
|
||||
|
||||
if __name__ == '__main__':
|
||||
print_options()
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
# IRPF90 is a Fortran90 preprocessor written in Python for programming using
|
||||
# the Implicit Reference to Parameters (IRP) method.
|
||||
# Copyright (C) 2009 Anthony SCEMAMA
|
||||
@ -36,11 +36,11 @@ from util import *
|
||||
def do_print_short(file,var):
|
||||
"""Makes a short print, as in irpf90_entities"""
|
||||
assert type(var) == Variable
|
||||
print >>file, "%s : %s :: %s %s"%( \
|
||||
print("%s : %s :: %s %s"%( \
|
||||
var.line.filename[0].ljust(35),
|
||||
var.type.ljust(30),
|
||||
var.name.ljust(25),
|
||||
build_dim(var.dim) )
|
||||
build_dim(var.dim) ), file=file)
|
||||
|
||||
######################################################################
|
||||
def process_doc(file,line):
|
||||
@ -48,13 +48,13 @@ def process_doc(file,line):
|
||||
line = line.strip()
|
||||
if line == "":
|
||||
line = ".br"
|
||||
print >>file, line
|
||||
print(line, file=file)
|
||||
|
||||
######################################################################
|
||||
def process_deps(file,l):
|
||||
assert type(l) == list
|
||||
for v in l:
|
||||
print >>file, "%s\n.br"%(v,)
|
||||
print("%s\n.br"%(v,), file=file)
|
||||
|
||||
######################################################################
|
||||
def process_types(file,var):
|
||||
@ -65,7 +65,7 @@ def process_types(file,var):
|
||||
var = variables[var]
|
||||
Type = var.type
|
||||
dim = build_dim(var.dim)
|
||||
print >>file, "%s\t:: %s\t%s"%(Type,name,dim)
|
||||
print("%s\t:: %s\t%s"%(Type,name,dim), file=file)
|
||||
|
||||
######################################################################
|
||||
def do_print(var):
|
||||
@ -73,32 +73,32 @@ def do_print(var):
|
||||
filename = var.line.filename[0]
|
||||
name = var.name
|
||||
file = open("%s%s.l"%(mandir,var.name), "w")
|
||||
print >>file, '.TH "IRPF90 entities" l %s "IRPF90 entities" %s'%(name,name)
|
||||
print('.TH "IRPF90 entities" l %s "IRPF90 entities" %s'%(name,name), file=file)
|
||||
if var.same_as != var.name:
|
||||
var = variables[var.same_as]
|
||||
print >>file, ".SH Declaration"
|
||||
print >>file, ".nf"
|
||||
print(".SH Declaration", file=file)
|
||||
print(".nf", file=file)
|
||||
process_types(file,var)
|
||||
print >>file, ".ni"
|
||||
print(".ni", file=file)
|
||||
if var.doc != []:
|
||||
print >>file, ".SH Description"
|
||||
print(".SH Description", file=file)
|
||||
for l in var.doc:
|
||||
process_doc(file,l)
|
||||
print >>file, ".SH File\n.P"
|
||||
print >>file, filename
|
||||
print(".SH File\n.P", file=file)
|
||||
print(filename, file=file)
|
||||
if var.needs != []:
|
||||
var.needs.sort()
|
||||
print >>file, ".SH Needs"
|
||||
print(".SH Needs", file=file)
|
||||
process_deps(file,var.needs)
|
||||
if var.needed_by != []:
|
||||
var.needed_by.sort()
|
||||
print >>file, ".SH Needed by"
|
||||
print(".SH Needed by", file=file)
|
||||
process_deps(file,var.needed_by)
|
||||
print >>file, ".SH Instability factor"
|
||||
print(".SH Instability factor", file=file)
|
||||
fo = len(var.children)
|
||||
fi = len(var.parents)
|
||||
print >>file, "%5.1f %%"%(100.* (fi / (fi+fo+.000001) ))
|
||||
print >>file, ".br"
|
||||
print("%5.1f %%"%(100.* (fi / (fi+fo+.000001) )), file=file)
|
||||
print(".br", file=file)
|
||||
file.close()
|
||||
|
||||
######################################################################
|
||||
@ -108,12 +108,12 @@ def do_print_rst(var):
|
||||
filename = var.line.filename[0]
|
||||
name = var.name
|
||||
file = open("%s%s.rst"%(mandir,var.name), "w")
|
||||
print >>file, ".. c:var:: %s\n"%(var.name.lower())
|
||||
print >>file, ""
|
||||
print >>file, " File : :file:`"+filename+"`"
|
||||
print >>file, ""
|
||||
print >>file, " .. code:: fortran"
|
||||
print >>file, ""
|
||||
print(".. c:var:: %s\n"%(var.name.lower()), file=file)
|
||||
print("", file=file)
|
||||
print(" File : :file:`"+filename+"`", file=file)
|
||||
print("", file=file)
|
||||
print(" .. code:: fortran", file=file)
|
||||
print("", file=file)
|
||||
if var.same_as != var.name:
|
||||
var = variables[var.same_as]
|
||||
for v in [var.name] + var.others:
|
||||
@ -121,9 +121,9 @@ def do_print_rst(var):
|
||||
v = variables[v]
|
||||
Type = v.type
|
||||
dim = build_dim(v.dim)
|
||||
print >>file, " %s\t:: %s\t%s"%(Type,name,dim)
|
||||
print >>file, ""
|
||||
print >>file, ""
|
||||
print(" %s\t:: %s\t%s"%(Type,name,dim), file=file)
|
||||
print("", file=file)
|
||||
print("", file=file)
|
||||
|
||||
if var.doc != []:
|
||||
d = []
|
||||
@ -146,33 +146,33 @@ def do_print_rst(var):
|
||||
if loop:
|
||||
d = [ l[1:] for l in d ]
|
||||
for line in d:
|
||||
print >>file, " "+line
|
||||
print >>file, ""
|
||||
print(" "+line, file=file)
|
||||
print("", file=file)
|
||||
if var.needs != []:
|
||||
var.needs.sort()
|
||||
print >>file, " Needs:"
|
||||
print >>file, ""
|
||||
print >>file, " .. hlist::"
|
||||
print >>file, " :columns: 3"
|
||||
print >>file, ""
|
||||
print(" Needs:", file=file)
|
||||
print("", file=file)
|
||||
print(" .. hlist::", file=file)
|
||||
print(" :columns: 3", file=file)
|
||||
print("", file=file)
|
||||
for v in var.needs:
|
||||
print >>file, " * :c:data:`%s`"%(variables[v].same_as.lower(),)
|
||||
print >>file, ""
|
||||
print(" * :c:data:`%s`"%(variables[v].same_as.lower(),), file=file)
|
||||
print("", file=file)
|
||||
if var.needed_by != []:
|
||||
var.needed_by.sort()
|
||||
print >>file, " Needed by:"
|
||||
print >>file, ""
|
||||
print >>file, " .. hlist::"
|
||||
print >>file, " :columns: 3"
|
||||
print >>file, ""
|
||||
print(" Needed by:", file=file)
|
||||
print("", file=file)
|
||||
print(" .. hlist::", file=file)
|
||||
print(" :columns: 3", file=file)
|
||||
print("", file=file)
|
||||
for v in var.needed_by:
|
||||
print >>file, " * :c:data:`%s`"%(variables[v].same_as.lower(),)
|
||||
print >>file, ""
|
||||
print(" * :c:data:`%s`"%(variables[v].same_as.lower(),), file=file)
|
||||
print("", file=file)
|
||||
file.close()
|
||||
|
||||
######################################################################
|
||||
def process_declaration_subroutine(file, sub):
|
||||
print >>file, sub.line.text.split('!')[0].strip()
|
||||
print(sub.line.text.split('!')[0].strip(), file=file)
|
||||
|
||||
# for line in sub.text:
|
||||
######################################################################
|
||||
@ -181,38 +181,38 @@ def do_print_subroutines(sub):
|
||||
filename = sub.line.filename
|
||||
name = sub.name
|
||||
file = open("%s%s.l"%(mandir,sub.name), "w")
|
||||
print >>file, '.TH "IRPF90 entities" l %s "IRPF90 entities" %s'%(name,name)
|
||||
print >>file, ".SH Declaration"
|
||||
print >>file, ".nf"
|
||||
print('.TH "IRPF90 entities" l %s "IRPF90 entities" %s'%(name,name), file=file)
|
||||
print(".SH Declaration", file=file)
|
||||
print(".nf", file=file)
|
||||
process_declaration_subroutine(file,sub)
|
||||
print >>file, ".ni"
|
||||
print(".ni", file=file)
|
||||
if sub.doc != []:
|
||||
print >>file, ".SH Description"
|
||||
print(".SH Description", file=file)
|
||||
for l in sub.doc:
|
||||
process_doc(file,l)
|
||||
print >>file, ".SH File\n.P"
|
||||
print >>file, filename
|
||||
print(".SH File\n.P", file=file)
|
||||
print(filename, file=file)
|
||||
if sub.needs != []:
|
||||
sub.needs.sort()
|
||||
print >>file, ".SH Needs"
|
||||
print(".SH Needs", file=file)
|
||||
process_deps(file,sub.needs)
|
||||
if sub.called_by != []:
|
||||
sub.called_by.sort()
|
||||
print >>file, ".SH Called by"
|
||||
print(".SH Called by", file=file)
|
||||
process_deps(file,sub.called_by)
|
||||
if sub.calls != []:
|
||||
sub.calls.sort()
|
||||
print >>file, ".SH Calls"
|
||||
print(".SH Calls", file=file)
|
||||
process_deps(file,sub.calls)
|
||||
if sub.touches != []:
|
||||
sub.touches.sort()
|
||||
print >>file, ".SH Touches"
|
||||
print(".SH Touches", file=file)
|
||||
process_deps(file,sub.touches)
|
||||
print >>file, ".SH Instability factor"
|
||||
print(".SH Instability factor", file=file)
|
||||
fo = len(sub.needs)+len(sub.calls)+len(sub.touches)
|
||||
fi = len(sub.called_by)
|
||||
print >>file, "%5.1f %%"%(100.* (fi / (fi+fo+.000001) ))
|
||||
print >>file, ".br"
|
||||
print("%5.1f %%"%(100.* (fi / (fi+fo+.000001) )), file=file)
|
||||
print(".br", file=file)
|
||||
file.close()
|
||||
|
||||
######################################################################
|
||||
@ -222,15 +222,15 @@ def do_print_subroutines_rst(sub):
|
||||
filename = sub.line.filename
|
||||
name = sub.name
|
||||
file = open("%s%s.rst"%(mandir,sub.name), "w")
|
||||
print >>file, ".. c:function:: %s:\n"%(sub.name.lower())
|
||||
print >>file, ""
|
||||
print >>file, " File : :file:`"+filename+"`"
|
||||
print >>file, ""
|
||||
print >>file, " .. code:: fortran"
|
||||
print >>file, ""
|
||||
print >>file, " "+sub.line.text.split('!')[0].strip()
|
||||
print >>file, ""
|
||||
print >>file, ""
|
||||
print(".. c:function:: %s:\n"%(sub.name.lower()), file=file)
|
||||
print("", file=file)
|
||||
print(" File : :file:`"+filename+"`", file=file)
|
||||
print("", file=file)
|
||||
print(" .. code:: fortran", file=file)
|
||||
print("", file=file)
|
||||
print(" "+sub.line.text.split('!')[0].strip(), file=file)
|
||||
print("", file=file)
|
||||
print("", file=file)
|
||||
if sub.doc != []:
|
||||
d = list(sub.doc)
|
||||
loop = True
|
||||
@ -246,51 +246,51 @@ def do_print_subroutines_rst(sub):
|
||||
if loop:
|
||||
d = [ l[1:] for l in d ]
|
||||
for l in d:
|
||||
print >>file, " "+l
|
||||
print >>file, ""
|
||||
print(" "+l, file=file)
|
||||
print("", file=file)
|
||||
if sub.needs != []:
|
||||
sub.needs.sort()
|
||||
print >>file, " Needs:"
|
||||
print >>file, ""
|
||||
print >>file, " .. hlist::"
|
||||
print >>file, " :columns: 3"
|
||||
print >>file, ""
|
||||
print(" Needs:", file=file)
|
||||
print("", file=file)
|
||||
print(" .. hlist::", file=file)
|
||||
print(" :columns: 3", file=file)
|
||||
print("", file=file)
|
||||
for v in sub.needs:
|
||||
print >>file, " * :c:data:`%s`"%(variables[v].same_as.lower(),)
|
||||
print >>file, ""
|
||||
print(" * :c:data:`%s`"%(variables[v].same_as.lower(),), file=file)
|
||||
print("", file=file)
|
||||
if sub.called_by != []:
|
||||
sub.called_by.sort()
|
||||
print >>file, " Called by:"
|
||||
print >>file, ""
|
||||
print >>file, " .. hlist::"
|
||||
print >>file, " :columns: 3"
|
||||
print >>file, ""
|
||||
print(" Called by:", file=file)
|
||||
print("", file=file)
|
||||
print(" .. hlist::", file=file)
|
||||
print(" :columns: 3", file=file)
|
||||
print("", file=file)
|
||||
for v in sub.called_by:
|
||||
if v in subroutines:
|
||||
print >>file, " * :c:func:`%s`"%(v.lower(),)
|
||||
print(" * :c:func:`%s`"%(v.lower(),), file=file)
|
||||
elif v in variables:
|
||||
print >>file, " * :c:data:`%s`"%(variables[v.lower()].same_as.lower(),)
|
||||
print >>file, ""
|
||||
print(" * :c:data:`%s`"%(variables[v.lower()].same_as.lower(),), file=file)
|
||||
print("", file=file)
|
||||
if sub.calls != []:
|
||||
sub.calls.sort()
|
||||
print >>file, " Calls:"
|
||||
print >>file, ""
|
||||
print >>file, " .. hlist::"
|
||||
print >>file, " :columns: 3"
|
||||
print >>file, ""
|
||||
print(" Calls:", file=file)
|
||||
print("", file=file)
|
||||
print(" .. hlist::", file=file)
|
||||
print(" :columns: 3", file=file)
|
||||
print("", file=file)
|
||||
for v in sub.calls:
|
||||
print >>file, " * :c:func:`%s`"%(v.lower(),)
|
||||
print >>file, ""
|
||||
print(" * :c:func:`%s`"%(v.lower(),), file=file)
|
||||
print("", file=file)
|
||||
if sub.touches != []:
|
||||
sub.touches.sort()
|
||||
print >>file, " Touches:"
|
||||
print >>file, ""
|
||||
print >>file, " .. hlist::"
|
||||
print >>file, " :columns: 3"
|
||||
print >>file, ""
|
||||
print(" Touches:", file=file)
|
||||
print("", file=file)
|
||||
print(" .. hlist::", file=file)
|
||||
print(" :columns: 3", file=file)
|
||||
print("", file=file)
|
||||
for v in sub.touches:
|
||||
print >>file, " * :c:data:`%s`"%(variables[v.lower()].same_as.lower(),)
|
||||
print >>file, ""
|
||||
print(" * :c:data:`%s`"%(variables[v.lower()].same_as.lower(),), file=file)
|
||||
print("", file=file)
|
||||
file.close()
|
||||
|
||||
######################################################################
|
||||
@ -299,10 +299,10 @@ def run():
|
||||
import os,sys
|
||||
pid1 = os.fork()
|
||||
if pid1 == 0:
|
||||
for v in variables.values():
|
||||
for v in list(variables.values()):
|
||||
do_print(v)
|
||||
do_print_rst(v)
|
||||
for s in subroutines.values():
|
||||
for s in list(subroutines.values()):
|
||||
do_print_subroutines(s)
|
||||
do_print_subroutines_rst(s)
|
||||
sys.exit(0)
|
||||
@ -310,7 +310,7 @@ def run():
|
||||
pid2 = os.fork()
|
||||
if pid2 == 0:
|
||||
tags = []
|
||||
l = variables.keys()
|
||||
l = list(variables.keys())
|
||||
file = open("irpf90_entities","w")
|
||||
l.sort()
|
||||
for v in l:
|
||||
@ -318,7 +318,7 @@ def run():
|
||||
line = variables[v].line
|
||||
tags.append( '%s\t%s\t%d\n'%(v,line.filename[0],line.i) )
|
||||
file.close()
|
||||
l = subroutines.keys()
|
||||
l = list(subroutines.keys())
|
||||
for v in l:
|
||||
line = subroutines[v].line
|
||||
tags.append('%s\t%s\t%d\n'%(v,line.filename,line.i))
|
||||
|
20
src/error.py
20
src/error.py
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
# IRPF90 is a Fortran90 preprocessor written in Python for programming using
|
||||
# the Implicit Reference to Parameters (IRP) method.
|
||||
# Copyright (C) 2009 Anthony SCEMAMA
|
||||
@ -32,14 +32,14 @@ do_warnings = command_line.do_warnings
|
||||
|
||||
######################################################################
|
||||
def fail(line,message):
|
||||
print """
|
||||
print("""
|
||||
Error:
|
||||
-----
|
||||
"""
|
||||
print message, '\n'
|
||||
""")
|
||||
print(message, '\n')
|
||||
if line is not None:
|
||||
assert isinstance(line,Line)
|
||||
print "file %s ; line %d :\n %s"%(line.filename,line.i,line.text)
|
||||
print("file %s ; line %d :\n %s"%(line.filename,line.i,line.text))
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
@ -49,14 +49,14 @@ def warn(line,message):
|
||||
return
|
||||
if line is not None:
|
||||
assert isinstance(line,Line)
|
||||
print """
|
||||
print("""
|
||||
Warning:
|
||||
-------
|
||||
"""
|
||||
print message, '\n'
|
||||
print "file %s, line %d:\n %s"%(line.filename,line.i,line.text)
|
||||
""")
|
||||
print(message, '\n')
|
||||
print("file %s, line %d:\n %s"%(line.filename,line.i,line.text))
|
||||
else:
|
||||
print "Warning: %s"%(message)
|
||||
print("Warning: %s"%(message))
|
||||
|
||||
|
||||
######################################################################
|
||||
|
27
src/init.py
27
src/init.py
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
# IRPF90 is a Fortran90 preprocessor written in Python for programming using
|
||||
# the Implicit Reference to Parameters (IRP) method.
|
||||
# Copyright (C) 2009 Anthony SCEMAMA
|
||||
# Copyright (C) 2009 Anthony SCEMAMA
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -20,8 +20,8 @@
|
||||
# Anthony Scemama
|
||||
# LCPQ - IRSAMC - CNRS
|
||||
# Universite Paul Sabatier
|
||||
# 118, route de Narbonne
|
||||
# 31062 Toulouse Cedex 4
|
||||
# 118, route de Narbonne
|
||||
# 31062 Toulouse Cedex 4
|
||||
# scemama@irsamc.ups-tlse.fr
|
||||
|
||||
|
||||
@ -61,13 +61,13 @@ def init():
|
||||
|
||||
# Create makefile
|
||||
makefile.create()
|
||||
|
||||
|
||||
# Copy current files in the irpdir
|
||||
for dir in ['./']+command_line.include_dir:
|
||||
try:
|
||||
os.stat(dir)
|
||||
except:
|
||||
print dir,'not in dir'
|
||||
print(dir,'not in dir')
|
||||
continue
|
||||
for filename in os.listdir(dir):
|
||||
filename = dir+filename
|
||||
@ -76,14 +76,17 @@ def init():
|
||||
file = open(filename,"r")
|
||||
except IOError:
|
||||
if command_line.do_warnings:
|
||||
print "Warning : Unable to read file %s."%(filename)
|
||||
print("Warning : Unable to read file %s."%(filename))
|
||||
else:
|
||||
buffer = file.read()
|
||||
file.close()
|
||||
if not util.same_file(irpf90_t.irpdir+filename,buffer):
|
||||
file = open(irpf90_t.irpdir+filename,"w")
|
||||
file.write(buffer)
|
||||
try:
|
||||
buffer = file.read()
|
||||
file.close()
|
||||
if not util.same_file(irpf90_t.irpdir+filename,buffer):
|
||||
file = open(irpf90_t.irpdir+filename,"w")
|
||||
file.write(buffer)
|
||||
file.close()
|
||||
except UnicodeError:
|
||||
pass
|
||||
|
||||
initialized = True
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
# IRPF90 is a Fortran90 preprocessor written in Python for programming using
|
||||
# the Implicit Reference to Parameters (IRP) method.
|
||||
# Copyright (C) 2009 Anthony SCEMAMA
|
||||
@ -149,7 +149,7 @@ end subroutine
|
||||
"""
|
||||
|
||||
txt = txt.split('\n')
|
||||
txt = map(lambda x: x+"\n",txt)
|
||||
txt = [x+"\n" for x in txt]
|
||||
if not util.same_file(FILENAME, txt):
|
||||
file = open(FILENAME,'w')
|
||||
file.writelines(txt)
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
# IRPF90 is a Fortran90 preprocessor written in Python for programming using
|
||||
# the Implicit Reference to Parameters (IRP) method.
|
||||
# Copyright (C) 2009 Anthony SCEMAMA
|
||||
@ -33,7 +33,6 @@ try:
|
||||
sys.path.insert(0,(wd+"/../src/"))
|
||||
except:
|
||||
pass
|
||||
sys.setcheckinterval(1000)
|
||||
|
||||
from command_line import command_line
|
||||
|
||||
@ -46,7 +45,7 @@ def main():
|
||||
|
||||
if command_line.do_version:
|
||||
from version import version
|
||||
print version
|
||||
print(version)
|
||||
|
||||
from init import init
|
||||
if command_line.do_init:
|
||||
@ -58,20 +57,20 @@ def main():
|
||||
for filename,text in preprocessed_text:
|
||||
if filename in command_line.preprocessed:
|
||||
for line in text:
|
||||
print line.text
|
||||
print(line.text)
|
||||
|
||||
|
||||
if command_line.do_touch:
|
||||
from variables import variables
|
||||
for var in command_line.touched:
|
||||
if var not in variables:
|
||||
print "%s is not an IRP entity"%(var,)
|
||||
print("%s is not an IRP entity"%(var,))
|
||||
else:
|
||||
print "Touching %s invalidates the following entities:"%(var,)
|
||||
print("Touching %s invalidates the following entities:"%(var,))
|
||||
parents = variables[var].parents
|
||||
parents.sort()
|
||||
for x in parents:
|
||||
print "- %s"%(x,)
|
||||
print("- %s"%(x,))
|
||||
|
||||
|
||||
if not command_line.do_run:
|
||||
@ -92,7 +91,7 @@ def main():
|
||||
codelet.run()
|
||||
|
||||
from modules import modules, write_module
|
||||
for m in modules.keys():
|
||||
for m in list(modules.keys()):
|
||||
write_module(modules[m])
|
||||
|
||||
makefile.run()
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
# IRPF90 is a Fortran90 preprocessor written in Python for programming using
|
||||
# the Implicit Reference to Parameters (IRP) method.
|
||||
# Copyright (C) 2009 Anthony SCEMAMA
|
||||
@ -169,21 +169,21 @@ class indent(object):
|
||||
line = self.format_continuation(line,k)
|
||||
|
||||
if grep.continuation(prevline):
|
||||
print k+2*tab+self.format_continuation(line,k+2*tab)
|
||||
print(k+2*tab+self.format_continuation(line,k+2*tab))
|
||||
continue
|
||||
|
||||
if grep.begin_subroutine(line):
|
||||
print line
|
||||
print(line)
|
||||
k = indent0+tab
|
||||
continue
|
||||
|
||||
if grep.begin_function(line):
|
||||
print line
|
||||
print(line)
|
||||
k = indent0+tab
|
||||
continue
|
||||
|
||||
if grep.begin_program(line):
|
||||
print line
|
||||
print(line)
|
||||
k = indent0+tab
|
||||
continue
|
||||
|
||||
@ -191,76 +191,76 @@ class indent(object):
|
||||
if line[0] != '&':
|
||||
k = indent0+tab
|
||||
if grep.begin_provider(self.text[i+1].strip()):
|
||||
print " "+line
|
||||
print(" "+line)
|
||||
else:
|
||||
print line
|
||||
print(line)
|
||||
else:
|
||||
print line
|
||||
print(line)
|
||||
continue
|
||||
|
||||
if grep.declaration(line):
|
||||
print k+self.format_declaration(line,30)
|
||||
print(k+self.format_declaration(line,30))
|
||||
continue
|
||||
|
||||
if grep.begin_do(line):
|
||||
print k+line
|
||||
print(k+line)
|
||||
k += tab
|
||||
continue
|
||||
|
||||
if grep.begin_if(line):
|
||||
print k+line
|
||||
print(k+line)
|
||||
k += tab
|
||||
continue
|
||||
|
||||
if grep.xelse(line):
|
||||
print k[:-tabn]+line
|
||||
print(k[:-tabn]+line)
|
||||
continue
|
||||
|
||||
if grep.begin_select(line):
|
||||
print k+line
|
||||
print(k+line)
|
||||
k += 2*tab
|
||||
continue
|
||||
|
||||
if grep.case(line):
|
||||
print k[:-tabn]+line
|
||||
print(k[:-tabn]+line)
|
||||
continue
|
||||
|
||||
if grep.end_do(line):
|
||||
k = k[:-tabn]
|
||||
print k+line
|
||||
print(k+line)
|
||||
continue
|
||||
|
||||
if grep.end_if(line):
|
||||
k = k[:-tabn]
|
||||
print k+line
|
||||
print(k+line)
|
||||
continue
|
||||
|
||||
if grep.end_select(line):
|
||||
k = k[:-2*tabn]
|
||||
print k+line
|
||||
print(k+line)
|
||||
continue
|
||||
|
||||
if grep.end_subroutine(line):
|
||||
print line
|
||||
print(line)
|
||||
k = indent0
|
||||
continue
|
||||
|
||||
if grep.end_function(line):
|
||||
print line
|
||||
print(line)
|
||||
k = indent0
|
||||
continue
|
||||
|
||||
if grep.end_provider(line):
|
||||
print line
|
||||
print(line)
|
||||
k = indent0
|
||||
continue
|
||||
|
||||
if grep.end_program(line):
|
||||
print line
|
||||
print(line)
|
||||
k = indent0
|
||||
continue
|
||||
|
||||
print k+line
|
||||
print(k+line)
|
||||
|
||||
|
||||
def main():
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
# IRPF90 is a Fortran90 preprocessor written in Python for programming using
|
||||
# the Implicit Reference to Parameters (IRP) method.
|
||||
# Copyright (C) 2009 Anthony SCEMAMA
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
# IRPF90 is a Fortran90 preprocessor written in Python for programming using
|
||||
# the Implicit Reference to Parameters (IRP) method.
|
||||
# Copyright (C) 2009 Anthony SCEMAMA
|
||||
@ -29,7 +29,7 @@ from zlib import crc32
|
||||
|
||||
irpdir = "IRPF90_temp/"
|
||||
mandir = "IRPF90_man/"
|
||||
irp_id = abs(crc32(os.getcwd()))
|
||||
irp_id = abs(crc32(os.getcwd().encode()))
|
||||
|
||||
|
||||
class Line(object):
|
||||
@ -391,11 +391,11 @@ def create_irpf90_files():
|
||||
import os
|
||||
def is_irpf90_file(filename):
|
||||
return filename.endswith(".irp.f") and not filename.startswith('.')
|
||||
result = filter ( is_irpf90_file, os.listdir(os.getcwd()) )
|
||||
result = list(filter ( is_irpf90_file, os.listdir(os.getcwd()) ))
|
||||
for dir in command_line.include_dir:
|
||||
try:
|
||||
os.stat(dir)
|
||||
result += map(lambda x: dir+x, filter ( is_irpf90_file, os.listdir(dir) ) )
|
||||
result += [dir+x for x in list(filter ( is_irpf90_file, os.listdir(dir) ))]
|
||||
except:
|
||||
continue
|
||||
if command_line.do_codelet:
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
# IRPF90 is a Fortran90 preprocessor written in Python for programming using
|
||||
# the Implicit Reference to Parameters (IRP) method.
|
||||
# Copyright (C) 2009 Anthony SCEMAMA
|
||||
@ -32,7 +32,7 @@ wd = os.path.abspath(os.path.dirname(__file__))
|
||||
from irpf90_t import mandir
|
||||
filename = sys.argv[1].lower()+".l"
|
||||
if filename not in os.listdir(mandir):
|
||||
print "%s does not exist"%(sys.argv[1])
|
||||
print("%s does not exist"%(sys.argv[1]))
|
||||
sys.exit(-1)
|
||||
|
||||
os.system("man ./"+mandir+sys.argv[1].lower()+".l")
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
# IRPF90 is a Fortran90 preprocessor written in Python for programming using
|
||||
# the Implicit Reference to Parameters (IRP) method.
|
||||
# Copyright (C) 2009 Anthony SCEMAMA
|
||||
@ -34,7 +34,7 @@ FILENAME=irpdir+'irp_locks.irp.F90'
|
||||
|
||||
def create():
|
||||
out = []
|
||||
l = variables.keys()
|
||||
l = list(variables.keys())
|
||||
l.sort
|
||||
for v in l:
|
||||
var = variables[v]
|
||||
@ -47,7 +47,7 @@ def create():
|
||||
out += [ " call irp_lock_%s(.True.)"%v ]
|
||||
out += [ " call irp_lock_%s(.False.)"%v ]
|
||||
out += [ "end subroutine" ]
|
||||
out = map(lambda x: "%s\n"%(x),out)
|
||||
out = ["%s\n"%(x) for x in out]
|
||||
if not same_file(FILENAME,out):
|
||||
file = open(FILENAME,'w')
|
||||
file.writelines(out)
|
||||
|
100
src/makefile.py
100
src/makefile.py
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
# IRPF90 is a Fortran90 preprocessor written in Python for programming using
|
||||
# the Implicit Reference to Parameters (IRP) method.
|
||||
# Copyright (C) 2009 Anthony SCEMAMA
|
||||
@ -89,7 +89,7 @@ def run_ninja():
|
||||
def run_make():
|
||||
from modules import modules
|
||||
mod = []
|
||||
for m in modules.values():
|
||||
for m in list(modules.values()):
|
||||
mod.append(m)
|
||||
|
||||
file = open(IRPF90_MAKE,'w')
|
||||
@ -108,41 +108,41 @@ def run_make():
|
||||
for m in mod:
|
||||
result += " %s%s.irp.F90"%(irpdir,m.filename)
|
||||
result += " %s%s.irp.module.F90"%(irpdir,m.filename)
|
||||
print >>file, result
|
||||
print(result, file=file)
|
||||
|
||||
result = "OBJ_IRP = %sirp_stack.irp.o "%(irpdir)
|
||||
for m in mod:
|
||||
if not m.is_main:
|
||||
result += " %s%s.irp.o"%(irpdir,m.filename)
|
||||
result += " %s%s.irp.module.o"%(irpdir,m.filename)
|
||||
print >>file, result
|
||||
print(result, file=file)
|
||||
|
||||
print >>file, "OBJ1 = $(OBJ_IRP) $(OBJ) %sirp_touches.irp.o "%(irpdir),
|
||||
print("OBJ1 = $(OBJ_IRP) $(OBJ) %sirp_touches.irp.o "%(irpdir), end=' ', file=file)
|
||||
# print >>file, " %sirp_checkpoint.irp.o"%(irpdir),
|
||||
if command_line.do_profile:
|
||||
print >>file, " %sirp_profile.irp.o"%(irpdir), " irp_rdtsc.o",
|
||||
print(" %sirp_profile.irp.o"%(irpdir), " irp_rdtsc.o", end=' ', file=file)
|
||||
if command_line.do_codelet:
|
||||
print >>file, " irp_rdtsc.o",
|
||||
print(" irp_rdtsc.o", end=' ', file=file)
|
||||
if command_line.do_openmp:
|
||||
print >>file, " %sirp_locks.irp.o"%(irpdir)
|
||||
print(" %sirp_locks.irp.o"%(irpdir), file=file)
|
||||
else:
|
||||
print >>file, ""
|
||||
print("", file=file)
|
||||
|
||||
all = filter(lambda x: modules[x].is_main, modules)
|
||||
all = map(lambda x: x[:-6], all)
|
||||
all_o = map(lambda x: "%s.irp.module.o %s.irp.o"%(x,x), all)
|
||||
print >>file, "ALL = %s"%(" ".join(all))
|
||||
print >>file, "ALL_OBJ = %s"%(" ".join(all_o))
|
||||
print >>file, "ALL_OBJ1 = $(patsubst %%, %s%%,$(notdir $(ALL_OBJ)))"%(irpdir)
|
||||
print >>file, "all:$(ALL)"
|
||||
print >>file, "\t@$(MAKE) -s move"
|
||||
all = [x for x in modules if modules[x].is_main]
|
||||
all = [x[:-6] for x in all]
|
||||
all_o = ["%s.irp.module.o %s.irp.o"%(x,x) for x in all]
|
||||
print("ALL = %s"%(" ".join(all)), file=file)
|
||||
print("ALL_OBJ = %s"%(" ".join(all_o)), file=file)
|
||||
print("ALL_OBJ1 = $(patsubst %%, %s%%,$(notdir $(ALL_OBJ)))"%(irpdir), file=file)
|
||||
print("all:$(ALL)", file=file)
|
||||
print("\t@$(MAKE) -s move", file=file)
|
||||
# print >>file, "ifdef USE_IRPF90_A"
|
||||
for m in mod:
|
||||
if m.is_main:
|
||||
exe = m.filename
|
||||
print >>file, "%s: %s%s.irp.o %s%s.irp.module.o IRPF90_temp/irpf90.a"%(exe,irpdir,exe,irpdir,exe)
|
||||
print >>file, "\t$(FC) -o $@ %s$@.irp.o %s$@.irp.module.o IRPF90_temp/irpf90.a $(LIB)"%(irpdir,irpdir)
|
||||
print >>file, "\t@$(MAKE) -s move"
|
||||
print("%s: %s%s.irp.o %s%s.irp.module.o IRPF90_temp/irpf90.a"%(exe,irpdir,exe,irpdir,exe), file=file)
|
||||
print("\t$(FC) -o $@ %s$@.irp.o %s$@.irp.module.o IRPF90_temp/irpf90.a $(LIB)"%(irpdir,irpdir), file=file)
|
||||
print("\t@$(MAKE) -s move", file=file)
|
||||
# print >>file, "else"
|
||||
# for m in mod:
|
||||
# if m.is_main:
|
||||
@ -155,43 +155,43 @@ def run_make():
|
||||
buffer = ""
|
||||
for m in mod:
|
||||
filename = "%s%s.irp.o: $(OBJ) %s%s.irp.module.o"%(irpdir,m.filename,irpdir,m.filename)
|
||||
needed_modules = filter( lambda x: modules[x].name in m.needed_modules, modules )
|
||||
needed_files = map(lambda x: modules[x].filename, needed_modules)
|
||||
mds = map (lambda x: " %s%s.irp.module.o"%(irpdir,x),needed_files)
|
||||
print >>file, filename," ".join(mds)," ".join(m.includes)
|
||||
needed_modules = [x for x in modules if modules[x].name in m.needed_modules]
|
||||
needed_files = [modules[x].filename for x in needed_modules]
|
||||
mds = [" %s%s.irp.module.o"%(irpdir,x) for x in needed_files]
|
||||
print(filename," ".join(mds)," ".join(m.includes), file=file)
|
||||
if not m.is_main:
|
||||
buffer += "\t - @echo '"+filename+" ".join(mds)+"' >> %sdist_Makefile\n"%(irpdir)
|
||||
# print >>file, "%sirp_touches.irp.o %sirp_checkpoint.irp.o: $(OBJ) "%(irpdir,irpdir),
|
||||
print >>file, "%sirp_touches.irp.o: $(OBJ) "%(irpdir),
|
||||
mds = filter(lambda x: not x.is_main,mod)
|
||||
mds = map(lambda x: " %s%s.irp.o %s%s.irp.o"%(irpdir,x.filename,irpdir,x.filename),mds)
|
||||
print >>file," ".join(mds)
|
||||
print("%sirp_touches.irp.o: $(OBJ) "%(irpdir), end=' ', file=file)
|
||||
mds = [x for x in mod if not x.is_main]
|
||||
mds = [" %s%s.irp.o %s%s.irp.o"%(irpdir,x.filename,irpdir,x.filename) for x in mds]
|
||||
print(" ".join(mds), file=file)
|
||||
if command_line.do_profile:
|
||||
print >>file, "%sirp_profile.irp.o:"%(irpdir),
|
||||
print >>file," ".join(mds)
|
||||
print("%sirp_profile.irp.o:"%(irpdir), end=' ', file=file)
|
||||
print(" ".join(mds), file=file)
|
||||
if command_line.do_openmp:
|
||||
print >>file, "%sirp_locks.irp.o:"%(irpdir),
|
||||
print >>file," ".join(mds)
|
||||
print("%sirp_locks.irp.o:"%(irpdir), end=' ', file=file)
|
||||
print(" ".join(mds), file=file)
|
||||
|
||||
|
||||
for dir in [ irpdir ] + map(lambda x: irpdir+x, command_line.include_dir):
|
||||
print >>file, dir+"%.irp.module.o: $(OBJ) "+dir+"%.irp.module.F90"
|
||||
print >>file, "\t$(FC) $(FCFLAGS) -c "+dir+"$*.irp.module.F90 -o "+dir+"$*.irp.module.o"
|
||||
print >>file, dir+"%.irp.o: $(OBJ) "+dir+"%.irp.module.o "+dir+"%.irp.F90"
|
||||
print >>file, "\t$(FC) $(FCFLAGS) -c "+dir+"$*.irp.F90 -o "+dir+"$*.irp.o"
|
||||
print >>file, dir+"%.irp.o: $(OBJ) "+dir+"%.irp.F90"
|
||||
print >>file, "\t$(FC) $(FCFLAGS) -c "+dir+"$*.irp.F90 -o "+dir+"$*.irp.o"
|
||||
print >>file, dir+"%.o: %.F90"
|
||||
print >>file, "\t$(FC) $(FCFLAGS) -c $*.F90 -o "+dir+"$*.o"
|
||||
print >>file, dir+"%.o: %.f90\n\t$(FC) $(FCFLAGS) -c $*.f90 -o "+dir+"$*.o"
|
||||
print >>file, dir+"%.o: %.f\n\t$(FC) $(FCFLAGS) -c $*.f -o "+dir+"$*.o"
|
||||
print >>file, dir+"%.o: %.F\n\t$(FC) $(FCFLAGS) -c $*.F -o "+dir+"$*.o"
|
||||
print >>file, dir+"%.irp.F90: "+IRPF90_MAKE+"\n"
|
||||
print >>file, "move:\n\t@mv -f *.mod IRPF90_temp/ 2> /dev/null | DO_NOTHING=\n"
|
||||
print >>file, "IRPF90_temp/irpf90.a: $(OBJ) $(OBJ1)\n\t$(AR) crf IRPF90_temp/irpf90.a $(OBJ1)\n"
|
||||
print >>file, "clean:\n\trm -rf $(EXE) $(OBJ1) IRPF90_temp/irpf90.a $(ALL_OBJ1) $(ALL)\n"
|
||||
print >>file, "veryclean:\n\t- $(MAKE) clean\n"
|
||||
print >>file, "\t- rm -rf "+irpdir+" "+mandir+" "+IRPF90_MAKE+" irpf90_entities dist tags\n"
|
||||
for dir in [ irpdir ] + [irpdir+x for x in command_line.include_dir]:
|
||||
print(dir+"%.irp.module.o: $(OBJ) "+dir+"%.irp.module.F90", file=file)
|
||||
print("\t$(FC) $(FCFLAGS) -c "+dir+"$*.irp.module.F90 -o "+dir+"$*.irp.module.o", file=file)
|
||||
print(dir+"%.irp.o: $(OBJ) "+dir+"%.irp.module.o "+dir+"%.irp.F90", file=file)
|
||||
print("\t$(FC) $(FCFLAGS) -c "+dir+"$*.irp.F90 -o "+dir+"$*.irp.o", file=file)
|
||||
print(dir+"%.irp.o: $(OBJ) "+dir+"%.irp.F90", file=file)
|
||||
print("\t$(FC) $(FCFLAGS) -c "+dir+"$*.irp.F90 -o "+dir+"$*.irp.o", file=file)
|
||||
print(dir+"%.o: %.F90", file=file)
|
||||
print("\t$(FC) $(FCFLAGS) -c $*.F90 -o "+dir+"$*.o", file=file)
|
||||
print(dir+"%.o: %.f90\n\t$(FC) $(FCFLAGS) -c $*.f90 -o "+dir+"$*.o", file=file)
|
||||
print(dir+"%.o: %.f\n\t$(FC) $(FCFLAGS) -c $*.f -o "+dir+"$*.o", file=file)
|
||||
print(dir+"%.o: %.F\n\t$(FC) $(FCFLAGS) -c $*.F -o "+dir+"$*.o", file=file)
|
||||
print(dir+"%.irp.F90: "+IRPF90_MAKE+"\n", file=file)
|
||||
print("move:\n\t@mv -f *.mod IRPF90_temp/ 2> /dev/null | DO_NOTHING=\n", file=file)
|
||||
print("IRPF90_temp/irpf90.a: $(OBJ) $(OBJ1)\n\t$(AR) crf IRPF90_temp/irpf90.a $(OBJ1)\n", file=file)
|
||||
print("clean:\n\trm -rf $(EXE) $(OBJ1) IRPF90_temp/irpf90.a $(ALL_OBJ1) $(ALL)\n", file=file)
|
||||
print("veryclean:\n\t- $(MAKE) clean\n", file=file)
|
||||
print("\t- rm -rf "+irpdir+" "+mandir+" "+IRPF90_MAKE+" irpf90_entities dist tags\n", file=file)
|
||||
|
||||
file.close()
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
# IRPF90 is a Fortran90 preprocessor written in Python for programming using
|
||||
# the Implicit Reference to Parameters (IRP) method.
|
||||
# Copyright (C) 2009 Anthony SCEMAMA
|
||||
@ -57,7 +57,7 @@ class Fmodule(object):
|
||||
|
||||
def prog_name(self):
|
||||
if '_prog_name' not in self.__dict__:
|
||||
buffer = filter(lambda x: type(x[1]) == Program,self.text)
|
||||
buffer = [x for x in self.text if type(x[1]) == Program]
|
||||
if buffer == []:
|
||||
self._prog_name = None
|
||||
else:
|
||||
@ -69,7 +69,7 @@ class Fmodule(object):
|
||||
if '_variables' not in self.__dict__:
|
||||
from variables import variables
|
||||
name = self.name
|
||||
self._variables = filter(lambda x: variables[x].fmodule == name, variables)
|
||||
self._variables = [x for x in variables if variables[x].fmodule == name]
|
||||
return self._variables
|
||||
variables = property(variables)
|
||||
|
||||
@ -79,7 +79,7 @@ class Fmodule(object):
|
||||
result = [ "module %s"%(self.name) ]
|
||||
result += self.use
|
||||
result += self.dec
|
||||
result += flatten( map(lambda x: variables[x].header,self.variables) )
|
||||
result += flatten( [variables[x].header for x in self.variables] )
|
||||
result.append( "end module %s"%(self.name) )
|
||||
self._head = result
|
||||
return self._head
|
||||
@ -87,7 +87,7 @@ class Fmodule(object):
|
||||
|
||||
def needed_vars(self):
|
||||
if '_needed_vars' not in self.__dict__:
|
||||
result = map(lambda x: variables[x].needs,self.variables)
|
||||
result = [variables[x].needs for x in self.variables]
|
||||
result = make_single ( flatten(result) )
|
||||
self._needed_vars = result
|
||||
return self._needed_vars
|
||||
@ -140,7 +140,7 @@ class Fmodule(object):
|
||||
if type(line) in [ Subroutine, Function ]:
|
||||
variable_list = list(vars)
|
||||
elif type(line) == End:
|
||||
result += map(lambda x: ([],Use(line.i,x,line.filename)), build_use(variable_list))
|
||||
result += [([],Use(line.i,x,line.filename)) for x in build_use(variable_list)]
|
||||
else:
|
||||
variable_list += vars
|
||||
result.append( (vars,line) )
|
||||
@ -169,21 +169,21 @@ class Fmodule(object):
|
||||
result = []
|
||||
for vars,line in text:
|
||||
result.append( ([],line) )
|
||||
result += map(lambda x: ([],Simple_line(line.i,x,line.filename)), call_provides(vars))
|
||||
result += [([],Simple_line(line.i,x,line.filename)) for x in call_provides(vars)]
|
||||
return result
|
||||
|
||||
result = remove_providers(self.text)
|
||||
result = modify_functions(result)
|
||||
use,dec,result = extract_use_dec_text(result)
|
||||
self._use = make_single(map(lambda x: " "+x[1].text, use))
|
||||
self._dec = map(lambda x: " "+x[1].text, dec)
|
||||
self._use = make_single([" "+x[1].text for x in use])
|
||||
self._dec = [" "+x[1].text for x in dec]
|
||||
# self._dec = make_single(map(lambda x: " "+x[1].text, dec))
|
||||
result = provide_variables(result)
|
||||
result = move_to_top(result,Declaration)
|
||||
result = move_to_top(result,Implicit)
|
||||
result = move_to_top(result,Use)
|
||||
result = map(lambda x: x[1], result)
|
||||
result = map(lambda x: x.text, result)
|
||||
result = [x[1] for x in result]
|
||||
result = [x.text for x in result]
|
||||
self._residual_text = result
|
||||
return self._residual_text
|
||||
residual_text = property(residual_text)
|
||||
@ -203,10 +203,9 @@ class Fmodule(object):
|
||||
|
||||
def needed_modules(self):
|
||||
if '_needed_modules' not in self.__dict__:
|
||||
buffer = filter(lambda x: x.lstrip().startswith("use "), \
|
||||
self.generated_text+self.head+self.residual_text)
|
||||
buffer = map(lambda x: x.split()[1], buffer)
|
||||
buffer = filter(lambda x: x.endswith("_mod"),buffer )
|
||||
buffer = [x for x in self.generated_text+self.head+self.residual_text if x.lstrip().startswith("use ")]
|
||||
buffer = [x.split()[1] for x in buffer]
|
||||
buffer = [x for x in buffer if x.endswith("_mod")]
|
||||
self._needed_modules = make_single(buffer)
|
||||
if self.name in self._needed_modules:
|
||||
self._needed_modules.remove(self.name)
|
||||
@ -222,6 +221,6 @@ if __name__ == '__main__':
|
||||
x = Fmodule(text,filename)
|
||||
break
|
||||
for line in x.head:
|
||||
print line
|
||||
print x.includes
|
||||
print(line)
|
||||
print(x.includes)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
# IRPF90 is a Fortran90 preprocessor written in Python for programming using
|
||||
# the Implicit Reference to Parameters (IRP) method.
|
||||
# Copyright (C) 2009 Anthony SCEMAMA
|
||||
@ -44,7 +44,7 @@ def write_module(m):
|
||||
# Module data
|
||||
filename = irpdir+m.filename+".irp.module.F90"
|
||||
text = m.header + m.head
|
||||
text = map(lambda x: "%s\n"%(x),text)
|
||||
text = ["%s\n"%(x) for x in text]
|
||||
if not same_file(filename,text):
|
||||
# print filename
|
||||
file = open(filename,"w")
|
||||
@ -54,7 +54,7 @@ def write_module(m):
|
||||
# Subroutines
|
||||
filename = irpdir+m.filename+".irp.F90"
|
||||
text = m.header + m.generated_text + m.residual_text
|
||||
text = map(lambda x: "%s\n"%(x),text)
|
||||
text = ["%s\n"%(x) for x in text]
|
||||
if not same_file(filename,text):
|
||||
# print filename
|
||||
file = open(filename,"w")
|
||||
|
16
src/ninja.py
16
src/ninja.py
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
# IRPF90 is a Fortran90 preprocessor written in Python for programming using
|
||||
# the Implicit Reference to Parameters (IRP) method.
|
||||
# Copyright (C) 2009 Anthony SCEMAMA
|
||||
@ -64,7 +64,7 @@ def create_build_touches(list_of_other_o):
|
||||
|
||||
needed_modules = [ "%s.irp.module.o"%(modules[x].filename) for x in modules ]
|
||||
|
||||
list_of_modules = map(dress, needed_modules) + list_of_other_o
|
||||
list_of_modules = list(map(dress, needed_modules)) + list_of_other_o
|
||||
list_of_modules = ' '.join(list_of_modules)
|
||||
|
||||
result = '\n'.join(
|
||||
@ -113,10 +113,10 @@ def create_build_target(t,list_of_other_o):
|
||||
list_of_o = [ target_o, target_module_o, irp_lib ]
|
||||
list_of_o = ' '.join(list_of_o)
|
||||
|
||||
list_of_modules = map(dress, needed_modules) + list_of_other_o
|
||||
list_of_modules = list(map(dress, needed_modules)) + list_of_other_o
|
||||
list_of_modules = ' '.join(list_of_modules)
|
||||
|
||||
list_of_includes = ' '.join(map(lambda x: dress(x,in_root=True), t.includes))
|
||||
list_of_includes = ' '.join([dress(x,in_root=True) for x in t.includes])
|
||||
|
||||
result = '\n'.join(
|
||||
[ "build {target}: link_{id} {list_of_o}",
|
||||
@ -170,10 +170,10 @@ def create_build_non_target(t,list_of_other_o):
|
||||
needed_modules = [ "%s.irp.module.o"%(modules[x].filename) for x in modules \
|
||||
if modules[x].name in t.needed_modules ] + [ target_module_o ]
|
||||
|
||||
list_of_modules = map(dress, needed_modules)
|
||||
list_of_modules = list(map(dress, needed_modules))
|
||||
list_of_modules = ' '.join(list_of_modules)
|
||||
list_of_externals = ' '.join([ dress(x,in_root=True) for x in list_of_other_o ])
|
||||
list_of_includes = ' '.join(map(lambda x: dress(x,in_root=True), t.includes))
|
||||
list_of_includes = ' '.join([dress(x,in_root=True) for x in t.includes])
|
||||
|
||||
result = '\n'.join(
|
||||
[
|
||||
@ -372,8 +372,8 @@ def run():
|
||||
l_common_o += [ "irp_profile.irp.o", "irp_rdtsc.o" ]
|
||||
l_common_s += [ "irp_profile.irp.F90", "irp_rdtsc.c" ]
|
||||
|
||||
l_common_o = map(dress,l_common_o) + map(lambda x: dress(x,in_root=True), OBJ)
|
||||
l_common_s = map(dress,l_common_s) + map(lambda x: dress(x,in_root=True), SRC)
|
||||
l_common_o = list(map(dress,l_common_o)) + [dress(x,in_root=True) for x in OBJ]
|
||||
l_common_s = list(map(dress,l_common_s)) + [dress(x,in_root=True) for x in SRC]
|
||||
|
||||
|
||||
# IRP_touches
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
# IRPF90 is a Fortran90 preprocessor written in Python for programming using
|
||||
# the Implicit Reference to Parameters (IRP) method.
|
||||
# Copyright (C) 2009 Anthony SCEMAMA
|
||||
@ -33,9 +33,9 @@ from subroutines import subroutines
|
||||
import regexps, re
|
||||
import error
|
||||
|
||||
vtuple = map(lambda v: (v, variables[v].same_as, variables[v].regexp), variables.keys())
|
||||
stuple = map(lambda s: (s, subroutines[s].regexp), subroutines.keys())
|
||||
stuple = filter(lambda s: subroutines[s[0]].is_function, stuple)
|
||||
vtuple = [(v, variables[v].same_as, variables[v].regexp) for v in list(variables.keys())]
|
||||
stuple = [(s, subroutines[s].regexp) for s in list(subroutines.keys())]
|
||||
stuple = [s for s in stuple if subroutines[s[0]].is_function]
|
||||
re_string_sub = regexps.re_string.sub
|
||||
|
||||
regexps_re_string_sub = regexps.re_string.sub
|
||||
@ -79,20 +79,20 @@ def check_touch(line,vars,main_vars):
|
||||
error.fail(line,"Variable %s unknown"%(main_var,))
|
||||
x = variables[main_var]
|
||||
return [main_var]+x.others
|
||||
all_others = make_single(flatten( map(fun,main_vars) ))
|
||||
all_others = make_single(flatten( list(map(fun,main_vars)) ))
|
||||
all_others.sort()
|
||||
vars.sort()
|
||||
for x,y in zip(vars,all_others):
|
||||
if x != y:
|
||||
message = "The following entities should be touched:\n"
|
||||
message = "\n".join([message]+map(lambda x: "- %s"%(x,),all_others))
|
||||
message = "\n".join([message]+["- %s"%(x,) for x in all_others])
|
||||
error.fail(line,message)
|
||||
|
||||
################################################################################
|
||||
def update_variables():
|
||||
for filename,text in preprocessed_text:
|
||||
|
||||
for line in filter(lambda x: type(x) in [ Touch, SoftTouch ], text):
|
||||
for line in [x for x in text if type(x) in [ Touch, SoftTouch ]]:
|
||||
vars = line.lower.split()
|
||||
if len(vars) < 2:
|
||||
error.fail(line,"Syntax error")
|
||||
@ -101,7 +101,7 @@ def update_variables():
|
||||
error.fail(line,"Variable %s unknown"%(v,))
|
||||
variables[v]._is_touched = True
|
||||
|
||||
for line in filter(lambda x: type(x) == Free,text):
|
||||
for line in [x for x in text if type(x) == Free]:
|
||||
vars = line.lower.split()
|
||||
if len(vars) < 2:
|
||||
error.fail(line,"Syntax error")
|
||||
@ -110,10 +110,10 @@ def update_variables():
|
||||
error.fail(line,"Variable %s unknown"%(v,))
|
||||
variables[v].is_freed = True
|
||||
|
||||
for line in filter(lambda x: type(x) == Irp_read,text):
|
||||
for line in [x for x in text if type(x) == Irp_read]:
|
||||
variables[line.filename]._is_read = True
|
||||
|
||||
for line in filter(lambda x: type (x) == Irp_write,text):
|
||||
for line in [x for x in text if type (x) == Irp_write]:
|
||||
variables[line.filename]._is_written = True
|
||||
|
||||
################################################################################
|
||||
@ -148,7 +148,7 @@ def get_parsed_text():
|
||||
elif type(line) in [ Begin_provider, Cont_provider ]:
|
||||
if type(line) == Begin_provider:
|
||||
varlist = []
|
||||
buffer = map(strip,line.lower.replace(']','').split(','))
|
||||
buffer = list(map(strip,line.lower.replace(']','').split(',')))
|
||||
assert len(buffer) > 1
|
||||
v = buffer[1]
|
||||
varlist.append(v)
|
||||
@ -156,7 +156,7 @@ def get_parsed_text():
|
||||
try:
|
||||
variable_list.remove(variables[v].same_as)
|
||||
except ValueError:
|
||||
print v, variables[v].same_as
|
||||
print(v, variables[v].same_as)
|
||||
raise
|
||||
append( (variable_list,line) )
|
||||
elif type(line) == End_provider:
|
||||
@ -164,7 +164,7 @@ def get_parsed_text():
|
||||
append( ([],line) )
|
||||
elif type(line) == Provide:
|
||||
l = line.lower.split()[1:]
|
||||
l = filter(lambda x: x not in varlist, l)
|
||||
l = [x for x in l if x not in varlist]
|
||||
for v in l:
|
||||
if v not in variables:
|
||||
error.fail(line,"Variable %s is unknown"%(v))
|
||||
@ -175,7 +175,7 @@ def get_parsed_text():
|
||||
for v in l:
|
||||
if v not in variables:
|
||||
error.fail(line,"Variable %s is unknown"%(v))
|
||||
l = map(lambda x: "-%s"%(x), l)
|
||||
l = ["-%s"%(x) for x in l]
|
||||
append( (l,Simple_line(line.i,"!%s"%(line.text),line.filename)) )
|
||||
elif type(line) in [ Touch, SoftTouch ]:
|
||||
vars = line.lower.split()
|
||||
@ -185,7 +185,7 @@ def get_parsed_text():
|
||||
def fun(x):
|
||||
main = variables[x].same_as
|
||||
return main
|
||||
main_vars = make_single( map(fun, vars) )
|
||||
main_vars = make_single( list(map(fun, vars)) )
|
||||
check_touch(line,vars,main_vars)
|
||||
txt = " ".join(vars)
|
||||
append ( (vars,Simple_line(line.i,"!",line.filename)) )
|
||||
@ -195,19 +195,19 @@ def get_parsed_text():
|
||||
error.fail(line,"Variable %s unknown"%(x,))
|
||||
return [ ([],Simple_line(line.i," call touch_%s"%(x,),line.filename)),
|
||||
([],Use(line.i," use %s"%(variables[x].fmodule), line.filename)) ]
|
||||
result += flatten(map( fun, main_vars ))
|
||||
result += flatten(list(map( fun, main_vars )))
|
||||
def fun(x):
|
||||
if x not in variables:
|
||||
error.fail(line,"Variable %s unknown"%(x,))
|
||||
return ([],Simple_line(line.i," %s_is_built = .True."%(x,),line.filename))
|
||||
result += map( fun, main_vars[:-1] )
|
||||
result += list(map( fun, main_vars[:-1] ))
|
||||
if type(line) == SoftTouch:
|
||||
append ( ([],Simple_line(line.i,"! <<< END TOUCH (Soft)",line.filename)) )
|
||||
else:
|
||||
append ( ([],Provide_all(line.i,"! <<< END TOUCH",line.filename)) )
|
||||
elif type(line) == Call:
|
||||
l = find_variables_in_line(line)
|
||||
l = filter(lambda x: x not in varlist, l)
|
||||
l = [x for x in l if x not in varlist]
|
||||
sub = find_subroutine_in_line(line)
|
||||
if sub not in subroutines:
|
||||
t = Simple_line
|
||||
@ -220,12 +220,10 @@ def get_parsed_text():
|
||||
vars = line.lower.split()
|
||||
vars = vars[1:]
|
||||
append( ([],Simple_line(line.i,"!%s"%(line.text),line.filename)) )
|
||||
use = map(lambda x: " use %s"%(variables[x].fmodule),vars)
|
||||
use = [" use %s"%(variables[x].fmodule) for x in vars]
|
||||
for var in vars:
|
||||
result += map(lambda x: ([],Use(line.i,x,line.filename)),
|
||||
make_single(use))
|
||||
result += map(lambda x: ([],Simple_line(line.i,x,line.filename)),
|
||||
variables[var].free)
|
||||
result += [([],Use(line.i,x,line.filename)) for x in make_single(use)]
|
||||
result += [([],Simple_line(line.i,x,line.filename)) for x in variables[var].free]
|
||||
elif type(line) == Irp_read:
|
||||
append( ([],Simple_line(line.i,"!%s"%(line.text),line.filename)) )
|
||||
elif type(line) == Irp_write:
|
||||
@ -234,7 +232,7 @@ def get_parsed_text():
|
||||
pass
|
||||
else:
|
||||
l = find_variables_in_line(line)
|
||||
l = filter(lambda x: x not in varlist, l)
|
||||
l = [x for x in l if x not in varlist]
|
||||
append( (l,line) )
|
||||
return result
|
||||
|
||||
@ -365,7 +363,7 @@ def move_variables():
|
||||
elif type(line) in [ If, Select ]:
|
||||
ifvars += list(varlist)
|
||||
append( (varlist,line) )
|
||||
vars += filter(lambda x: x in elsevars, ifvars)
|
||||
vars += [x for x in ifvars if x in elsevars]
|
||||
ifvars = old_ifvars.pop()
|
||||
elsevars = old_elsevars.pop()
|
||||
varlist = old_varlist.pop() + vars
|
||||
@ -401,13 +399,13 @@ def move_variables():
|
||||
varlist = list(vars)
|
||||
elif type(line) in [ If, Select ]:
|
||||
old_varlist.append(varlist)
|
||||
vars = filter(lambda x: x not in varlist,vars)
|
||||
vars = [x for x in vars if x not in varlist]
|
||||
varlist = make_single(varlist + vars)
|
||||
assert old_varlist is not varlist
|
||||
elif type(line) in [ Elseif, Else, Case ]:
|
||||
varlist = old_varlist.pop()
|
||||
old_varlist.append(varlist)
|
||||
vars = filter(lambda x: x not in varlist,vars)
|
||||
vars = [x for x in vars if x not in varlist]
|
||||
varlist = make_single(varlist + vars)
|
||||
assert old_varlist is not varlist
|
||||
elif type(line) in [ Endif, End_select ]:
|
||||
@ -441,7 +439,7 @@ def build_needs():
|
||||
var = None
|
||||
for vars,line in text:
|
||||
if type(line) == Begin_provider:
|
||||
buffer = map(strip,line.lower.replace(']',',').split(','))
|
||||
buffer = list(map(strip,line.lower.replace(']',',').split(',')))
|
||||
var = variables[buffer[1]]
|
||||
var.needs = []
|
||||
var.to_provide = vars
|
||||
@ -510,9 +508,9 @@ def check_opt():
|
||||
for vars,line in text:
|
||||
if not type(line) == Provide_all:
|
||||
if do_level > 0 and vars != []:
|
||||
print "Optimization: %s line %d"%(line.filename,line.i)
|
||||
print("Optimization: %s line %d"%(line.filename,line.i))
|
||||
for v in vars:
|
||||
print " PROVIDE ",v
|
||||
print(" PROVIDE ",v)
|
||||
if type(line) == Do:
|
||||
do_level += 1
|
||||
elif type(line) == Enddo:
|
||||
@ -527,7 +525,7 @@ def perform_loop_substitutions():
|
||||
append = result.append
|
||||
for vars,line in text:
|
||||
if type(line) in [ Do, If, Elseif ] :
|
||||
for k,v in command_line.substituted.items():
|
||||
for k,v in list(command_line.substituted.items()):
|
||||
reg = v[1]
|
||||
while reg.search(line.text) is not None:
|
||||
line.text = re.sub(reg,r'\1%s\3', line.text,count=1)%v[0]
|
||||
@ -541,9 +539,9 @@ parsed_text = perform_loop_substitutions()
|
||||
if __name__ == '__main__':
|
||||
for i in range(len(parsed_text)):
|
||||
if parsed_text[i][0] == sys.argv[1]:
|
||||
print '!-------- %s -----------'%(parsed_text[i][0])
|
||||
print('!-------- %s -----------'%(parsed_text[i][0]))
|
||||
for line in parsed_text[i][1]:
|
||||
print line[1]
|
||||
print line[0], line[1].filename
|
||||
print(line[1])
|
||||
print(line[0], line[1].filename)
|
||||
#for i in subroutines:
|
||||
# print i, subroutines[i].needs, subroutines[i].to_provide
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
# IRPF90 is a Fortran90 preprocessor written in Python for programming using
|
||||
# the Implicit Reference to Parameters (IRP) method.
|
||||
# Copyright (C) 2009 Anthony SCEMAMA
|
||||
@ -263,7 +263,7 @@ def execute_templates(text):
|
||||
fail(line,"Subst","Syntax error")
|
||||
buffer = buffer[1].replace(']','')
|
||||
buffer = buffer.split(',')
|
||||
return map(lambda x: '$%s'%(x.strip()), buffer)
|
||||
return ['$%s'%(x.strip()) for x in buffer]
|
||||
|
||||
TEMPLATE = 1
|
||||
SUBST = 2
|
||||
@ -301,7 +301,7 @@ def execute_templates(text):
|
||||
if subst[-2:] == ';;':
|
||||
subst = subst[:-2]
|
||||
for s in subst.split(';;'):
|
||||
buffer = map(lambda x: x.strip(), s.split(';'))
|
||||
buffer = [x.strip() for x in s.split(';')]
|
||||
if len(buffer) != len(variables):
|
||||
fail(line,"subst","%d variables defined, and %d substitutions"%(len(variables),len(buffer)))
|
||||
script += "v.append( { \\\n"
|
||||
@ -311,7 +311,7 @@ def execute_templates(text):
|
||||
script += "for d in v:\n t0 = str(template)\n"
|
||||
for v in variables:
|
||||
script += " t0 = t0.replace('%s',d['%s'])\n"%(v,v)
|
||||
script += " print t0\n"
|
||||
script += " print(t0)\n"
|
||||
# Write script file
|
||||
scriptname = "%s%s_template_%d"%(irpdir,line.filename,line.i)
|
||||
file = open(scriptname,'w')
|
||||
@ -323,7 +323,7 @@ def execute_templates(text):
|
||||
file.close()
|
||||
# Execute shell
|
||||
import os
|
||||
pipe = os.popen("python2 < %s"%(scriptname),'r')
|
||||
pipe = os.popen("python < %s"%(scriptname),'r')
|
||||
lines = pipe.readlines()
|
||||
pipe.close()
|
||||
result += get_text(lines,scriptname)
|
||||
@ -689,7 +689,7 @@ def change_includes(text):
|
||||
if type(line) == Include:
|
||||
txt = line.text.replace('"',"'").split("'")
|
||||
if len(txt) != 3:
|
||||
print txt
|
||||
print(txt)
|
||||
error.fail(line,"Error in include statement")
|
||||
directory = (("./"+line.filename).rsplit('/',1)[0]+'/')[2:]
|
||||
if directory == "":
|
||||
@ -793,7 +793,7 @@ def check_begin_end(text):
|
||||
filter_line = lambda line: type(line) in [ Do, Enddo, If, Endif, \
|
||||
Program, Begin_provider, End_provider, \
|
||||
Subroutine, Function, End, Begin_doc, End_doc ]
|
||||
text = filter(filter_line, text)
|
||||
text = list(filter(filter_line, text))
|
||||
|
||||
d = { 'do' : Do, 'enddo': Enddo,
|
||||
'if' : If, 'endif': Endif,
|
||||
@ -911,16 +911,16 @@ def create_preprocessed_text(filename):
|
||||
|
||||
######################################################################
|
||||
preprocessed_text = parallel_loop( lambda x,y: create_preprocessed_text(x), \
|
||||
map(lambda x: (x,None), irpf90_files ) )
|
||||
[(x,None) for x in irpf90_files] )
|
||||
|
||||
######################################################################
|
||||
def debug():
|
||||
for filename, txt in preprocessed_text:
|
||||
if filename == 'invert.irp.f':
|
||||
print "=== "+filename+" ==="
|
||||
print("=== "+filename+" ===")
|
||||
for line in txt:
|
||||
print line
|
||||
print irpf90_files
|
||||
print(line)
|
||||
print(irpf90_files)
|
||||
|
||||
if __name__ == '__main__':
|
||||
debug()
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
# IRPF90 is a Fortran90 preprocessor written in Python for programming using
|
||||
# the Implicit Reference to Parameters (IRP) method.
|
||||
# Copyright (C) 2009 Anthony SCEMAMA
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
# IRPF90 is a Fortran90 preprocessor written in Python for programming using
|
||||
# the Implicit Reference to Parameters (IRP) method.
|
||||
# Copyright (C) 2009 Anthony SCEMAMA
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
# IRPF90 is a Fortran90 preprocessor written in Python for programming using
|
||||
# the Implicit Reference to Parameters (IRP) method.
|
||||
# Copyright (C) 2009 Anthony SCEMAMA
|
||||
@ -58,8 +58,8 @@ class Sub(object):
|
||||
def doc(self):
|
||||
if '_doc' not in self.__dict__:
|
||||
def f(l): return
|
||||
buffer = filter(lambda l:type(l) == Doc, self.text)
|
||||
self._doc = map(lambda l: l.text.lstrip()[1:], buffer)
|
||||
buffer = [l for l in self.text if type(l) == Doc]
|
||||
self._doc = [l.text.lstrip()[1:] for l in buffer]
|
||||
if buffer == []:
|
||||
error.warn(None,"Subroutine %s is not documented"%(self.name))
|
||||
return self._doc
|
||||
@ -77,7 +77,7 @@ class Sub(object):
|
||||
if '_touches' not in self.__dict__:
|
||||
from subroutines import subroutines
|
||||
self._touches = []
|
||||
for line in filter(lambda x: type(x) in [Touch, SoftTouch],self.text):
|
||||
for line in [x for x in self.text if type(x) in [Touch, SoftTouch]]:
|
||||
self._touches += line.text.split()[1:]
|
||||
for sub in self.calls:
|
||||
if sub in subroutines:
|
||||
@ -113,7 +113,7 @@ class Sub(object):
|
||||
############################################################
|
||||
def calls(self):
|
||||
if '_calls' not in self.__dict__:
|
||||
buffer = filter(lambda x: type(x) == Call,self.text)
|
||||
buffer = [x for x in self.text if type(x) == Call]
|
||||
self._calls = []
|
||||
for line in buffer:
|
||||
sub = line.text.split('(',1)[0].split()[1].lower()
|
||||
@ -127,5 +127,5 @@ if __name__ == '__main__':
|
||||
from preprocessed_text import preprocessed_text
|
||||
from variables import variables
|
||||
from subroutines import subroutines
|
||||
print map(lambda x: variables[x].needs, subroutines['full_ci'].needs)
|
||||
print subroutines['full_ci'].calls
|
||||
print([variables[x].needs for x in subroutines['full_ci'].needs])
|
||||
print(subroutines['full_ci'].calls)
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
# IRPF90 is a Fortran90 preprocessor written in Python for programming using
|
||||
# the Implicit Reference to Parameters (IRP) method.
|
||||
# Copyright (C) 2009 Anthony SCEMAMA
|
||||
@ -51,7 +51,7 @@ def create_subroutines():
|
||||
return result
|
||||
|
||||
def create_called_by(subs,vars):
|
||||
for s in subs.values() + vars.values():
|
||||
for s in list(subs.values()) + list(vars.values()):
|
||||
if type(s) == Variable and s.same_as != s.name:
|
||||
continue
|
||||
for x in s.calls:
|
||||
@ -60,7 +60,7 @@ def create_called_by(subs,vars):
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
for s in subs.values():
|
||||
for s in list(subs.values()):
|
||||
s.called_by = make_single(s.called_by)
|
||||
s.called_by.sort()
|
||||
|
||||
@ -68,5 +68,5 @@ subroutines = create_subroutines()
|
||||
create_called_by(subroutines,variables)
|
||||
|
||||
if __name__ == '__main__':
|
||||
for v in subroutines.keys():
|
||||
print v
|
||||
for v in list(subroutines.keys()):
|
||||
print(v)
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
# IRPF90 is a Fortran90 preprocessor written in Python for programming using
|
||||
# the Implicit Reference to Parameters (IRP) method.
|
||||
# Copyright (C) 2009 Anthony SCEMAMA
|
||||
@ -34,11 +34,11 @@ FILENAME=irpdir+'irp_touches.irp.F90'
|
||||
|
||||
def create():
|
||||
out = []
|
||||
l = variables.keys()
|
||||
l = list(variables.keys())
|
||||
l.sort
|
||||
main_modules = filter(lambda x: modules[x].is_main, modules)
|
||||
main_modules = [x for x in modules if modules[x].is_main]
|
||||
finalize = "subroutine irp_finalize_%s\n"%(irp_id)
|
||||
for m in filter(lambda x: not modules[x].is_main, modules):
|
||||
for m in [x for x in modules if not modules[x].is_main]:
|
||||
finalize += " use %s\n"%(modules[m].name)
|
||||
for v in l:
|
||||
var = variables[v]
|
||||
@ -59,7 +59,7 @@ def create():
|
||||
|
||||
|
||||
if out != []:
|
||||
out = map(lambda x: "%s\n"%(x),out)
|
||||
out = ["%s\n"%(x) for x in out]
|
||||
|
||||
out += finalize
|
||||
|
||||
|
34
src/util.py
34
src/util.py
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
# IRPF90 is a Fortran90 preprocessor written in Python for programming using
|
||||
# the Implicit Reference to Parameters (IRP) method.
|
||||
# Copyright (C) 2009 Anthony SCEMAMA
|
||||
@ -64,7 +64,7 @@ def build_dim_colons(v):
|
||||
if d == []:
|
||||
return ""
|
||||
else:
|
||||
x = map(lambda x: ":", d)
|
||||
x = [":" for x in d]
|
||||
return "(%s)"%(','.join(x))
|
||||
|
||||
|
||||
@ -83,7 +83,7 @@ def make_single(l):
|
||||
d = {}
|
||||
for x in l:
|
||||
d[x] = True
|
||||
return d.keys()
|
||||
return list(d.keys())
|
||||
|
||||
def flatten(l):
|
||||
if type(l) == list:
|
||||
@ -128,17 +128,17 @@ def put_info(text,filename):
|
||||
line.text = format%(line.text.ljust(lenmax),line.filename,str(line.i))
|
||||
return text
|
||||
|
||||
import cPickle as pickle
|
||||
import pickle as pickle
|
||||
import os, sys
|
||||
def parallel_loop(f,source):
|
||||
pidlist = range(NTHREADS)
|
||||
pidlist = list(range(NTHREADS))
|
||||
|
||||
src = [ [] for i in xrange(NTHREADS) ]
|
||||
src = [ [] for i in range(NTHREADS) ]
|
||||
index = 0
|
||||
try:
|
||||
source = map( lambda x: (len(x[1]),(x[0], x[1])), source )
|
||||
source = [(len(x[1]),(x[0], x[1])) for x in source]
|
||||
source.sort()
|
||||
source = map( lambda x: x[1], source )
|
||||
source = [x[1] for x in source]
|
||||
except:
|
||||
pass
|
||||
for i in source:
|
||||
@ -149,8 +149,8 @@ def parallel_loop(f,source):
|
||||
|
||||
thread_id = 0
|
||||
fork = 1
|
||||
r = range(0,NTHREADS)
|
||||
for thread_id in xrange(1,NTHREADS):
|
||||
r = list(range(0,NTHREADS))
|
||||
for thread_id in range(1,NTHREADS):
|
||||
r[thread_id], w = os.pipe()
|
||||
fork = os.fork()
|
||||
if fork == 0:
|
||||
@ -173,7 +173,7 @@ def parallel_loop(f,source):
|
||||
w.close()
|
||||
os._exit(0)
|
||||
|
||||
for i in xrange(1,NTHREADS):
|
||||
for i in range(1,NTHREADS):
|
||||
result += pickle.load(r[i])
|
||||
r[i].close()
|
||||
os.waitpid(pidlist[i],0)[1]
|
||||
@ -183,10 +183,10 @@ def parallel_loop(f,source):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print "10",dimsize("10") #-> "10"
|
||||
print "0:10",dimsize("0:10") # -> "11"
|
||||
print "0:x",dimsize("0:x") # -> "x+1"
|
||||
print "-3:x",dimsize("-3:x") # -> "x+1"
|
||||
print "x:y",dimsize("x:y") # -> "y-x+1"
|
||||
print "x:5",dimsize("x:5") # -> "y-x+1"
|
||||
print("10",dimsize("10")) #-> "10"
|
||||
print("0:10",dimsize("0:10")) # -> "11"
|
||||
print("0:x",dimsize("0:x")) # -> "x+1"
|
||||
print("-3:x",dimsize("-3:x")) # -> "x+1"
|
||||
print("x:y",dimsize("x:y")) # -> "y-x+1"
|
||||
print("x:5",dimsize("x:5")) # -> "y-x+1"
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
# IRPF90 is a Fortran90 preprocessor written in Python for programming using
|
||||
# the Implicit Reference to Parameters (IRP) method.
|
||||
# Copyright (C) 2009 Anthony SCEMAMA
|
||||
@ -118,8 +118,8 @@ dimension.
|
||||
def doc(self):
|
||||
if '_doc' not in self.__dict__:
|
||||
text = self.text
|
||||
buffer = filter(lambda l:type(l) == Doc, text)
|
||||
self._doc = map(lambda l: l.text.lstrip()[1:], buffer)
|
||||
buffer = [l for l in text if type(l) == Doc]
|
||||
self._doc = [l.text.lstrip()[1:] for l in buffer]
|
||||
if buffer == []:
|
||||
error.warn(None,"Variable %s is not documented"%(self.name))
|
||||
return self._doc
|
||||
@ -137,7 +137,7 @@ dimension.
|
||||
if '_includes' not in self.__dict__:
|
||||
self._includes = []
|
||||
text = self.text
|
||||
for line in filter(lambda x: type(x) == Include,text):
|
||||
for line in [x for x in text if type(x) == Include]:
|
||||
self._includes.append(line.filename)
|
||||
make_single(self._includes)
|
||||
return self._includes
|
||||
@ -148,7 +148,7 @@ dimension.
|
||||
if '_calls' not in self.__dict__:
|
||||
self._calls = []
|
||||
text = self.text
|
||||
for line in filter(lambda x: type(x) == Call,text):
|
||||
for line in [x for x in text if type(x) == Call]:
|
||||
sub = line.text.split('(',1)[0].split()[1].lower()
|
||||
self._calls.append(sub)
|
||||
make_single(self._calls)
|
||||
@ -162,7 +162,7 @@ dimension.
|
||||
append = result.append
|
||||
f = lambda l: type(l) in [Begin_provider, Cont_provider]
|
||||
text = self.text
|
||||
lines = filter(f, text)
|
||||
lines = list(filter(f, text))
|
||||
for line in lines:
|
||||
append(line.filename[1])
|
||||
result.remove(self.name)
|
||||
@ -190,7 +190,7 @@ dimension.
|
||||
from variables import variables
|
||||
def f(var):
|
||||
return variables[var].dim != []
|
||||
self._allocate = filter ( f, self.others + [self.name] )
|
||||
self._allocate = list(filter ( f, self.others + [self.name] ))
|
||||
return self._allocate
|
||||
allocate = property(allocate)
|
||||
|
||||
@ -203,7 +203,7 @@ dimension.
|
||||
self._dim = []
|
||||
else:
|
||||
buffer = buffer[2].strip()[1:-1].split(',')
|
||||
self._dim = map(strip,buffer)
|
||||
self._dim = list(map(strip,buffer))
|
||||
return self._dim
|
||||
dim = property(dim)
|
||||
|
||||
@ -243,7 +243,7 @@ dimension.
|
||||
if '_line' not in self.__dict__:
|
||||
f = lambda l: type(l) in [Begin_provider, Cont_provider]
|
||||
text = self.text
|
||||
lines = filter(f, text)
|
||||
lines = list(filter(f, text))
|
||||
for line in lines:
|
||||
buffer = line.filename[1]
|
||||
if self._name == buffer:
|
||||
@ -282,18 +282,18 @@ dimension.
|
||||
import parsed_text
|
||||
parents = self.parents
|
||||
parents.sort()
|
||||
mods = map(lambda x: variables[x].fmodule, parents)
|
||||
mods = [variables[x].fmodule for x in parents]
|
||||
mods = make_single(mods)+[self.fmodule]
|
||||
name = self.name
|
||||
result = [ "subroutine touch_%s"%(name) ]
|
||||
result += map(lambda x: " Use %s"%(x),mods)
|
||||
result += [" Use %s"%(x) for x in mods]
|
||||
result.append(" implicit none")
|
||||
if command_line.do_debug:
|
||||
length = str(len("touch_%s"%(name)))
|
||||
result += [ " character*(%s) :: irp_here = 'touch_%s'"%(length,name) ]
|
||||
if command_line.do_debug:
|
||||
result += [ " call irp_enter(irp_here)" ]
|
||||
result += map( lambda x: " %s_is_built = .False."%(x), parents)
|
||||
result += [" %s_is_built = .False."%(x) for x in parents]
|
||||
result.append(" %s_is_built = .True."%(name))
|
||||
if command_line.do_debug:
|
||||
result.append(" call irp_leave(irp_here)")
|
||||
@ -363,7 +363,7 @@ dimension.
|
||||
result += [\
|
||||
" character*(%d) :: irp_here = 'reader_%s'"%(length,name),
|
||||
" call irp_enter(irp_here)" ]
|
||||
result += map(lambda x: " call reader_%s(irp_num)"%(x),self.needs)
|
||||
result += [" call reader_%s(irp_num)"%(x) for x in self.needs]
|
||||
result += [ \
|
||||
" irp_is_open = .True.",
|
||||
" irp_iunit = 9",
|
||||
@ -413,7 +413,7 @@ dimension.
|
||||
" if (.not.%s_is_built) then"%(self.same_as),
|
||||
" call provide_%s"%(self.same_as),
|
||||
" endif" ]
|
||||
result += map(lambda x: " call writer_%s(irp_num)"%(x),self.needs)
|
||||
result += [" call writer_%s(irp_num)"%(x) for x in self.needs]
|
||||
result += [ \
|
||||
" irp_is_open = .True.",
|
||||
" irp_iunit = 9",
|
||||
@ -480,7 +480,7 @@ dimension.
|
||||
return result+")'"
|
||||
|
||||
def check_dimensions():
|
||||
result = map(lambda x: "(%s>0)"%(dimsize(x)), self.dim)
|
||||
result = ["(%s>0)"%(dimsize(x)) for x in self.dim]
|
||||
result = ".and.".join(result)
|
||||
result = " if (%s) then"%(result)
|
||||
return result
|
||||
@ -555,7 +555,7 @@ dimension.
|
||||
if command_line.do_debug:
|
||||
result.append(" call irp_enter(irp_here)")
|
||||
result += call_provides(self.to_provide)
|
||||
result += flatten( map(build_alloc,[self.same_as]+self.others) )
|
||||
result += flatten( list(map(build_alloc,[self.same_as]+self.others)) )
|
||||
result += [ " if (.not.%s_is_built) then"%(same_as),
|
||||
" call bld_%s"%(same_as),
|
||||
" %s_is_built = .True."%(same_as), "" ]
|
||||
@ -591,7 +591,7 @@ dimension.
|
||||
vars = []
|
||||
if inside:
|
||||
text.append( (vars,line) )
|
||||
text += map( lambda x: ([],Simple_line(line.i,x,line.filename)), call_provides(vars) )
|
||||
text += [([],Simple_line(line.i,x,line.filename)) for x in call_provides(vars)]
|
||||
if command_line.do_profile and type(line) == Begin_provider:
|
||||
text.append( ( [], Declaration(line.i," double precision :: irp_rdtsc, irp_rdtsc1, irp_rdtsc2",line.filename) ) )
|
||||
text.append( ( [], Simple_line(line.i," irp_rdtsc1 = irp_rdtsc()",line.filename) ) )
|
||||
@ -602,9 +602,9 @@ dimension.
|
||||
text = parsed_text.move_to_top(text,Declaration)
|
||||
text = parsed_text.move_to_top(text,Implicit)
|
||||
text = parsed_text.move_to_top(text,Use)
|
||||
text = map(lambda x: x[1], text)
|
||||
text = [x[1] for x in text]
|
||||
# inside_omp = False
|
||||
for line in filter(lambda x: type(x) not in [ Begin_doc, End_doc, Doc], text):
|
||||
for line in [x for x in text if type(x) not in [ Begin_doc, End_doc, Doc]]:
|
||||
if type(line) == Begin_provider:
|
||||
result = []
|
||||
if command_line.directives and command_line.inline in ["all","builders"]:
|
||||
@ -692,11 +692,11 @@ if __name__ == '__main__':
|
||||
for i in x.needs:
|
||||
pair = (x.name, i)
|
||||
if pair not in done:
|
||||
print "%s -> %s"%( x.name, i )
|
||||
print("%s -> %s"%( x.name, i ))
|
||||
done[pair] = None
|
||||
print_dot(variables[i],done)
|
||||
|
||||
print "digraph G { "
|
||||
print("digraph G { ")
|
||||
# print_dot(variables['e_loc'], {})
|
||||
print_dot(variables['psi_value'], {})
|
||||
print "}"
|
||||
print("}")
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
# IRPF90 is a Fortran90 preprocessor written in Python for programming using
|
||||
# the Implicit Reference to Parameters (IRP) method.
|
||||
# Copyright (C) 2009 Anthony SCEMAMA
|
||||
@ -48,17 +48,17 @@ def create_variables():
|
||||
icount += 1
|
||||
v = Variable(buffer,icount)
|
||||
if v.name in result:
|
||||
print "Warning: Duplicate provider for %s in"%(v.name)
|
||||
print "- ", v.line.filename[0], " line ", v.line.i
|
||||
print "- ", result[v.name].line.filename[0], " line ", result[v.name].line.i
|
||||
print "Choosing first version"
|
||||
print("Warning: Duplicate provider for %s in"%(v.name))
|
||||
print("- ", v.line.filename[0], " line ", v.line.i)
|
||||
print("- ", result[v.name].line.filename[0], " line ", result[v.name].line.i)
|
||||
print("Choosing first version")
|
||||
result[v.name] = v
|
||||
for other in v.others:
|
||||
if other in result:
|
||||
print "Warning: Duplicate provider for %s in"%(other)
|
||||
print "- ", v.line.filename[0], " line ", v.line.i
|
||||
print "- ", result[other].line.filename[0], " line ", result[other].line.i
|
||||
print "Choosing first version"
|
||||
print("Warning: Duplicate provider for %s in"%(other))
|
||||
print("- ", v.line.filename[0], " line ", v.line.i)
|
||||
print("- ", result[other].line.filename[0], " line ", result[other].line.i)
|
||||
print("Choosing first version")
|
||||
result[other] = Variable(buffer,icount,other)
|
||||
buffer = []
|
||||
return result
|
||||
@ -67,16 +67,16 @@ variables = create_variables()
|
||||
|
||||
######################################################################
|
||||
def build_use(vars):
|
||||
result = map(lambda x: " use %s"%(variables[x].fmodule), vars)
|
||||
result = [" use %s"%(variables[x].fmodule) for x in vars]
|
||||
result = make_single(result)
|
||||
return result
|
||||
|
||||
######################################################################
|
||||
def call_provides(vars,opt=False):
|
||||
vars = make_single( map(lambda x: variables[x].same_as, vars) )
|
||||
vars = make_single( [variables[x].same_as for x in vars] )
|
||||
if opt:
|
||||
all_children = flatten( map(lambda x: variables[x].children, vars ))
|
||||
vars = filter(lambda x: x not in all_children,vars)
|
||||
all_children = flatten( [variables[x].children for x in vars])
|
||||
vars = [x for x in vars if x not in all_children]
|
||||
def fun(x):
|
||||
result = []
|
||||
result += [ \
|
||||
@ -87,10 +87,10 @@ def call_provides(vars,opt=False):
|
||||
" endif" ]
|
||||
return result
|
||||
|
||||
result = flatten ( map (fun, vars) )
|
||||
result = flatten ( list(map (fun, vars)) )
|
||||
return result
|
||||
|
||||
######################################################################
|
||||
if __name__ == '__main__':
|
||||
for v in variables.keys():
|
||||
print v
|
||||
for v in list(variables.keys()):
|
||||
print(v)
|
||||
|
@ -1 +1 @@
|
||||
version = "1.7.7"
|
||||
version = "2.0.0"
|
||||
|
@ -1,4 +1,4 @@
|
||||
#/usr/bin/env python2
|
||||
#/usr/bin/env python3
|
||||
# IRPF90 is a Fortran90 preprocessor written in Python for programming using
|
||||
# the Implicit Reference to Parameters (IRP) method.
|
||||
# Copyright (C) 2009 Anthony SCEMAMA
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os,sys
|
||||
ROOT = os.path.dirname(__file__)+'/../../'
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
ROOT = os.path.dirname(__file__)+'/../../'
|
||||
|
Loading…
Reference in New Issue
Block a user