diff -r 7685cec9fd3c -r f2ddfa555b0f doc/api/python/vbaconf.new_delivery-pysrc.html
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/api/python/vbaconf.new_delivery-pysrc.html Fri Sep 11 11:54:49 2009 +0100
@@ -0,0 +1,359 @@
+
+
+
+
+ vbaconf.new_delivery
+
+
+
+
+
+
+
+
+
+
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20 """ Helper to convert delivery.xml and prep.xml to VirtualBuildArea
+ 21 configuration file.
+ 22 """
+ 23 from xml.dom.minidom import getDOMImplementation
+ 24 import amara
+ 25 import ccm
+ 26 import re
+ 27 import os.path
+ 28 import sys
+ 29 import configuration
+ 30
+ 32 """ Returns path without any sequence of '/' and replacing '\' by '/' """
+
33 return re.sub(r'/+', '/', re.sub(r'\\', '/', path))
+
34
+ 36 """ wrapper object to access directly conf property. """
+
38 self.project = config.name
+
39 self.dir = config['dir']
+
40
+ 42 """ deliveryinput: path to delivery conf file (old format).
+
43 prepinput: path to the prep conf file.
+
44 Return XML Document object.
+
45 """
+
46 impl = getDOMImplementation()
+
47 doc = getDOMImplementation().createDocument(None, "virtualBuildArea", None)
+
48 vba = doc.getElementsByTagName("virtualBuildArea")[0]
+
49
+
50
+
51 configBuilder = configuration.NestedConfigurationBuilder(open(deliveryinput, 'r'))
+
52 deliveryConfigs = configBuilder.getConfiguration().getConfigurations()
+
53
+
54
+
55 prep = amara.parse(open(prepinput, 'r'))
+
56
+
57 for source in prep.xml_xpath('/prepSpec/source'):
+
58 basedir = cleanup_path(source.basedir)
+
59 for copy in source.xml_xpath('./copy'):
+
60 src = cleanup_path(copy.name)
+
61 for config in deliveryConfigs:
+
62 p = config_wrapper(config)
+
63 ccmp = ccm.FourPartName(p.project)
+
64 p_dir = cleanup_path(p.dir)
+
65
+
66
+
67
+
68 if (re.match(r"%s/%s" % (ccmp.name, ccmp.name), src, re.I) is not None) and not hasattr(copy, 'dest'):
+
69 print "All object from root."
+
70 add = doc.createElementNS("", "add")
+
71 add.setAttributeNS("", "project", str(ccmp))
+
72 vba.appendChild(add)
+
73 objs = doc.createElementNS("", "objects")
+
74 objs.setAttributeNS("", "from", ccmp.name)
+
75 add.appendChild(objs)
+
76
+
77 elif (re.match(r"%s/%s" % (ccmp.name, ccmp.name), src, re.I) is not None) and hasattr(copy, 'dest'):
+
78 if os.path.basename(copy.dest).lower() == ccmp.name.lower():
+
79 add = doc.createElementNS("", "add")
+
80 add.setAttributeNS("", "project", str(ccmp))
+
81 add.setAttributeNS("", "to", cleanup_path('/' + os.path.dirname(copy.dest)))
+
82 vba.appendChild(add)
+
83 else:
+
84 add = doc.createElementNS("", "add")
+
85 add.setAttributeNS("", "project", str(ccmp))
+
86 add.setAttributeNS("", "to", cleanup_path('/' + copy.dest))
+
87 vba.appendChild(add)
+
88
+
89 elif cleanup_path(basedir + "/" + src) == p_dir:
+
90 print "Adding to subdirectory"
+
91 print ccmp.name, basedir + "/" + src, p_dir
+
92 add = doc.createElementNS("", "add")
+
93 add.setAttributeNS("", "project", str(ccmp))
+
94 if hasattr(copy, 'dest'):
+
95 add.setAttributeNS("", "to", cleanup_path('/' + copy.dest + '/' + ccmp.name))
+
96 else:
+
97 add.setAttributeNS("", "to", cleanup_path('/'+ ccmp.name))
+
98 vba.appendChild(add)
+
99 elif p_dir.startswith(cleanup_path(basedir + "/" + src + '/')):
+
100 print "Adding to subdirectory"
+
101 delta = p_dir[len(cleanup_path(basedir)):]
+
102 add = doc.createElementNS("", "add")
+
103 add.setAttributeNS("", "project", str(ccmp))
+
104 if hasattr(copy, 'dest'):
+
105 add.setAttributeNS("", "to", cleanup_path('/' + os.path.dirname(copy.dest) + '/' + delta + '/' + ccmp.name))
+
106 else:
+
107 add.setAttributeNS("", "to", cleanup_path(delta + '/' + ccmp.name))
+
108 vba.appendChild(add)
+
109 return doc
+
110
+
+
+
+
+
+
+
+
+
+