def create_options(conanfile): try: package_options = PackageOptions(getattr(conanfile, "options", None)) options = Options(package_options) default_options = getattr(conanfile, "default_options", None) if default_options: if isinstance(default_options, (list, tuple, dict)): default_values = OptionsValues(default_options) elif isinstance(default_options, str): default_values = OptionsValues.loads(default_options) else: raise ConanException("Please define your default_options as list, " "multiline string or dictionary") options.values = default_values return options except Exception as e: raise ConanException("Error while initializing options. %s" % str(e))
def create_options(conanfile): try: package_options = PackageOptions(getattr(conanfile, "options", None)) options = Options(package_options) default_options = getattr(conanfile, "default_options", None) if default_options: if isinstance(default_options, (list, tuple)): default_values = OptionsValues(default_options) elif isinstance(default_options, str): default_values = OptionsValues.loads(default_options) else: raise ConanException("Please define your default_options as list or " "multiline string") options.values = default_values return options except Exception as e: raise ConanException("Error while initializing options. %s" % str(e))
def create_options(conanfile): try: package_options = PackageOptions(getattr(conanfile, "options", None)) options = Options(package_options) default_options = getattr(conanfile, "default_options", None) if default_options: if isinstance(default_options, tuple): default_values = OptionsValues.loads( "\n".join(default_options)) elif isinstance(default_options, list): default_values = OptionsValues.from_list(default_options) elif isinstance(default_options, basestring): default_values = OptionsValues.loads(default_options) else: raise ConanException( "Please define your default_options as list or " "multiline string") options.values = default_values return options except Exception as e: raise ConanException("Error while initializing options. %s" % str(e))