55 lines
2.0 KiB
Diff
55 lines
2.0 KiB
Diff
Index: pisi/pxml/xmlfile.py
|
|
===================================================================
|
|
--- pisi/pxml/xmlfile.py (revision 26639)
|
|
+++ pisi/pxml/xmlfile.py (working copy)
|
|
@@ -27,6 +27,7 @@
|
|
|
|
import codecs
|
|
import exceptions
|
|
+import cStringIO
|
|
|
|
import piksemel as iks
|
|
|
|
@@ -79,8 +80,17 @@
|
|
localpath = pisi.file.File.download(uri, tmpDir, sha1sum=sha1sum,
|
|
compress=compress,sign=sign, copylocal=copylocal)
|
|
|
|
+ st = cStringIO.StringIO()
|
|
+
|
|
try:
|
|
- self.doc = iks.parse(localpath)
|
|
+ from preprocess import preprocess, PreprocessError
|
|
+ preprocess(infile=localpath, outfile=st, defines=pisi.config.Config().values.directives)
|
|
+ st.seek(0)
|
|
+ except:
|
|
+ st = open(localpath, "r")
|
|
+
|
|
+ try:
|
|
+ self.doc = iks.parseString(st.read())
|
|
return self.doc
|
|
except OSError, e:
|
|
raise Error(_("Unable to read file (%s): %s") %(localpath,e))
|
|
Index: pisi/configfile.py
|
|
===================================================================
|
|
--- pisi/configfile.py (revision 26639)
|
|
+++ pisi/configfile.py (working copy)
|
|
@@ -179,6 +179,18 @@
|
|
dirsitems = []
|
|
self.dirs = ConfigurationSection("directories", dirsitems)
|
|
|
|
+ try:
|
|
+ directiveitems = self.parser.items("directives")
|
|
+ except ConfigParser.NoSectionError:
|
|
+ self.directives = {}
|
|
+ else:
|
|
+ self.directives = {}
|
|
+ for k,v in directiveitems:
|
|
+ if v in ("True", "False"):
|
|
+ self.directives[k] = eval(v)
|
|
+ else:
|
|
+ self.directives[k] = v
|
|
+
|
|
# get, set and write_config methods added for manipulation of pisi.conf file from Comar to solve bug #5668.
|
|
# Current ConfigParser does not keep the comments and white spaces, which we do not want for pisi.conf. There
|
|
# are patches floating in the python sourceforge to add this feature. The write_config code is from python
|