From dfa430b4b5d5dd1bd452cba4f57084a29ed65808 Mon Sep 17 00:00:00 2001 From: Chris Mc Date: Fri, 2 Dec 2022 12:46:01 -0800 Subject: [PATCH] (#14291) jasper: Bump dependencies + update imports * jasper: Bump dependencies Needed for #13988 and #14281 * block failing config + update imports * fix extra del * tix typo * update save to new helper * Update recipes/jasper/all/conanfile.py Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com> --- recipes/jasper/all/conanfile.py | 46 ++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/recipes/jasper/all/conanfile.py b/recipes/jasper/all/conanfile.py index 239b07850fe8f..796bf127244db 100644 --- a/recipes/jasper/all/conanfile.py +++ b/recipes/jasper/all/conanfile.py @@ -1,16 +1,20 @@ -from conans import ConanFile, CMake, tools +from conans import CMake +from conan import ConanFile +from conan.tools.files import get, save, rmdir, rm, replace_in_file, apply_conandata_patches, export_conandata_patches +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class JasperConan(ConanFile): name = "jasper" - license = "JasPer License Version 2.0" + license = "JasPer-2.0" homepage = "https://jasper-software.github.io/jasper" url = "https://github.com/conan-io/conan-center-index" - topics = ("jasper", "tool-kit", "coding") + topics = ("tool-kit", "coding") description = "JasPer Image Processing/Coding Tool Kit" settings = "os", "arch", "compiler", "build_type" @@ -38,8 +42,7 @@ def _build_subfolder(self): def export_sources(self): self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -47,18 +50,22 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def requirements(self): if self.options.with_libjpeg == "libjpeg-turbo": self.requires("libjpeg-turbo/2.1.2") elif self.options.with_libjpeg == "libjpeg": - self.requires("libjpeg/9d") + self.requires("libjpeg/9e") + + def validate(self): + if self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version) == "16": + raise ConanInvalidConfiguration(f"{self.name} Current can not build in CCI due to windows SDK version. See https://github.com/conan-io/conan-center-index/pull/13285 for the solution hopefully") def source(self): - tools.get(**self.conan_data["sources"][self.version], + get(self, **self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) def _configure_cmake(self): @@ -74,8 +81,7 @@ def _configure_cmake(self): return self._cmake def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) # Clean rpath in installed shared lib cmakelists = os.path.join(self._source_subfolder, "CMakeLists.txt") cmds_to_remove = [ @@ -84,7 +90,7 @@ def _patch_sources(self): "set(CMAKE_INSTALL_RPATH\n \"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}\")", ] for cmd_to_remove in cmds_to_remove: - tools.replace_in_file(cmakelists, cmd_to_remove, "") + replace_in_file(self, cmakelists, cmd_to_remove, "") def build(self): self._patch_sources() @@ -95,18 +101,16 @@ def package(self): self.copy("LICENSE", src=self._source_subfolder, dst="licenses") cmake = self._configure_cmake() cmake.install() - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) if self.settings.os == "Windows": for dll_prefix in ["concrt", "msvcp", "vcruntime"]: - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), - "{}*.dll".format(dll_prefix)) + rm(self, f"{dll_prefix}*.dll", os.path.join(self.package_folder, "bin")) self._create_cmake_module_variables( os.path.join(self.package_folder, self._module_file_rel_path) ) - @staticmethod - def _create_cmake_module_variables(module_file): + def _create_cmake_module_variables(self, module_file): content = textwrap.dedent("""\ if(DEFINED Jasper_FOUND) set(JASPER_FOUND ${Jasper_FOUND}) @@ -121,7 +125,7 @@ def _create_cmake_module_variables(module_file): set(JASPER_VERSION_STRING ${Jasper_VERSION}) endif() """) - tools.save(module_file, content) + save(self, module_file, content) @property def _module_file_rel_path(self):