|
From: <ai...@us...> - 2013-07-07 20:03:05
|
Revision: 12406
http://sourceforge.net/p/plplot/code/12406
Author: airwin
Date: 2013-07-07 20:03:03 +0000 (Sun, 07 Jul 2013)
Log Message:
-----------
The overview is the stdout from this script will be used as input for
another python script (still being designed) to transform the single
complete xml file into build_projects configuration files.
This should be the final version of this script for gtk-3.4.1, but it
is likely changes will have to be made for other versions of gtk
modules (when we move to those) since some exact syntax assumptions
are made that are correct for 3.4.1 jhbuild module files, but might
not be correct for other versions.
Tested by: Alan W. Irwin <ai...@us...> by running
./gtk_xml_recursive_process.py /home/software/pango_stack/jhbuild/modulesets/3.4.1/gnome-apps-3.4.1.modules
This command followed all the includes. That is, all *.modules files
in that directory were included in the output to stdout as measured by
some spot checking and "wc -l" line count results that jibed with the
total line count for *.modules files in that directory (if you account
for three dropped include lines and two head lines and one tail line
that are dropped from the included files).
Modified Paths:
--------------
trunk/cmake/build_projects/gtk_xml_recursive_process.py
Modified: trunk/cmake/build_projects/gtk_xml_recursive_process.py
===================================================================
--- trunk/cmake/build_projects/gtk_xml_recursive_process.py 2013-07-07 18:00:07 UTC (rev 12405)
+++ trunk/cmake/build_projects/gtk_xml_recursive_process.py 2013-07-07 20:03:03 UTC (rev 12406)
@@ -3,6 +3,12 @@
# Recursively read gtk jhbuild xml module files following include
# elements to produce the equivalent single xml file.
+# N.B. This logic assumes exact syntax that is in gtk 3.4.1 version of
+# module files including blank characters, and there is no guarantee
+# for different gtk that that syntax will be immutable. So it is likely
+# this file will need maintenance for other versions of gtk. See EXACT
+# comments below where changes might have to be made.
+
# Copyright (C) 2013 Alan W. Irwin
# This file is free software; you can redistribute it and/or
@@ -26,10 +32,33 @@
fileobject = open(fullpath)
line = fileobject.readline()
while line:
- sys.stdout.write(line)
+ if if_included:
+ # ignore certain lines if the file is included
+ # EXACT
+ if line.find('<?xml version="1.0" ?>') >= 0:
+ line = fileobject.readline()
+ continue
+ # EXACT
+ if line.find('<moduleset>') >= 0:
+ line = fileobject.readline()
+ continue
+ # EXACT
+ if line.find('</moduleset>') >= 0:
+ line = fileobject.readline()
+ continue
+ # EXACT
+ index = line.find('<include href="')
+ if index >=0:
+ start = line.index('"')
+ stop = line.rindex('"')
+ included_filename = line[start+1: stop]
+ recursive_process(path, included_filename, True)
+ else:
+ sys.stdout.write(line)
line = fileobject.readline()
fileobject.close()
+#sys.setrecursionlimit(10)
fullpath = sys.argv[1]
index = fullpath.rfind("/")
if index >=0 and len(fullpath) > index + 1:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|