diff options
Diffstat (limited to 'manifest_xml.py')
-rw-r--r-- | manifest_xml.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/manifest_xml.py b/manifest_xml.py index cdee87a6..d16f1a98 100644 --- a/manifest_xml.py +++ b/manifest_xml.py | |||
@@ -27,6 +27,7 @@ from error import ManifestParseError | |||
27 | 27 | ||
28 | MANIFEST_FILE_NAME = 'manifest.xml' | 28 | MANIFEST_FILE_NAME = 'manifest.xml' |
29 | LOCAL_MANIFEST_NAME = 'local_manifest.xml' | 29 | LOCAL_MANIFEST_NAME = 'local_manifest.xml' |
30 | LOCAL_MANIFESTS_DIR_NAME = 'local_manifests' | ||
30 | 31 | ||
31 | urlparse.uses_relative.extend(['ssh', 'git']) | 32 | urlparse.uses_relative.extend(['ssh', 'git']) |
32 | urlparse.uses_netloc.extend(['ssh', 'git']) | 33 | urlparse.uses_netloc.extend(['ssh', 'git']) |
@@ -299,8 +300,21 @@ class XmlManifest(object): | |||
299 | 300 | ||
300 | local = os.path.join(self.repodir, LOCAL_MANIFEST_NAME) | 301 | local = os.path.join(self.repodir, LOCAL_MANIFEST_NAME) |
301 | if os.path.exists(local): | 302 | if os.path.exists(local): |
303 | print >>sys.stderr, 'warning: %s is deprecated; put local manifests in %s instead' % \ | ||
304 | (LOCAL_MANIFEST_NAME, LOCAL_MANIFESTS_DIR_NAME) | ||
302 | nodes.append(self._ParseManifestXml(local, self.repodir)) | 305 | nodes.append(self._ParseManifestXml(local, self.repodir)) |
303 | 306 | ||
307 | local_dir = os.path.abspath(os.path.join(self.repodir, LOCAL_MANIFESTS_DIR_NAME)) | ||
308 | try: | ||
309 | for local_file in os.listdir(local_dir): | ||
310 | if local_file.endswith('.xml'): | ||
311 | try: | ||
312 | nodes.append(self._ParseManifestXml(local_file, self.repodir)) | ||
313 | except ManifestParseError as e: | ||
314 | print >>sys.stderr, '%s' % str(e) | ||
315 | except OSError: | ||
316 | pass | ||
317 | |||
304 | self._ParseManifest(nodes) | 318 | self._ParseManifest(nodes) |
305 | 319 | ||
306 | if self.IsMirror: | 320 | if self.IsMirror: |
@@ -310,7 +324,11 @@ class XmlManifest(object): | |||
310 | self._loaded = True | 324 | self._loaded = True |
311 | 325 | ||
312 | def _ParseManifestXml(self, path, include_root): | 326 | def _ParseManifestXml(self, path, include_root): |
313 | root = xml.dom.minidom.parse(path) | 327 | try: |
328 | root = xml.dom.minidom.parse(path) | ||
329 | except (OSError, xml.parsers.expat.ExpatError) as e: | ||
330 | raise ManifestParseError("error parsing manifest %s: %s" % (path, e)) | ||
331 | |||
314 | if not root or not root.childNodes: | 332 | if not root or not root.childNodes: |
315 | raise ManifestParseError("no root node in %s" % (path,)) | 333 | raise ManifestParseError("no root node in %s" % (path,)) |
316 | 334 | ||