From e8334e040ab9f418595272d0a26067b4ba0a15af Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Thu, 22 Aug 2013 20:14:11 +0000 Subject: [PATCH] Use subprocess instead of os.popen3 to avoid deprecation warnings. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1404 5089003a-bbd8-11dd-ad1f-f1f9622dbc98 --- tools/automate/automate.py | 7 ++++--- tools/svn_util.py | 8 +++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/tools/automate/automate.py b/tools/automate/automate.py index 75df62b5c..992e07962 100644 --- a/tools/automate/automate.py +++ b/tools/automate/automate.py @@ -48,10 +48,11 @@ def get_svn_info(path): rev = 'None' if path[0:4] == 'http' or os.path.exists(path): try: - (stream_in, stream_out, stream_err) = os.popen3(svn_exe+' info --xml '+path) - err = stream_err.read() + p = subprocess.Popen([svn_exe, 'info', '--xml', path], \ + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + out, err = p.communicate() if err == '': - tree = ET.ElementTree(ET.fromstring(stream_out.read())) + tree = ET.ElementTree(ET.fromstring(out)) entry = tree.getroot().find('entry') url = entry.find('url').text rev = entry.attrib['revision'] diff --git a/tools/svn_util.py b/tools/svn_util.py index e98dce2f0..9841112ef 100644 --- a/tools/svn_util.py +++ b/tools/svn_util.py @@ -4,6 +4,7 @@ import os import sys +import subprocess import urllib import xml.etree.ElementTree as ET @@ -28,10 +29,11 @@ def get_svn_info(path): svn = 'svn.bat' else: svn = 'svn' - (stream_in, stream_out, stream_err) = os.popen3(svn+' info --xml '+path) - err = stream_err.read() + p = subprocess.Popen([svn, 'info', '--xml', path], \ + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + out, err = p.communicate() if err == '': - tree = ET.ElementTree(ET.fromstring(stream_out.read())) + tree = ET.ElementTree(ET.fromstring(out)) entry = tree.getroot().find('entry') url = entry.find('url').text rev = entry.attrib['revision']