Skip to content

Commit

Permalink
Merge pull request #218 from CastXML/macos-2
Browse files Browse the repository at this point in the history
tests: fix macos test
  • Loading branch information
iMichka authored Dec 14, 2024
2 parents 682dc7e + da9b147 commit cdee0dc
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 22 deletions.
3 changes: 0 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,3 @@ docs = [
examples = [
"notebook",
]
[tool.pytest.ini_options]
pythonpath = [
"src"]
21 changes: 12 additions & 9 deletions src/pygccxml/declarations/container_traits.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@

std_namespaces = ('std', 'stdext', '__gnu_cxx')

# Take into account different equivalences (with or without spaces)
string_equivalences = type_traits.string_equivalences + \
type_traits.normalized_string_equivalences
string_equivalences = [
v for v in string_equivalences if not v == "std::string"]
wstring_equivalences = type_traits.wstring_equivalences + \
type_traits.normalized_wstring_equivalences
wstring_equivalences = [
v for v in wstring_equivalences if not v == "std::wstring"]


class defaults_eraser(object):

Expand All @@ -29,16 +39,9 @@ def normalize(self, type_str):
return type_str.replace(' ', '')

def replace_basic_string(self, cls_name):
# Replace all the variations of strings by the smallest one.
strings = {
"std::string":
[v for v in
type_traits.normalized_string_equivalences
if not v == "std::string"],
"std::wstring":
[v for v in
type_traits.normalized_wstring_equivalences
if not v == "std::wstring"]
"std::string": string_equivalences,
"std::wstring": wstring_equivalences
}

new_name = cls_name
Expand Down
24 changes: 14 additions & 10 deletions src/pygccxml/declarations/type_traits.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,29 +490,33 @@ def _normalize_equivalences(equivalences):

string_equivalences = [
(
'::std::basic_string<char, std::char_traits<char>, '
'std::basic_string<char, std::char_traits<char>, '
'std::allocator<char>>'
),
'::std::basic_string<char>',
'::std::string'
'std::basic_string<char>',
'std::string'
]

wstring_equivalences = [
(
'::std::basic_string<wchar_t, std::char_traits<wchar_t>, '
'std::basic_string<wchar_t, std::char_traits<wchar_t>, '
'std::allocator<wchar_t>>'
),
'::std::basic_string<wchar_t>',
'::std::wstring'
'std::basic_string<wchar_t>',
'std::wstring'
]

ostream_equivalences = [
'::std::basic_ostream<char, std::char_traits<char>>',
'::std::basic_ostream<char>', '::std::ostream']
'std::basic_ostream<char, std::char_traits<char>>',
'std::basic_ostream<char>',
'std::ostream'
]

wostream_equivalences = [
'::std::basic_ostream<wchar_t, std::char_traits<wchar_t>>',
'::std::basic_ostream<wchar_t>', '::std::wostream']
'std::basic_ostream<wchar_t, std::char_traits<wchar_t>>',
'std::basic_ostream<wchar_t>',
'std::wostream'
]


normalized_string_equivalences = _normalize_equivalences(
Expand Down

0 comments on commit cdee0dc

Please sign in to comment.