mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-09-29 13:31:43 -09:00
support/scripts/graph-depends: use the standard python logging module
Instead of hardcoded sys.stderr.write() calls. No functional change, but allows us to easily implement a quiet option. Signed-off-by: Peter Korsgaard <peter@korsgaard.com> Reviewed-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
# Copyright (C) 2010-2013 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
||||
|
||||
import logging
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
@@ -7,18 +8,18 @@ import subprocess
|
||||
# Execute the "make <pkg>-show-version" command to get the version of a given
|
||||
# list of packages, and return the version formatted as a Python dictionary.
|
||||
def get_version(pkgs):
|
||||
sys.stderr.write("Getting version for %s\n" % pkgs)
|
||||
logging.info("Getting version for %s" % pkgs)
|
||||
cmd = ["make", "-s", "--no-print-directory"]
|
||||
for pkg in pkgs:
|
||||
cmd.append("%s-show-version" % pkg)
|
||||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, universal_newlines=True)
|
||||
output = p.communicate()[0]
|
||||
if p.returncode != 0:
|
||||
sys.stderr.write("Error getting version %s\n" % pkgs)
|
||||
logging.error("Error getting version %s" % pkgs)
|
||||
sys.exit(1)
|
||||
output = output.split("\n")
|
||||
if len(output) != len(pkgs) + 1:
|
||||
sys.stderr.write("Error getting version\n")
|
||||
logging.error("Error getting version")
|
||||
sys.exit(1)
|
||||
version = {}
|
||||
for i in range(0, len(pkgs)):
|
||||
@@ -28,18 +29,18 @@ def get_version(pkgs):
|
||||
|
||||
|
||||
def _get_depends(pkgs, rule):
|
||||
sys.stderr.write("Getting dependencies for %s\n" % pkgs)
|
||||
logging.info("Getting dependencies for %s" % pkgs)
|
||||
cmd = ["make", "-s", "--no-print-directory"]
|
||||
for pkg in pkgs:
|
||||
cmd.append("%s-%s" % (pkg, rule))
|
||||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, universal_newlines=True)
|
||||
output = p.communicate()[0]
|
||||
if p.returncode != 0:
|
||||
sys.stderr.write("Error getting dependencies %s\n" % pkgs)
|
||||
logging.error("Error getting dependencies %s\n" % pkgs)
|
||||
sys.exit(1)
|
||||
output = output.split("\n")
|
||||
if len(output) != len(pkgs) + 1:
|
||||
sys.stderr.write("Error getting dependencies\n")
|
||||
logging.error("Error getting dependencies")
|
||||
sys.exit(1)
|
||||
deps = {}
|
||||
for i in range(0, len(pkgs)):
|
||||
|
||||
Reference in New Issue
Block a user