From nobody Tue May 21 04:30:58 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+57160+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+57160+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1586471573; cv=none; d=zohomail.com; s=zohoarc; b=Qsqz5f4tiId57ZpBSKNRQ0TE4pN5nhyo9lADMd1cg674qfyC1a59SVEhO6ZUGEVpNrcZ7Pa/SguOBUb3PDpBXNyShFPFgMiUaDviZsLF0EaTS/zPY5L4f+YQXXazPmSnRi7w0K+kyhRGtEfa/i11Ao5DghHbM1torAA4ucqWQxA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586471573; h=Cc:Date:From:List-Id:List-Unsubscribe:Message-ID:Reply-To:Sender:Subject:To; bh=MNXG46qzJeI1eibOA/DpvOXBzKUG54i9ji/UgsDtB4I=; b=Cu3JZCNaBLQfGnlDPy9N+y+uZsylm2x6ky/zdco+Z6h3Dg8hEaXwxOYAcLeZ9yY/y6QBU9qFbeVHPsGUSp1sRE/rxDPMMg8j00jTcnf/k7IvliixbRf7l6j0UEAChZRvGIeZGldeqwYTM5Te8UlFh3792RFSAnFAEtuSez16fHY= 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+57160+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 1586471573683608.3947098807491; Thu, 9 Apr 2020 15:32:53 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id EgpRYY1788612xKvcJqdIRvj; Thu, 09 Apr 2020 15:32:53 -0700 X-Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web12.20756.1586471572484200166 for ; Thu, 09 Apr 2020 15:32:52 -0700 IronPort-SDR: LW+6oPy9zo0l6JTInZgj6Ub4C6LJZJDCqPXZ/WtG37YlpwcjYduxMRLxNjB1moSzcGC1yvY/xX 06sXj3Ha/p2g== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Apr 2020 15:32:52 -0700 IronPort-SDR: tltSLIzeVibkljTZp90mzYIGHeJxTjcsv4/WB1uzX3UF0GkjRt0fvyLpomflF5CuKRddk31nfC gCBHJK1BE6yw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,364,1580803200"; d="scan'208";a="398741825" X-Received: from aedesimo-desk.amr.corp.intel.com ([10.7.159.171]) by orsmga004.jf.intel.com with ESMTP; 09 Apr 2020 15:32:51 -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] EdkRepo: Config_factory string clean up Date: Thu, 9 Apr 2020 15:32:49 -0700 Message-Id: <20200409223249.29104-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: zaGtDj3659ScZKLOVHMRchS3x1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1586471573; bh=NfUe5R3NY05uqScw2Bxpt11axHQ3rZZLRzM4+jT47GU=; h=Cc:Date:From:Reply-To:Subject:To; b=O+SJx5Mx2kQN/pjF+y1iQmgWJG9P8dCp8gwpInuOTFH74Z0hWa4m6/KN7UqpIxJf2hU uq2/35c08yVhzsnkd+cRoHQdFrPUFxy4xxG7LVPMBRa8nUUrIqBcdIpkRU0PYyVZQctTL AgdLxELX5PilrJCc2f9RJiHEkvd7I0EGLRQ= 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 --- edkrepo/config/config_factory.py | 14 ++++++++------ edkrepo/config/config_humble.py | 14 ++++++++++++++ 2 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 edkrepo/config/config_humble.py diff --git a/edkrepo/config/config_factory.py b/edkrepo/config/config_facto= ry.py index b86e0b8..d9eec87 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.config_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/config_humble.py b/edkrepo/config/config_humble= .py new file mode 100644 index 0000000..3b8335f --- /dev/null +++ b/edkrepo/config/config_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 --=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 (#57160): https://edk2.groups.io/g/devel/message/57160 Mute This Topic: https://groups.io/mt/72908964/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-