mirror of
https://gitlab.com/scemama/irpf90.git
synced 2024-12-22 04:13:33 +01:00
Added nice management of files
Version:1.1.16
This commit is contained in:
parent
448e566dc4
commit
db16f6a399
@ -4,7 +4,7 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
wd = os.path.abspath(os.path.dirname(__file__))
|
wd = os.path.abspath(os.path.dirname(__file__))
|
||||||
wd += "/../src/"
|
sys.path.insert(0,(wd+"/../src/"))
|
||||||
sys.path.append(wd)
|
sys.path.insert(0,(wd+"/../share/irpf90/src/"))
|
||||||
|
|
||||||
import irpf90
|
import irpf90
|
||||||
|
@ -4,8 +4,8 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
wd = os.path.abspath(os.path.dirname(__file__))
|
wd = os.path.abspath(os.path.dirname(__file__))
|
||||||
wd += "/../src/"
|
sys.path.insert(0,(wd+"/../src/"))
|
||||||
sys.path.append(wd)
|
sys.path.insert(0,(wd+"/../share/irpf90/src/"))
|
||||||
|
|
||||||
if len(sys.argv) != 2:
|
if len(sys.argv) != 2:
|
||||||
print "Usage:"
|
print "Usage:"
|
||||||
|
BIN
man/man1/irpf90.1.gz
Normal file
BIN
man/man1/irpf90.1.gz
Normal file
Binary file not shown.
BIN
man/man1/irpman.1.gz
Normal file
BIN
man/man1/irpman.1.gz
Normal file
Binary file not shown.
17
packages/Makefile
Normal file
17
packages/Makefile
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
include version
|
||||||
|
default:
|
||||||
|
rm *.rpm *.tar.gz 2> /dev/null ;\
|
||||||
|
VERSION=$(VERSION) epm -m noarch irpf90 irpf90.list ;\
|
||||||
|
cd noarch ;\
|
||||||
|
cp ~/.rpmmacros .;\
|
||||||
|
echo "%_topdir $$PWD" > ~/.rpmmacros ;\
|
||||||
|
echo "%buildroot %_topdir/buildroot" >> ~/.rpmmacros ;\
|
||||||
|
cd ..;\
|
||||||
|
VERSION=$(VERSION) epm -m noarch -vv -f rpm irpf90 irpf90.list ;\
|
||||||
|
cp noarch/.rpmmacros ~;\
|
||||||
|
mv noarch/*.tar.gz . ;\
|
||||||
|
mv noarch/*.rpm . ;\
|
||||||
|
rm -rf noarch
|
||||||
|
|
||||||
|
version: ../src/version.py
|
||||||
|
./make_version.py > version
|
57
packages/irpf90.list
Normal file
57
packages/irpf90.list
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
# epm -f format irpf90 irpf90.list
|
||||||
|
# format:
|
||||||
|
# aix
|
||||||
|
# bsd
|
||||||
|
# depot or swinstall (HP-UX)
|
||||||
|
# dpkg
|
||||||
|
# inst or tardist (IRIX
|
||||||
|
# native (native for the current platform)
|
||||||
|
# osx
|
||||||
|
# pkg (Solaris)
|
||||||
|
# portable (default)
|
||||||
|
# rpm
|
||||||
|
# setld (Tru64)
|
||||||
|
# slackware
|
||||||
|
|
||||||
|
# Product information
|
||||||
|
# -------------------
|
||||||
|
|
||||||
|
%product irpf90
|
||||||
|
%copyright 2009 A. Scemama, CNRS
|
||||||
|
%vendor A. Scemama, CNRS
|
||||||
|
%license ../LICENSE
|
||||||
|
%readme ../README
|
||||||
|
%description IRP-Fortran90 preprocessor
|
||||||
|
%version $VERSION
|
||||||
|
|
||||||
|
%format rpm
|
||||||
|
%requires python
|
||||||
|
%requires make
|
||||||
|
|
||||||
|
%format all
|
||||||
|
|
||||||
|
# Autoconfiguration variables
|
||||||
|
# ---------------------------
|
||||||
|
|
||||||
|
$prefix=/usr
|
||||||
|
$exec_prefix=/usr
|
||||||
|
$bindir=${exec_prefix}/bin
|
||||||
|
$datadir=${exec_prefix}/share/irpf90/src
|
||||||
|
$docdir=${datadir}/share/irpf90/doc
|
||||||
|
$mandir=${datadir}/man
|
||||||
|
$srcdir=..
|
||||||
|
|
||||||
|
# Executables
|
||||||
|
# -----------
|
||||||
|
|
||||||
|
%system all
|
||||||
|
%description IRP-Fortran90 preprocessor
|
||||||
|
f 0444 root sys ${mandir}/man1/irpf90.1.gz ${srcdir}/man/man1/irpf90.1.gz
|
||||||
|
f 0444 root sys ${mandir}/man1/irpman.1.gz ${srcdir}/man/man1/irpman.1.gz
|
||||||
|
f 0555 root sys ${bindir}/irpf90 ${srcdir}/bin/irpf90
|
||||||
|
f 0555 root sys ${bindir}/irpman ${srcdir}/bin/irpman
|
||||||
|
f 0555 root sys ${datadir}/ ${srcdir}/src/*.py
|
||||||
|
f 0444 root sys ${docdir}/README ${srcdir}/README
|
||||||
|
f 0444 root sys ${docdir}/LICENSE ${srcdir}/LICENSE
|
||||||
|
|
||||||
|
|
7
packages/make_version.py
Executable file
7
packages/make_version.py
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
import sys, os
|
||||||
|
wd = os.path.abspath(os.path.dirname(__file__))
|
||||||
|
sys.path.insert(0,(wd+"/../src/"))
|
||||||
|
from version import *
|
||||||
|
print "VERSION=%s"%(version)
|
@ -9,8 +9,6 @@ options['d'] = [ 'debug' , 'Activate debug', 0 ]
|
|||||||
options['v'] = [ 'version' , 'Print version of irpf90', 0 ]
|
options['v'] = [ 'version' , 'Print version of irpf90', 0 ]
|
||||||
options['a'] = [ 'assert' , 'Activate assertions', 0 ]
|
options['a'] = [ 'assert' , 'Activate assertions', 0 ]
|
||||||
options['h'] = [ 'help' , 'Print this help', 0 ]
|
options['h'] = [ 'help' , 'Print this help', 0 ]
|
||||||
options['o'] = [ 'openmp' , 'Activate openMP', 0 ]
|
|
||||||
options['c'] = [ 'check_cycles' , 'Check cycles in dependencies', 0 ]
|
|
||||||
options['i'] = [ 'init' , 'Initialize current directory', 0 ]
|
options['i'] = [ 'init' , 'Initialize current directory', 0 ]
|
||||||
options['D'] = [ 'define' , 'Define variable', 1 ]
|
options['D'] = [ 'define' , 'Define variable', 1 ]
|
||||||
options['p'] = [ 'preprocess' , 'Preprocess file', 1 ]
|
options['p'] = [ 'preprocess' , 'Preprocess file', 1 ]
|
||||||
@ -102,7 +100,11 @@ do_$LONG = property(fget=do_$LONG)
|
|||||||
|
|
||||||
def do_run(self):
|
def do_run(self):
|
||||||
if '_do_run' not in self.__dict__:
|
if '_do_run' not in self.__dict__:
|
||||||
self._do_run = not (self.do_version or self.do_init)
|
self._do_run = not ( \
|
||||||
|
self.do_version or \
|
||||||
|
self.do_help or \
|
||||||
|
self.do_preprocess or \
|
||||||
|
self.do_init )
|
||||||
return self._do_run
|
return self._do_run
|
||||||
do_run = property(fget=do_run)
|
do_run = property(fget=do_run)
|
||||||
|
|
||||||
|
@ -30,7 +30,11 @@ def init():
|
|||||||
# Copy current files in the irpdir
|
# Copy current files in the irpdir
|
||||||
for filename in os.listdir(os.getcwd()):
|
for filename in os.listdir(os.getcwd()):
|
||||||
if not filename[0].startswith(".") and not os.path.isdir(filename):
|
if not filename[0].startswith(".") and not os.path.isdir(filename):
|
||||||
|
try:
|
||||||
file = open(filename,"r")
|
file = open(filename,"r")
|
||||||
|
except IOError:
|
||||||
|
print "Warning : Unable to read file %s."%(filename)
|
||||||
|
else:
|
||||||
buffer = file.readlines()
|
buffer = file.readlines()
|
||||||
file.close()
|
file.close()
|
||||||
if not util.same_file(irpf90_t.irpdir+filename,buffer):
|
if not util.same_file(irpf90_t.irpdir+filename,buffer):
|
||||||
|
@ -9,19 +9,19 @@ def main():
|
|||||||
if command_line.do_version:
|
if command_line.do_version:
|
||||||
from version import version
|
from version import version
|
||||||
print version
|
print version
|
||||||
return
|
|
||||||
|
from init import init
|
||||||
|
if command_line.do_init:
|
||||||
|
init()
|
||||||
|
|
||||||
if command_line.do_preprocess:
|
if command_line.do_preprocess:
|
||||||
|
init()
|
||||||
from preprocessed_text import preprocessed_text
|
from preprocessed_text import preprocessed_text
|
||||||
for filename,text in preprocessed_text:
|
for filename,text in preprocessed_text:
|
||||||
if filename in command_line.preprocessed:
|
if filename in command_line.preprocessed:
|
||||||
for line in text:
|
for line in text:
|
||||||
print line.text
|
print line.text
|
||||||
return
|
|
||||||
|
|
||||||
from init import init
|
|
||||||
if command_line.do_init:
|
|
||||||
init()
|
|
||||||
if not command_line.do_run:
|
if not command_line.do_run:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -263,9 +263,8 @@ def create_irpf90_files():
|
|||||||
result = []
|
result = []
|
||||||
from command_line import command_line
|
from command_line import command_line
|
||||||
import os
|
import os
|
||||||
if command_line.do_run:
|
|
||||||
def is_irpf90_file(filename):
|
def is_irpf90_file(filename):
|
||||||
return filename.endswith(".irp.f") #DEUBUG and filename.startswith("p")
|
return filename.endswith(".irp.f")
|
||||||
result = filter ( is_irpf90_file, os.listdir(os.getcwd()) )
|
result = filter ( is_irpf90_file, os.listdir(os.getcwd()) )
|
||||||
return result
|
return result
|
||||||
irpf90_files = create_irpf90_files()
|
irpf90_files = create_irpf90_files()
|
||||||
|
@ -159,6 +159,10 @@ def execute_shell(text):
|
|||||||
elif isinstance(line,End_shell):
|
elif isinstance(line,End_shell):
|
||||||
inside = False
|
inside = False
|
||||||
# Write script file
|
# Write script file
|
||||||
|
scriptname = "%s%s_shell_%d"%(irpdir,line.filename,line.i)
|
||||||
|
file = open(scriptname,'w')
|
||||||
|
file.writelines(script)
|
||||||
|
file.close()
|
||||||
scriptname = "%s_shell_%d"%(line.filename,line.i)
|
scriptname = "%s_shell_%d"%(line.filename,line.i)
|
||||||
file = open(scriptname,'w')
|
file = open(scriptname,'w')
|
||||||
file.writelines(script)
|
file.writelines(script)
|
||||||
@ -169,6 +173,7 @@ def execute_shell(text):
|
|||||||
lines = pipe.readlines()
|
lines = pipe.readlines()
|
||||||
pipe.close()
|
pipe.close()
|
||||||
result += get_text(lines,scriptname)
|
result += get_text(lines,scriptname)
|
||||||
|
os.remove(scriptname)
|
||||||
else:
|
else:
|
||||||
script.append(line.text+'\n')
|
script.append(line.text+'\n')
|
||||||
else:
|
else:
|
||||||
|
@ -1 +1 @@
|
|||||||
version = "1.1.15"
|
version = "1.1.16"
|
||||||
|
Loading…
Reference in New Issue
Block a user