Beispiel #1
0
 def __init__(self, shared=None, options=None, options_values=None):
     options = options or ""
     self.command = None
     self.path = None
     self.source_folder = self.build_folder = "."
     self.settings = None
     self.options = Options(PackageOptions.loads(options))
     if options_values:
         for var, value in options_values.items():
             self.options._data[var] = value
     self.deps_cpp_info = MockDepsCppInfo(
     )  # ("deps_cpp_info", "sysroot")("/path/to/sysroot")
     self.deps_cpp_info.sysroot = "/path/to/sysroot"
     self.output = TestBufferConanOutput()
     self.in_local_cache = False
     self.install_folder = "myinstallfolder"
     if shared is not None:
         self.options = namedtuple("options", "shared")(shared)
     self.should_configure = True
     self.should_build = True
     self.should_install = True
     self.should_test = True
     self.generators = []
     self.captured_env = {}
     self.deps_env_info = DepsEnvInfo()
     self.env_info = EnvInfo()
     self.deps_user_info = DepsUserInfo()
     self._conan_env_values = EnvValues()
Beispiel #2
0
    def convert_conan_options_to_qt_options(
            self, conan_options: Options) -> List[str]:
        qt_options: List[str] = []

        def _option_enabled(options: Dict[str, Any], opt: str) -> bool:
            return opt in options and options[opt] == "yes"

        def _option_disabled(options: Dict[str, Any], opt: str) -> bool:
            return opt in options and options[opt] == "no"

        def _filter_overlapping_options(options: Dict[str, Any]) -> None:
            if _option_enabled(options, "shared") or _option_disabled(
                    options, "static"):
                del _options["static"]  # should result only into "-shared"
            if _option_enabled(options, "static") or _option_disabled(
                    options, "shared"):
                del _options["shared"]  # should result only into "-static"

        _options = {key: value for key, value in conan_options.items()}
        _filter_overlapping_options(_options)

        for option_name, option_value in _options.items():
            qt_option = self.convert_conan_option_to_qt_option(
                name=option_name, value=option_value)
            if not qt_option:
                continue
            qt_options.append(qt_option)
        return qt_options
Beispiel #3
0
    def convert_conan_options_to_qt_options(self, conan_options: Options) -> List[str]:
        qt_options: List[str] = []

        def _option_enabled(opt: str) -> bool:
            return bool(conan_options.get_safe(opt))

        def _option_disabled(opt: str) -> bool:
            return not bool(conan_options.get_safe(opt))

        def _filter_overlapping_options() -> None:
            if _option_enabled("shared") or _option_disabled("static"):
                delattr(conan_options, "static")  # should result only into "-shared"
            if _option_enabled("static") or _option_disabled("shared"):
                delattr(conan_options, "shared")  # should result only into "-static"

        _filter_overlapping_options()

        for option_name, option_value in conan_options.items():
            qt_option = self.convert_conan_option_to_qt_option(
                conan_options=conan_options, name=option_name, value=option_value
            )
            if not qt_option:
                continue
            qt_options.append(qt_option)
        return qt_options
Beispiel #4
0
 def get_cmake_args_for_configure(
         self, conan_options: Options) -> List[Optional[str]]:
     ret: List[Optional[str]] = []
     for option_name, option_value in conan_options.items():
         if option_name == "cmake_args_qtbase" and self.is_used_option(
                 option_value):
             ret = [ret for ret in option_value.strip(r" '\"").split()]
     return ret
Beispiel #5
0
 def __init__(self, shared=None, options=None, options_values=None):
     options = options or ""
     self.command = None
     self.path = None
     self.settings = None
     self.options = Options(PackageOptions.loads(options))
     if options_values:
         for var, value in options_values.items():
             self.options._data[var] = value
     self.deps_cpp_info = MockDepsCppInfo(
     )  # ("deps_cpp_info", "sysroot")("/path/to/sysroot")
     self.deps_cpp_info.sysroot = "/path/to/sysroot"
     self.output = TestBufferConanOutput()
     self.in_local_cache = False
     if shared is not None:
         self.options = namedtuple("options", "shared")(shared)
     self.should_configure = True
     self.should_build = True
     self.should_install = True
     self.should_test = True
     self.generators = []
     self.captured_env = {}
     self.deps_env_info = DepsEnvInfo()
     self.env_info = EnvInfo()
     self.deps_user_info = DepsUserInfo()
     self._conan_env_values = EnvValues()
     self.folders = Folders()
     self.folders.set_base_source(".")
     self.folders.set_base_export_sources(".")
     self.folders.set_base_build(".")
     self.folders.set_base_install("myinstallfolder")
     self.folders.set_base_generators(".")
     self._conan_user = None
     self._conan_channel = None
     self.env_scripts = {}
     self.win_bash = None
     self.conf = ConfDefinition().get_conanfile_conf(None)
     self.cpp = Infos()
Beispiel #6
0
 def is_used_option(self, conan_options: Options, option_name: str) -> bool:
     # conan install ... -o release=False -> configure(.bat)
     # conan install ...                  -> configure(.bat)
     # conan install ... -o release=True  -> configure(.bat) -release
     return bool(conan_options.get_safe(option_name))