From b39a0bbb81bf02fc6541131b331f36254b3971d4 Mon Sep 17 00:00:00 2001 From: pygccxml Upstream Date: Mon, 21 Aug 2023 22:57:55 +0200 Subject: [PATCH 1/2] ENH: pygccxml v2.5.0 (reduced) This corresponds to commit hash 3a656b8e81cc56e85d6a6fe7659ab18bd22da0a8 from upstream repository https://github.com/CastXML/pygccxml --- declarations/container_traits.py | 4 ++-- declarations/type_traits.py | 8 +++---- parser/config.py | 3 +-- parser/linker.py | 3 +-- parser/project_reader.py | 4 ++-- parser/scanner.py | 2 +- utils/utils.py | 38 ++++++++++---------------------- 7 files changed, 23 insertions(+), 39 deletions(-) diff --git a/declarations/container_traits.py b/declarations/container_traits.py index 92ad175bb59..d4f6658edda 100644 --- a/declarations/container_traits.py +++ b/declarations/container_traits.py @@ -522,7 +522,7 @@ def remove_defaults(self, type_or_string): """ name = type_or_string - if not utils.is_str(type_or_string): + if not isinstance(type_or_string, str): name = self.class_declaration(type_or_string).name if not self.remove_defaults_impl: return name @@ -705,7 +705,7 @@ def find_container_traits(cls_or_string): declarations.container_traits: a container traits """ - if utils.is_str(cls_or_string): + if isinstance(cls_or_string, str): if not templates.is_instantiation(cls_or_string): return None name = templates.name(cls_or_string) diff --git a/declarations/type_traits.py b/declarations/type_traits.py index eef8fe7a077..bc9be8dea0d 100644 --- a/declarations/type_traits.py +++ b/declarations/type_traits.py @@ -507,7 +507,7 @@ def is_std_string(type_): """ - if utils.is_str(type_): + if isinstance(type_, str): return type_ in string_equivalences type_ = remove_alias(type_) @@ -522,7 +522,7 @@ def is_std_wstring(type_): """ - if utils.is_str(type_): + if isinstance(type_, str): return type_ in wstring_equivalences type_ = remove_alias(type_) @@ -537,7 +537,7 @@ def is_std_ostream(type_): """ - if utils.is_str(type_): + if isinstance(type_, str): return type_ in ostream_equivalences type_ = remove_alias(type_) @@ -552,7 +552,7 @@ def is_std_wostream(type_): """ - if utils.is_str(type_): + if isinstance(type_, str): return type_ in wostream_equivalences type_ = remove_alias(type_) diff --git a/parser/config.py b/parser/config.py index e2b9eea4fd0..e2db56d84d9 100644 --- a/parser/config.py +++ b/parser/config.py @@ -22,7 +22,6 @@ from ConfigParser import SafeConfigParser as ConfigParser except ImportError: from configparser import ConfigParser -from .. import utils class parser_configuration_t(object): @@ -383,7 +382,7 @@ def load_xml_generator_configuration(configuration, **defaults): """ parser = configuration - if utils.is_str(configuration): + if isinstance(configuration, str): parser = ConfigParser() parser.read(configuration) diff --git a/parser/linker.py b/parser/linker.py index b7aeda3b22d..1677e27f0bc 100644 --- a/parser/linker.py +++ b/parser/linker.py @@ -4,7 +4,6 @@ # See http://www.boost.org/LICENSE_1_0.txt from pygccxml import declarations -from .. import utils class linker_t( @@ -304,7 +303,7 @@ def visit_member_variable_type(self): self.__link_compound_type() def visit_declarated(self): - if utils.is_str(self.__inst.declaration): + if isinstance(self.__inst.declaration, str): self.__inst.declaration = self.__decls[self.__inst.declaration] def visit_restrict(self): diff --git a/parser/project_reader.py b/parser/project_reader.py index a628790725e..d7bf7c994f2 100644 --- a/parser/project_reader.py +++ b/parser/project_reader.py @@ -187,7 +187,7 @@ def __init__(self, config, cache=None, decl_factory=None): self.__dcache = None if isinstance(cache, declarations_cache.cache_base_t): self.__dcache = cache - elif utils.is_str(cache): + elif isinstance(cache, str): self.__dcache = declarations_cache.file_cache_t(cache) else: self.__dcache = declarations_cache.dummy_cache_t() @@ -221,7 +221,7 @@ def get_os_file_names(files): fnames = [] for f in files: - if utils.is_str(f): + if isinstance(f, str): fnames.append(f) elif isinstance(f, file_configuration_t): if f.content_type in ( diff --git a/parser/scanner.py b/parser/scanner.py index 4368a84ae6d..63f9cbd729f 100644 --- a/parser/scanner.py +++ b/parser/scanner.py @@ -334,7 +334,7 @@ def startElement(self, name, attrs): self.__update_membership(attrs) self.__read_attributes(obj, attrs) - elif utils.is_str(obj): + elif isinstance(obj, str): self.__files[element_id] = os.path.normpath(obj) diff --git a/utils/utils.py b/utils/utils.py index 21bb5d3c3ca..7a9deb5ae1d 100644 --- a/utils/utils.py +++ b/utils/utils.py @@ -26,6 +26,11 @@ def is_str(string): bool: True or False """ + warnings.warn( + "The is_str function is deprecated. \ + Use isinstance(string, str) instead.", + DeprecationWarning) + if sys.version_info[:2] >= (3, 0): return isinstance(string, str) @@ -50,35 +55,12 @@ def find_xml_generator(name="castxml", search_path=None): """ - if sys.version_info[:2] >= (3, 3): - path = _find_xml_generator_for_python_greater_equals_33( - name, search_path=search_path) - else: - path = _find_xml_generator_for_legacy_python(name) - + path = shutil.which(name, path=search_path) if path == "" or path is None: raise Exception("No c++ parser found. Please install castxml.") return path.rstrip(), name -def _find_xml_generator_for_python_greater_equals_33(name, search_path=None): - return shutil.which(name, path=search_path) - - -def _find_xml_generator_for_legacy_python(name): - if platform.system() == "Windows": - command = "where" - else: - command = "which" - p = subprocess.Popen([command, name], stdout=subprocess.PIPE, - stderr=subprocess.PIPE) - path = p.stdout.read().decode("utf-8") - p.wait() - p.stdout.close() - p.stderr.close() - return path.rstrip() - - def _create_logger_(name): """Implementation detail, creates a logger.""" logger = logging.getLogger(name) @@ -295,8 +277,12 @@ class cxx_standard(object): '-std=c++17': 201703, '-std=gnu++1z': 201703, '-std=gnu++17': 201703, - '-std=c++2a': float('inf'), - '-std=gnu++2a': float('inf'), + '-std=c++2a': 202002, + '-std=gnu++2a': 202002, + '-std=c++20': 202002, + '-std=gnu++20': 202002, + '-std=c++23': float('inf'), + '-std=gnu++23': float('inf'), } def __init__(self, cflags): From a7e6b3ce324938fdfd5cf529bc004902577171e3 Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Tue, 9 Apr 2024 17:01:23 -0400 Subject: [PATCH 2/2] ENH: Update pygccxml-upstream branch version Part of the subtree update process. --- Modules/ThirdParty/pygccxml/src/UpdatepygccxmlFromUpstream.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/ThirdParty/pygccxml/src/UpdatepygccxmlFromUpstream.sh b/Modules/ThirdParty/pygccxml/src/UpdatepygccxmlFromUpstream.sh index c3388a13c4e..7a60fa4c82f 100755 --- a/Modules/ThirdParty/pygccxml/src/UpdatepygccxmlFromUpstream.sh +++ b/Modules/ThirdParty/pygccxml/src/UpdatepygccxmlFromUpstream.sh @@ -28,8 +28,8 @@ upstream_sha="ce011e1bc57248d205cfda60dd51b3182acbe106" # EDIT THIS SCRIPT to change the hash tag at which to begin the # next update... # -# This merge was done on: August 23rd, 2023 -git branch pygccxml-upstream 6637e8709b7779d19cd6089d3c25b193fd794b7c +# This merge was done on: April 9th, 2024 +git branch pygccxml-upstream b39a0bbb81bf02fc6541131b331f36254b3971d4 # # Make a temp directory to handle the import of the upstream source