Skip to content

Commit b67b261

Browse files
authored
Merge pull request #177 from CastXML/develop
Merge develop into master
2 parents ce011e1 + 6d4544c commit b67b261

14 files changed

+39
-250
lines changed

.github/workflows/tests.yml

+2-11
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
castxml-epic: 1
6565
cppstd: "-std=c++11"
6666

67-
- os: macos-latest
67+
- os: macos-12
6868
compiler: xcode
6969
version: "default"
7070
python-version: "3.8"
@@ -90,7 +90,7 @@ jobs:
9090
run: |
9191
wget -q -O - https://data.kitware.com/api/v1/file/hashsum/sha512/bdbb67a10c5f8d1b738cd19cb074f409d4803e8077cb8c1072ef4eaf738fa871a73643f9c8282d58cae28d188df842c82ad6620b6d590b0396a0172a27438dce/download | tar zxf - -C ~/
9292
- name: Setup castxml for Mac
93-
if: matrix.os == 'macos-latest'
93+
if: matrix.os == 'macos-12'
9494
run: |
9595
wget -q -O - https://data.kitware.com/api/v1/file/hashsum/sha512/5d937e938f7b882a3a3e7941e68f8312d0898aaf2082e00003dd362b1ba70b98b0a08706a1be28e71652a6a0f1e66f89768b5eaa20e5a100592d5b3deefec3f0/download | tar zxf - -C ~/
9696
- name: Setup castxml config
@@ -102,12 +102,3 @@ jobs:
102102
coverage run -m unittests.test_all
103103
coverage combine
104104
coverage xml
105-
- name: Upload coverage to Codecov
106-
uses: codecov/codecov-action@v3
107-
with:
108-
token: ${{ secrets.CODECOV_TOKEN }}
109-
file: coverage.xml
110-
flags: unittests
111-
env_vars: OS,PYTHON
112-
name: codecov-umbrella
113-
fail_ci_if_error: true

CHANGELOG.md

+10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
Changes
22
=======
33

4+
Version 2.5.0
5+
-------------
6+
7+
1. Add support for new cxx versions in cxx_standard class
8+
9+
2. Deprecate utils.is_str
10+
11+
3. pyproject.toml improvements
12+
13+
414
Version 2.4.0
515
-------------
616

pyproject.toml

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[build-system]
2-
requires = ["setuptools", "wheel"]
2+
requires = ["setuptools"]
3+
build-backend = "setuptools.build_meta"
34

45
[project]
56
name = "pygccxml"
@@ -17,7 +18,7 @@ keywords = [
1718
"CastXML",
1819
"gccxml",
1920
]
20-
version = "2.4.0"
21+
version = "2.5.0"
2122

2223
classifiers = [
2324
"Development Status :: 5 - Production/Stable",

src/pygccxml/declarations/container_traits.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ def remove_defaults(self, type_or_string):
522522
"""
523523

524524
name = type_or_string
525-
if not utils.is_str(type_or_string):
525+
if not isinstance(type_or_string, str):
526526
name = self.class_declaration(type_or_string).name
527527
if not self.remove_defaults_impl:
528528
return name
@@ -705,7 +705,7 @@ def find_container_traits(cls_or_string):
705705
declarations.container_traits: a container traits
706706
"""
707707

708-
if utils.is_str(cls_or_string):
708+
if isinstance(cls_or_string, str):
709709
if not templates.is_instantiation(cls_or_string):
710710
return None
711711
name = templates.name(cls_or_string)

src/pygccxml/declarations/type_traits.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ def is_std_string(type_):
507507
508508
"""
509509

510-
if utils.is_str(type_):
510+
if isinstance(type_, str):
511511
return type_ in string_equivalences
512512

513513
type_ = remove_alias(type_)
@@ -522,7 +522,7 @@ def is_std_wstring(type_):
522522
523523
"""
524524

525-
if utils.is_str(type_):
525+
if isinstance(type_, str):
526526
return type_ in wstring_equivalences
527527

528528
type_ = remove_alias(type_)
@@ -537,7 +537,7 @@ def is_std_ostream(type_):
537537
538538
"""
539539

540-
if utils.is_str(type_):
540+
if isinstance(type_, str):
541541
return type_ in ostream_equivalences
542542

543543
type_ = remove_alias(type_)
@@ -552,7 +552,7 @@ def is_std_wostream(type_):
552552
553553
"""
554554

555-
if utils.is_str(type_):
555+
if isinstance(type_, str):
556556
return type_ in wostream_equivalences
557557

558558
type_ = remove_alias(type_)

src/pygccxml/parser/config.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
from ConfigParser import SafeConfigParser as ConfigParser
2323
except ImportError:
2424
from configparser import ConfigParser
25-
from .. import utils
2625

2726

2827
class parser_configuration_t(object):
@@ -383,7 +382,7 @@ def load_xml_generator_configuration(configuration, **defaults):
383382
384383
"""
385384
parser = configuration
386-
if utils.is_str(configuration):
385+
if isinstance(configuration, str):
387386
parser = ConfigParser()
388387
parser.read(configuration)
389388

src/pygccxml/parser/linker.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
# See http://www.boost.org/LICENSE_1_0.txt
55

66
from pygccxml import declarations
7-
from .. import utils
87

98

109
class linker_t(
@@ -304,7 +303,7 @@ def visit_member_variable_type(self):
304303
self.__link_compound_type()
305304

306305
def visit_declarated(self):
307-
if utils.is_str(self.__inst.declaration):
306+
if isinstance(self.__inst.declaration, str):
308307
self.__inst.declaration = self.__decls[self.__inst.declaration]
309308

310309
def visit_restrict(self):

src/pygccxml/parser/project_reader.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def __init__(self, config, cache=None, decl_factory=None):
187187
self.__dcache = None
188188
if isinstance(cache, declarations_cache.cache_base_t):
189189
self.__dcache = cache
190-
elif utils.is_str(cache):
190+
elif isinstance(cache, str):
191191
self.__dcache = declarations_cache.file_cache_t(cache)
192192
else:
193193
self.__dcache = declarations_cache.dummy_cache_t()
@@ -221,7 +221,7 @@ def get_os_file_names(files):
221221

222222
fnames = []
223223
for f in files:
224-
if utils.is_str(f):
224+
if isinstance(f, str):
225225
fnames.append(f)
226226
elif isinstance(f, file_configuration_t):
227227
if f.content_type in (

src/pygccxml/parser/scanner.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ def startElement(self, name, attrs):
334334
self.__update_membership(attrs)
335335
self.__read_attributes(obj, attrs)
336336

337-
elif utils.is_str(obj):
337+
elif isinstance(obj, str):
338338

339339
self.__files[element_id] = os.path.normpath(obj)
340340

src/pygccxml/utils/utils.py

+12-26
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ def is_str(string):
2626
bool: True or False
2727
2828
"""
29+
warnings.warn(
30+
"The is_str function is deprecated. \
31+
Use isinstance(string, str) instead.",
32+
DeprecationWarning)
33+
2934
if sys.version_info[:2] >= (3, 0):
3035
return isinstance(string, str)
3136

@@ -50,35 +55,12 @@ def find_xml_generator(name="castxml", search_path=None):
5055
5156
"""
5257

53-
if sys.version_info[:2] >= (3, 3):
54-
path = _find_xml_generator_for_python_greater_equals_33(
55-
name, search_path=search_path)
56-
else:
57-
path = _find_xml_generator_for_legacy_python(name)
58-
58+
path = shutil.which(name, path=search_path)
5959
if path == "" or path is None:
6060
raise Exception("No c++ parser found. Please install castxml.")
6161
return path.rstrip(), name
6262

6363

64-
def _find_xml_generator_for_python_greater_equals_33(name, search_path=None):
65-
return shutil.which(name, path=search_path)
66-
67-
68-
def _find_xml_generator_for_legacy_python(name):
69-
if platform.system() == "Windows":
70-
command = "where"
71-
else:
72-
command = "which"
73-
p = subprocess.Popen([command, name], stdout=subprocess.PIPE,
74-
stderr=subprocess.PIPE)
75-
path = p.stdout.read().decode("utf-8")
76-
p.wait()
77-
p.stdout.close()
78-
p.stderr.close()
79-
return path.rstrip()
80-
81-
8264
def _create_logger_(name):
8365
"""Implementation detail, creates a logger."""
8466
logger = logging.getLogger(name)
@@ -295,8 +277,12 @@ class cxx_standard(object):
295277
'-std=c++17': 201703,
296278
'-std=gnu++1z': 201703,
297279
'-std=gnu++17': 201703,
298-
'-std=c++2a': float('inf'),
299-
'-std=gnu++2a': float('inf'),
280+
'-std=c++2a': 202002,
281+
'-std=gnu++2a': 202002,
282+
'-std=c++20': 202002,
283+
'-std=gnu++20': 202002,
284+
'-std=c++23': float('inf'),
285+
'-std=gnu++23': float('inf'),
300286
}
301287

302288
def __init__(self, cflags):

unittests/find_container_traits_tester.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
from pygccxml import parser
1111
from pygccxml import declarations
12-
from pygccxml import utils
1312

1413

1514
class Test(parser_test_case.parser_test_case_t):
@@ -30,7 +29,7 @@ def setUp(self):
3029
self.global_ns = Test.global_ns
3130

3231
def __cmp_traits(self, typedef, expected, partial_name, key_type=None):
33-
if utils.is_str(typedef):
32+
if isinstance(typedef, str):
3433
typedef = self.global_ns.typedef(typedef)
3534
traits = declarations.find_container_traits(typedef)
3635
self.assertTrue(

unittests/misc/profile_parser.py

-21
This file was deleted.

0 commit comments

Comments
 (0)