From nobody Fri May 17 17:28:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+57227+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+57227+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1586546792; cv=none; d=zohomail.com; s=zohoarc; b=RTI73Q99UmVvqjJqDDRVbtJoBuQ7BfADNxNgjGR3hgUfbHiWiHdBarWo+ScP1leq2+NXntBKbcPiuRTpBBZxqffPWHvdXpl2M9nWdp7a7wOe8LPEwtflrfeh0ZP06Sca1mig/X6V+5wkGol09PaptjnBaQfVyJonbfEzu/ylRuk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586546792; h=Cc:Date:From:List-Id:List-Unsubscribe:Message-ID:Reply-To:Sender:Subject:To; bh=brR2vS512Mqs1yFEQWXnRKqczEfdVNnatW8fUDPSk3k=; b=Wzgaf8WBogSft2mpuT8mH5PjwU56zNxjxvGOehlKDaq90B1cXkm+aIdu3EQ+5hqbhpa750cXANM/9wPyTWnVjb4uEMlqAXN5aoaUpLF6e/4tWV2xHEoi8z8XPt51JnAWLcQGJza0b2FfQs79qeldHCmKuPoPzY6Mzp9KsL+U1ZQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+57227+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1586546792974567.7474790675955; Fri, 10 Apr 2020 12:26:32 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id fssvYY1788612xECJkwti9RQ; Fri, 10 Apr 2020 12:26:32 -0700 X-Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web12.4174.1586546792092138636 for ; Fri, 10 Apr 2020 12:26:32 -0700 IronPort-SDR: cw+M7N46W9EvH/5AUU8g0Zta4CVZ3SMxFmCttEqjqhXSrUeQVKTVPBHBohHs4PQjDTMCLnI9vm pviRW8p1MgRw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Apr 2020 12:26:31 -0700 IronPort-SDR: rQmIHCJ9ut+IPLMlKoNL/RnjiKqVnWOccwLH4PTNzgAXSFU6ARqz/YmkJelZ3UKEuh8mMqui6p HIwp4m6Z9ibQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,367,1580803200"; d="scan'208";a="331258536" X-Received: from aedesimo-desk.amr.corp.intel.com ([10.7.159.171]) by orsmga001.jf.intel.com with ESMTP; 10 Apr 2020 12:26:31 -0700 From: "Ashley E Desimone" To: devel@edk2.groups.io Cc: Nate DeSimone , Puja Pandya , Erik Bjorge , Bret Barkelew , Prince Agyeman Subject: [edk2-devel] [edk2-staging/EdkRepo] [PATCH v2] EdkRepo: Config_factory string clean up Date: Fri, 10 Apr 2020 12:26:09 -0700 Message-Id: <20200410192609.23656-1-ashley.e.desimone@intel.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ashley.e.desimone@intel.com X-Gm-Message-State: 0bTGHxo61c7BDycJdB3RFVBlx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1586546792; bh=F0PM4kff7b/81U7BvlZEWaAe8TpaNGN/OuwKqNqvvm8=; h=Cc:Date:From:Reply-To:Subject:To; b=JgUf513Q+egpdNX+JJdam2ZHHKmiHspY0UpM4/qSlGRbYVr0D5zvovIIpF1SfvkV7OL C18s7em0Zv6MUr2xjV0Ue+OVNOxi2Od7qEAmGngCEdcL0iLhUoP43z7y4LAvBUyZwevPy TAd8ZwKtgGfD4kNKTzPoujyZq4rnuEKAkKA= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Define and store config_config factory informational and error strings in config/config_humble.py Signed-off-by: Ashley E Desimone Cc: Nate DeSimone Cc: Puja Pandya Cc: Erik Bjorge Cc: Bret Barkelew Cc: Prince Agyeman Reviewed-by: Nate DeSimone --- edkrepo/config/config_factory.py | 14 ++++++++------ edkrepo/config/humble/config_factory_humble.py | 14 ++++++++++++++ setup.py | 4 ++-- 3 files changed, 24 insertions(+), 8 deletions(-) create mode 100644 edkrepo/config/humble/config_factory_humble.py diff --git a/edkrepo/config/config_factory.py b/edkrepo/config/config_facto= ry.py index b86e0b8..c342838 100644 --- a/edkrepo/config/config_factory.py +++ b/edkrepo/config/config_factory.py @@ -11,12 +11,14 @@ import os import sys import configparser import collections +from ctypes import * + +import edkrepo.config.humble.config_factory_humble as humble from edkrepo.common.edkrepo_exception import EdkrepoGlobalConfigNotFoundEx= ception, EdkrepoConfigFileInvalidException from edkrepo.common.edkrepo_exception import EdkrepoWorkspaceInvalidExcept= ion, EdkrepoGlobalDataDirectoryNotFoundException from edkrepo.common.edkrepo_exception import EdkrepoConfigFileReadOnlyExce= ption from edkrepo.common.humble import MIRROR_PRIMARY_REPOS_MISSING, MIRROR_DEC= ODE_WARNING, MAX_PATCH_SET_INVALID from edkrepo_manifest_parser import edk_manifest -from ctypes import * =20 def get_edkrepo_global_data_directory(): global_data_dir =3D None @@ -34,7 +36,7 @@ def get_edkrepo_global_data_directory(): global_data_dir =3D os.path.expanduser("~/.edkrepo") if not os.path.isdir(global_data_dir): if not os.path.exists(os.path.dirname(global_data_dir)): - raise EdkrepoGlobalDataDirectoryNotFoundException("{} does not= exist".format(os.path.dirname(global_data_dir))) + raise EdkrepoGlobalDataDirectoryNotFoundException(humble.GLOBA= L_DATA_DIR_NOT_FOUND.format(os.path.dirname(global_data_dir))) os.mkdir(global_data_dir) return global_data_dir =20 @@ -63,7 +65,7 @@ def cfg_property(filename, cfg, read_only, section, key): return cfg[section][key] def _set(self, value): if read_only: - raise EdkrepoConfigFileReadOnlyException('The configuration fi= le is read only: {}'.format(filename)) + raise EdkrepoConfigFileReadOnlyException(humble.READ_ONLY_CFG.= format(filename)) cfg[section][key] =3D value with open(filename, 'w') as cfg_stream: cfg.write(cfg_stream) @@ -90,7 +92,7 @@ class BaseConfig(): if prop.section not in self.cfg or prop.key not in self.cfg[pr= op.section]: if prop.required or self.read_only: # Required property is missing - raise EdkrepoConfigFileInvalidException('{} is not pre= sent in {} section of {}'.format(prop.key, prop.section, os.path.basename(s= elf.filename))) + raise EdkrepoConfigFileInvalidException(humble.REQ_PRO= P_MISSING.format(prop.key, prop.section, os.path.basename(self.filename))) if not self.read_only: # Create the missing property if prop.section not in self.cfg: @@ -126,7 +128,7 @@ class GlobalConfig(BaseConfig): CfgProp('preferred-command-package', 'preferred-package', = 'pref_pkg', None, True), CfgProp('preferred-entry-point', 'entry-point', 'pref_entr= y_point', None, True)] if not os.path.isfile(self.filename): - raise EdkrepoGlobalConfigNotFoundException("edkrepo global con= fig file {} does not exist".format(self.filename)) + raise EdkrepoGlobalConfigNotFoundException(humble.GLOBAL_CFG_N= OT_FOUND.format(self.filename)) super().__init__(self.filename, True) =20 @property @@ -189,7 +191,7 @@ def get_workspace_path(): if os.path.dirname(path) =3D=3D path: break path =3D os.path.dirname(path) - raise EdkrepoWorkspaceInvalidException("The current directory does not= appear to be a valid workspace") + raise EdkrepoWorkspaceInvalidException(humble.INVALID_WKSPC) =20 def get_workspace_manifest_file(): path =3D get_workspace_path() diff --git a/edkrepo/config/humble/config_factory_humble.py b/edkrepo/confi= g/humble/config_factory_humble.py new file mode 100644 index 0000000..3b8335f --- /dev/null +++ b/edkrepo/config/humble/config_factory_humble.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 +# +## @file +# config_humble.py +# +# Copyright (c) 2020, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +# + +GLOBAL_DATA_DIR_NOT_FOUND =3D '{} does not exist.' +READ_ONLY_CFG =3D 'The configuration file is read only: {}' +REQ_PROP_MISSING =3D '{} is not present in {} section of {}' +GLOBAL_CFG_NOT_FOUND =3D 'The edkrepo global configuration file {} was not= found.' +INVALID_WKSPC =3D 'The current directory does not appear to be a valid wor= kspace.' \ No newline at end of file diff --git a/setup.py b/setup.py index e7e6ce8..2d14334 100755 --- a/setup.py +++ b/setup.py @@ -12,8 +12,8 @@ setup(name=3D'edkrepo', version=3D'2.0.0', description=3D'The edkrepo tools', packages=3D['edkrepo', 'edkrepo.commands', 'edkrepo.commands.argumen= ts', 'edkrepo.commands.humble', - 'edkrepo.git_automation', 'edkrepo.common', 'edkrepo.confi= g', 'edkrepo_manifest_parser', - 'project_utils'], + 'edkrepo.git_automation', 'edkrepo.common', 'edkrepo.confi= g', 'edkrepo.config.humble', + 'edkrepo_manifest_parser', 'project_utils'], package_data=3D{ }, include_package_data=3DTrue, --=20 2.16.2.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#57227): https://edk2.groups.io/g/devel/message/57227 Mute This Topic: https://groups.io/mt/72929409/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-