Skip to content

Commit

Permalink
(conan-io#15308) libxml2: refactor access to option names
Browse files Browse the repository at this point in the history
* libxml2: refactor access to option names

* Fix rename

* fix missing refactored name
  • Loading branch information
jcar87 authored Jan 17, 2023
1 parent a12abe4 commit dafd46b
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions recipes/libxml2/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ class Libxml2Conan(ConanFile):
options = {name: [True, False] for name in default_options.keys()}

@property
def _option_names(self):
return [name for name in self.info.options.keys() if name not in ["shared", "fPIC", "include_utils"]]
def _configure_option_names(self):
return [name for name in self.default_options.keys() if (name in self.options)
and (name not in ["shared", "fPIC", "include_utils"])]

@property
def _settings_build(self):
Expand Down Expand Up @@ -139,7 +140,7 @@ def generate(self):
f"--enable-shared={yes_no(self.options.shared)}",
f"--enable-static={yes_no(not self.options.shared)}",
])
for option_name in self._option_names:
for option_name in self._configure_option_names:
option_value = getattr(self.options, option_name)
tc.configure_args.append(f"--with-{option_name}={yes_no(option_value)}")

Expand Down Expand Up @@ -171,7 +172,7 @@ def _build_msvc(self):
args.append(f"include=\"{';'.join(incdirs)}\"")
args.append(f"lib=\"{';'.join(libdirs)}\"")

for name in self._option_names:
for name in self._configure_option_names:
cname = {"mem-debug": "mem_debug",
"run-debug": "run_debug",
"docbook": "docb"}.get(name, name)
Expand Down Expand Up @@ -233,7 +234,7 @@ def _build_mingw(self):
args.append(f"include=\"{' -I'.join(incdirs)}\"")
args.append(f"lib=\"{' -L'.join(libdirs)}\"")

for name in self._option_names:
for name in self._configure_option_names:
cname = {
"mem-debug": "mem_debug",
"run-debug": "run_debug",
Expand Down

0 comments on commit dafd46b

Please sign in to comment.