Skip to content

Utils: drop _find_xml_generator_for_legacy_python #169

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 1 addition & 24 deletions src/pygccxml/utils/utils.py
Original file line number Diff line number Diff line change
@@ -50,35 +50,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)