From 4eb285cf902a46c3c99bc2c999e486d7c218354b Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Thu, 14 Feb 2013 16:28:44 +0900 Subject: [PATCH] Fix: local manifest deprecation warning appears more than once When running repo sync, the local_manifest.xml deprecation warning is shown twice. Add a flag to ensure that it is only displayed once. Change-Id: Icfa2b0b6249c037c29771f9860252e6eda3ae651 --- manifest_xml.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/manifest_xml.py b/manifest_xml.py index 07f0c66a..50417c60 100644 --- a/manifest_xml.py +++ b/manifest_xml.py @@ -94,6 +94,7 @@ class XmlManifest(object): self.topdir = os.path.dirname(self.repodir) self.manifestFile = os.path.join(self.repodir, MANIFEST_FILE_NAME) self.globalConfig = GitConfig.ForUser() + self.localManifestWarning = False self.repoProject = MetaProject(self, 'repo', gitdir = os.path.join(repodir, 'repo/.git'), @@ -335,9 +336,11 @@ class XmlManifest(object): local = os.path.join(self.repodir, LOCAL_MANIFEST_NAME) if os.path.exists(local): - print('warning: %s is deprecated; put local manifests in `%s` instead' - % (LOCAL_MANIFEST_NAME, os.path.join(self.repodir, LOCAL_MANIFESTS_DIR_NAME)), - file=sys.stderr) + if not self.localManifestWarning: + self.localManifestWarning = True + print('warning: %s is deprecated; put local manifests in `%s` instead' + % (LOCAL_MANIFEST_NAME, os.path.join(self.repodir, LOCAL_MANIFESTS_DIR_NAME)), + file=sys.stderr) nodes.append(self._ParseManifestXml(local, self.repodir)) local_dir = os.path.abspath(os.path.join(self.repodir, LOCAL_MANIFESTS_DIR_NAME))