[meld] Reenable deprecation warnings and update code which uses them



commit acef43d5151789cfa8e0b3226ad333956ab66a6d
Author: Stephen Kennedy <stevek gnome org>
Date:   Sat May 23 16:57:36 2009 +0100

    Reenable deprecation warnings and update code which uses them
---
 meld            |    6 +++---
 vc/_vc.py       |    5 +++++
 vc/bzr.py       |    4 ++--
 vc/cdv.py       |    4 +---
 vc/darcs.py     |    7 +++----
 vc/git.py       |    2 +-
 vc/mercurial.py |    2 +-
 vc/monotone.py  |    9 ++++-----
 vc/svn.py       |    2 +-
 vc/tla.py       |    4 ++--
 10 files changed, 23 insertions(+), 22 deletions(-)

diff --git a/meld b/meld
index 7cd92a7..76dce5e 100755
--- a/meld
+++ b/meld
@@ -75,9 +75,9 @@ if gtk.pygtk_version < pygtkver:
     missing_reqs("pygtk", pygtkver)
 
 # Ignore deprecation warnings from pygtk > 2.6
-if gtk.pygtk_version >= (2,8,0):
-    import warnings
-    warnings.filterwarnings("ignore", category=DeprecationWarning)
+#if gtk.pygtk_version >= (2,8,0):
+#    import warnings
+#    warnings.filterwarnings("ignore", category=DeprecationWarning)
 
 gtk.glade.bindtextdomain("meld", paths.locale_dir())
 gtk.glade.textdomain("meld")
diff --git a/vc/_vc.py b/vc/_vc.py
index c16cdef..68e5160 100644
--- a/vc/_vc.py
+++ b/vc/_vc.py
@@ -23,6 +23,7 @@
 
 import os
 import re
+import subprocess
 from gettext import gettext as _
 
 # ignored, new, normal, ignored changes,
@@ -186,3 +187,7 @@ class CachedVc(Vc):
         if self._tree_cache is None:
             self.cache_inventory(directory)
         return self._tree_cache
+
+def popen(cmd, cwd=None):
+    return subprocess.Popen(cmd, cwd=cwd, stdout=subprocess.PIPE).stdout
+
diff --git a/vc/bzr.py b/vc/bzr.py
index d52e454..798a80a 100644
--- a/vc/bzr.py
+++ b/vc/bzr.py
@@ -60,10 +60,10 @@ class Vc(_vc.CachedVc):
         return self.root
 
     def _lookup_tree_cache(self, rootdir):
-        branch_root = os.popen("%s root %s" % (self.CMD, rootdir)).read().rstrip('\n')
+        branch_root = _vc.popen([self.CMD, "root", rootdir]).read().rstrip('\n')
         while 1:
             try:
-                proc = os.popen("%s status %s" % (self.CMD, branch_root))
+                proc = _vc.popen([self.CMD, status, branch_root])
                 entries = proc.read().split("\n")[:-1]
                 break
             except OSError, e:
diff --git a/vc/cdv.py b/vc/cdv.py
index 76cce31..a9f8847 100644
--- a/vc/cdv.py
+++ b/vc/cdv.py
@@ -21,8 +21,6 @@
 ### (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 ### THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-import os
-import misc
 import _vc
 import svn
 
@@ -38,6 +36,6 @@ class Vc(svn.Vc):
         return self.root
 
     def _get_matches(self, directory):
-        entries = misc.cmdout([self.CMD, "status"], cwd=directory)[0]
+        entries = _vc.popen([self.CMD, "status"], cwd=directory).read()
         for line in entries.split("\n")[1:-1]:
             yield line[3:], line[0], ""
diff --git a/vc/darcs.py b/vc/darcs.py
index 9d22cb1..fcc9321 100644
--- a/vc/darcs.py
+++ b/vc/darcs.py
@@ -89,13 +89,12 @@ class Vc(_vc.CachedVc):
 
     def _get_whatsnew(self, boring=False):
         whatsnew = {}
-        commandline = ('%s whatsnew --summary -l --repodir=%s' %
-                      (self.CMD, self.root))
+        commandline = [self.CMD, "whatsnew", "--summary", "-l" "--repodir="+self.root]
         if boring:
-            commandline = '%s --boring' % commandline
+            commandline.append("--boring")
         while 1:
             try:
-                p = os.popen(commandline)
+                p = _vc.popen(commandline)
                 break
             except OSError, e:
                 if e.errno != errno.EAGAIN:
diff --git a/vc/git.py b/vc/git.py
index e239fde..3f51e22 100644
--- a/vc/git.py
+++ b/vc/git.py
@@ -68,7 +68,7 @@ class Vc(_vc.CachedVc):
     def _lookup_tree_cache(self, rootdir):
         while 1:
             try:
-                proc = os.popen("cd %s && %s status --untracked-files" % (self.root, self.CMD))
+                proc = _vc.popen([self.CMD, "status", "--untracked-files"], cwd=self.root)
                 entries = proc.read().split("\n")[:-1]
                 break
             except OSError, e:
diff --git a/vc/mercurial.py b/vc/mercurial.py
index 157afe0..1d7aa55 100644
--- a/vc/mercurial.py
+++ b/vc/mercurial.py
@@ -66,7 +66,7 @@ class Vc(_vc.Vc):
 
         while 1:
             try:
-                entries = os.popen('cd "%s" && %s status -A .' % (directory, self.CMD)).read().split("\n")[:-1]
+                entries = _vc.popen([self.CMD, "status", "-A", "."], cwd=directory).read().split("\n")[:-1]
                 break
             except OSError, e:
                 if e.errno != errno.EAGAIN:
diff --git a/vc/monotone.py b/vc/monotone.py
index 703eafb..69cde5f 100644
--- a/vc/monotone.py
+++ b/vc/monotone.py
@@ -119,11 +119,10 @@ class Vc(_vc.CachedVc):
             # for monotone >= 0.26
             self.VC_DIR = "_MTN"
             self.CMD = "mtn"
-            cstdin, cstdout, cstderr = os.popen3(self.CMD + " automate interface_version")
-            self.interface_version = float(cstdout.read())
+            self.interface_version = float(_vc.popen([self.CMD, "automate", "interface_version"]).read())
             if self.interface_version > 9.0:
                 print "WARNING: Unsupported interface version (please report any problems to the meld mailing list)"
-        except ValueError:
+        except (ValueError, OSError):
             # for monotone <= 0.25
             self.VC_DIR = "MT"
             self.CMD = "monotone"
@@ -150,8 +149,8 @@ class Vc(_vc.CachedVc):
     def _lookup_tree_cache(self, rootdir):
         while 1:
             try:
-                entries = os.popen("cd %s && %s automate inventory" %
-                                   (self.root, self.CMD)).read().split("\n")[:-1]
+                entries = _vc.popen([self.CMD, "automate", "inventory"],
+                                    cwd=self.root).read().split("\n")[:-1]
                 break
             except OSError, e:
                 if e.errno != errno.EAGAIN:
diff --git a/vc/svn.py b/vc/svn.py
index f0ca21e..5091578 100644
--- a/vc/svn.py
+++ b/vc/svn.py
@@ -69,7 +69,7 @@ class Vc(_vc.Vc):
 
         while 1:
             try:
-                entries = os.popen("%s status -Nv %s" % (self.CMD, directory))
+                entries = _vc.popen([self.CMD, "status", "-Nv", directory])
                 break
             except OSError, e:
                 if e.errno != errno.EAGAIN:
diff --git a/vc/tla.py b/vc/tla.py
index 0a0b09d..f66fdac 100644
--- a/vc/tla.py
+++ b/vc/tla.py
@@ -96,10 +96,10 @@ class Vc(_vc.CachedVc):
 
     def _lookup_tree_cache(self, rootdir):
         whatsnew = {}
-        commandline = ('%s changes -d %s' % (self.CMD, self.root))
+        commandline = [self.CMD, "changes", "-d", self.root]
         while 1:
             try:
-                p = os.popen(commandline)
+                p = _vc.popen(commandline)
                 break
             except OSError, e:
                 if e.errno != errno.EAGAIN:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]