Skip to content

Commit

Permalink
Merge pull request #169 from iMichka/shutil
Browse files Browse the repository at this point in the history
Utils: drop _find_xml_generator_for_legacy_python
  • Loading branch information
iMichka authored Aug 21, 2023
2 parents 156941f + 82c0c17 commit 10dadd8
Showing 1 changed file with 1 addition and 24 deletions.
25 changes: 1 addition & 24 deletions src/pygccxml/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,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)
Expand Down

0 comments on commit 10dadd8

Please sign in to comment.