Conan: Fix how conans.model.options.PackageOption value is evaluated

The default value None returned by tools.get_safe is not the Python's
built-in None value. The value returned by tools.get_safe() is wrapped
into conans.model.options.PackageOption and to check against 'None'
it needs to follow pattern:

  if not <value>:

Pick-to: 6.3
Change-Id: Idacfdde92958a46d399246239d12cd887916c4f1
Reviewed-by: Toni Saario <toni.saario@qt.io>
This commit is contained in:
Iikka Eklund 2022-05-25 13:16:02 +03:00
parent 42fe677584
commit a536734b9c

View File

@ -132,7 +132,7 @@ class QtBase(ConanFile):
# When cross-building the user needs to pass 'qt_host_path' which is transformed to
# QT_HOST_PATH later on. Resolve the exact path.
qt_host_path = self.options.get_safe("qt_host_path")
if qt_host_path is None:
if not qt_host_path:
raise QtConanError("Expected 'qt_host_path' option in cross-build context")
return str(Path(os.path.expandvars(str(qt_host_path))).expanduser().resolve(strict=True))