jhbuild r2134 - in trunk: . jhbuild jhbuild/utils
- From: fpeters svn gnome org
- To: svn-commits-list gnome org
- Subject: jhbuild r2134 - in trunk: . jhbuild jhbuild/utils
- Date: Sun, 15 Jun 2008 16:36:25 +0000 (UTC)
Author: fpeters
Date: Sun Jun 15 16:36:24 2008
New Revision: 2134
URL: http://svn.gnome.org/viewvc/jhbuild?rev=2134&view=rev
Log:
* jhbuild/config.py, jhbuild/utils/cmds.py: adds a get_stderr parameter
to get_output, so it is possible to disable getting stderr output. Use
this parameter when getting the Python version number, used to set
PYTHONPATH. (closes again: #136983)
Modified:
trunk/ChangeLog
trunk/jhbuild/config.py
trunk/jhbuild/utils/cmds.py
Modified: trunk/jhbuild/config.py
==============================================================================
--- trunk/jhbuild/config.py (original)
+++ trunk/jhbuild/config.py Sun Jun 15 16:36:24 2008
@@ -202,7 +202,8 @@
python_bin = os.environ.get('PYTHON', 'python')
try:
pythonversion = 'python' + get_output([python_bin, '-c',
- 'import sys; print ".".join([str(x) for x in sys.version_info[:2]])']).strip()
+ 'import sys; print ".".join([str(x) for x in sys.version_info[:2]])'],
+ get_stderr = False).strip()
except CommandError:
pythonversion = 'python' + str(sys.version_info[0]) + '.' + str(sys.version_info[1])
Modified: trunk/jhbuild/utils/cmds.py
==============================================================================
--- trunk/jhbuild/utils/cmds.py (original)
+++ trunk/jhbuild/utils/cmds.py Sun Jun 15 16:36:24 2008
@@ -23,11 +23,13 @@
from signal import SIGINT
from jhbuild.errors import CommandError
-def get_output(cmd, cwd=None, extra_env=None):
+def get_output(cmd, cwd=None, extra_env=None, get_stderr = True):
'''Return the output (stdout and stderr) from the command.
If the extra_env dictionary is not empty, then it is used to
update the environment in the child process.
+
+ If the get_stderr parameter is set to False, then stderr output is ignored.
Raises CommandError if the command exited abnormally or had a non-zero
error code.
@@ -40,12 +42,17 @@
if extra_env is not None:
kws['env'] = os.environ.copy()
kws['env'].update(extra_env)
+
+ if get_stderr:
+ stderr_output = subprocess.STDOUT
+ else:
+ stderr_output = subprocess.PIPE
try:
p = subprocess.Popen(cmd,
close_fds=True,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT,
+ stderr=stderr_output,
**kws)
except OSError, e:
raise CommandError(str(e))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]