Skip to content

Commit

Permalink
Fix pip install with --config-settings
Browse files Browse the repository at this point in the history
  • Loading branch information
hcho3 committed May 2, 2023
1 parent 128c914 commit 675d407
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions python/packager/build_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,18 @@ class BuildConfiguration: # pylint: disable=R0902
# Whether to use the TL2cgen library that's installed in the system prefix
use_system_libtl2cgen: bool = False

def _set_config_setting(
self, config_settings: Dict[str, Any], field_name: str
) -> None:
if field_name in config_settings:
def _set_config_setting(self, config_settings: Dict[str, Any]) -> None:
for field_name in config_settings:
setattr(
self,
field_name,
(config_settings[field_name].lower() in ["true", "1", "on"]),
)
else:
raise ValueError(f"Field {field_name} is not a valid config_settings")

def update(self, config_settings: Optional[Dict[str, Any]]) -> None:
"""Parse config_settings from Pip (or other PEP 517 frontend)"""
if config_settings is not None:
for field_name in [x.name for x in dataclasses.fields(self)]:
self._set_config_setting(config_settings, field_name)
self._set_config_setting(config_settings)

def get_cmake_args(self) -> List[str]:
"""Convert build configuration to CMake args"""
Expand Down

0 comments on commit 675d407

Please sign in to comment.