aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Parborg <darkdefende@gmail.com>2011-08-02 02:02:39 +0200
committerSebastian Parborg <darkdefende@gmail.com>2011-08-02 02:02:39 +0200
commit6cccf68576fde668220b8e1149c797d38e4b8982 (patch)
tree9b41da553540ee926639e8c86bdbe94ef37d7106 /filetypes/autoconf.py
parentNeed to rework how the automakefile scan works. (diff)
downloadebuildgen-6cccf68576fde668220b8e1149c797d38e4b8982.tar.gz
ebuildgen-6cccf68576fde668220b8e1149c797d38e4b8982.tar.bz2
ebuildgen-6cccf68576fde668220b8e1149c797d38e4b8982.zip
Added some basic support for include flags and m4_include
Diffstat (limited to 'filetypes/autoconf.py')
-rw-r--r--filetypes/autoconf.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/filetypes/autoconf.py b/filetypes/autoconf.py
index 9b9dba0..71ec0b2 100644
--- a/filetypes/autoconf.py
+++ b/filetypes/autoconf.py
@@ -357,7 +357,7 @@ def scanacfile(acfile):
from filetypes.acif import parseif
-def output(inputlst):
+def output(inputlst,topdir):
variables = dict()
iflst = []
for item in inputlst:
@@ -397,6 +397,11 @@ def output(inputlst):
#"!" == not zero/defined, "" zero/not defined
if_state[1][var] = "true"
+ elif item[0] == "m4_include":
+ newvar,newiflst = output(scanacfile(openfile(topdir + item[1])),topdir)
+ variables.update(newvar)
+ iflst += newiflst
+
#for variable in variables:
#print(variable)
#print(variables[variable])
@@ -466,5 +471,9 @@ def convnames(string): #strip none alfanumeric chars and replace them with "_"
return newstr
#this is no a good name, come up with a better one!
-def scanac(acfile):
- return output(scanacfile(acfile))
+def scanac(acfile,topdir):
+ return output(scanacfile(acfile),topdir)
+
+def openfile(ofile):
+ with open(ofile, encoding="utf-8", errors="replace") as inputfile:
+ return inputfile.read()