From: lihong <lihongx.ma@intel.com>
To: dts@dpdk.org
Cc: zhaoyan.chen@intel.com, lihong <lihongx.ma@intel.com>
Subject: [dts] [PATCH V1 3/7] framework/config: get configuration information from app_name.cfg
Date: Tue, 7 Jul 2020 10:44:59 +0800 [thread overview]
Message-ID: <1594089903-26285-4-git-send-email-lihongx.ma@intel.com> (raw)
In-Reply-To: <1594089903-26285-1-git-send-email-lihongx.ma@intel.com>
Signed-off-by: lihong <lihongx.ma@intel.com>
---
framework/config.py | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/framework/config.py b/framework/config.py
index 4dc3f31..dd3bf30 100644
--- a/framework/config.py
+++ b/framework/config.py
@@ -48,6 +48,7 @@ IXIACONF = "%s/ixia.cfg" % CONFIG_ROOT_PATH
PKTGENCONF = "%s/pktgen.cfg" % CONFIG_ROOT_PATH
SUITECONF_SAMPLE = "%s/suite_sample.cfg" % CONFIG_ROOT_PATH
GLOBALCONF = "%s/global_suite.cfg" % CONFIG_ROOT_PATH
+APPNAMECONF = "%s/app_name.cfg" % CONFIG_ROOT_PATH
class UserConf():
@@ -471,6 +472,34 @@ class PktgenConf(UserConf):
return self.pktgen_cfg
+class AppNameConf(UserConf):
+ def __init__(self, app_name_conf=APPNAMECONF):
+ self.config_file = app_name_conf
+ self.app_name_cfg = {}
+ try:
+ self.app_name_conf = UserConf(self.config_file)
+ except ConfigParseException:
+ self.app_name_conf = None
+ raise ConfigParseException
+
+ def load_app_name_conf(self):
+ sections = self.app_name_conf.get_sections()
+ if not sections:
+ return self.app_name_cfg
+
+ for build_type in sections:
+ cur_name_cfg = self.app_name_conf.load_section(build_type)
+ if not cur_name_cfg:
+ continue
+
+ name_cfg = {}
+ for cfg in cur_name_cfg:
+ key, value = cfg
+ name_cfg[key] = value
+
+ self.app_name_cfg[build_type.lower()]=name_cfg
+
+ return self.app_name_cfg
if __name__ == '__main__':
parser = argparse.ArgumentParser(
--
2.7.4
next prev parent reply other threads:[~2020-07-07 10:16 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-07 2:44 [dts] [PATCH V1 0/7] meson build reference lihong
2020-07-07 2:44 ` [dts] [PATCH V1 1/7] executions: add build_type field in all executions cfg lihong
2020-07-07 2:44 ` [dts] [PATCH V1 2/7] conf: add configuration file of app_name.cfg lihong
2020-07-07 2:44 ` lihong [this message]
2020-07-07 2:45 ` [dts] [PATCH V1 4/7] framework: read and save the build_type from execution.cfg lihong
2020-07-07 2:45 ` [dts] [PATCH V1 5/7] framework: add meson build method and get apps name of current build type lihong
2020-07-07 2:45 ` [dts] [PATCH V1 6/7] framework/pmd_output: replace the hard code app path with the configured app path lihong
2020-07-07 2:45 ` [dts] [PATCH V1 7/7] tests: " lihong
2020-07-07 10:20 ` [dts] [PATCH V1 0/7] meson build reference Xiao, QimaiX
2020-07-20 7:08 ` Tu, Lijuan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1594089903-26285-4-git-send-email-lihongx.ma@intel.com \
--to=lihongx.ma@intel.com \
--cc=dts@dpdk.org \
--cc=zhaoyan.chen@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).