aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Dolbec <dolsen@gentoo.org>2017-07-15 00:09:11 +0000
committerZac Medico <zmedico@gentoo.org>2018-03-29 20:51:16 -0700
commitab929338def0856537d601c6ba2cbfc88cd0def8 (patch)
treef839040a7bb7779d99b571cd264ead27f7bffca1
parentrepoman: Add a new config.py file with config loading utilities (diff)
downloadportage-ab929338def0856537d601c6ba2cbfc88cd0def8.tar.gz
portage-ab929338def0856537d601c6ba2cbfc88cd0def8.tar.bz2
portage-ab929338def0856537d601c6ba2cbfc88cd0def8.zip
repoman: Update qa_data.py to use the new load_config() utility
-rw-r--r--repoman/pym/repoman/qa_data.py21
1 files changed, 3 insertions, 18 deletions
diff --git a/repoman/pym/repoman/qa_data.py b/repoman/pym/repoman/qa_data.py
index 2ccea1996..fba0c2d64 100644
--- a/repoman/pym/repoman/qa_data.py
+++ b/repoman/pym/repoman/qa_data.py
@@ -2,12 +2,12 @@
import logging
import os
-import yaml
from _emerge.Package import Package
# import our initialized portage instance
from repoman._portage import portage
+from repoman.config import load_config
class QAData(object):
@@ -35,22 +35,7 @@ class QAData(object):
This could be a parent repository using the
repoman_masters layout.conf variable
'''
- qadata = {}
- for path in repopaths:
- filepath = os.path.join(path, 'qa_data.yaml')
- logging.debug("QAData: reading file: %s", filepath)
- try:
- with open(filepath, 'r') as qadata_file:
- new_qadata = yaml.safe_load(qadata_file.read())
- logging.debug("QAData: updating qadata with new values from: %s", filepath)
- qadata.update(new_qadata)
- except FileNotFoundError:
- # skip a master that may not have our file
- logging.debug("QAData: File not found at path: %s", filepath)
- except IOError as error:
- logging.error("QAData: Failed to load 'qa_data.yaml' file at path: %s", filepath)
- logging.exception(error)
- return False
+ qadata = load_config([os.path.join(path,'qa_data.yaml') for path in repopaths], 'yaml')
if qadata == {}:
logging.error("QAData: Failed to load a valid 'qa_data.yaml' file at paths: %s", repopaths)
return False
@@ -93,7 +78,7 @@ class QAData(object):
# file.executable
self.no_exec = frozenset(qadata.get("no_exec_files", []))
- logging.debug("QAData: completed loading file: %s", filepath)
+ logging.debug("QAData: completed loading file: %s", repopaths)
return True