From 097504e63bb6918a9632dd4e809ea2b6f364e077 Mon Sep 17 00:00:00 2001 From: Chris Mc Date: Fri, 18 Nov 2022 23:20:17 -0800 Subject: [PATCH 1/6] jasper: Bump dependencies Needed for #13988 and #14281 --- recipes/jasper/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/jasper/all/conanfile.py b/recipes/jasper/all/conanfile.py index 239b07850fe8f..80a5ab14346c0 100644 --- a/recipes/jasper/all/conanfile.py +++ b/recipes/jasper/all/conanfile.py @@ -55,7 +55,7 @@ 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 source(self): tools.get(**self.conan_data["sources"][self.version], From 5e31ec150f4ac0c040878d327b5cabc0edc7498e Mon Sep 17 00:00:00 2001 From: Chris Mc Date: Sat, 19 Nov 2022 18:42:31 -0800 Subject: [PATCH 2/6] block failing config + update imports --- recipes/jasper/all/conanfile.py | 39 +++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/recipes/jasper/all/conanfile.py b/recipes/jasper/all/conanfile.py index 80a5ab14346c0..1256814a35ab1 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, rmdir, rm, replace_in_file, apply_conandata_patches, export_conandata_patches +from conan.tools.scm import Version +from conan.error 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,9 +50,9 @@ 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 + del self.options.rm_safe("fPIC") + del self.settings.rm_safe("compiler.cppstd") + del self.settings.rm_safe("compiler.libcxx") def requirements(self): if self.options.with_libjpeg == "libjpeg-turbo": @@ -57,8 +60,12 @@ def requirements(self): elif self.options.with_libjpeg == "libjpeg": 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,12 +101,11 @@ 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) ) From 0747f4b43c28cc9830472be3565a5eb640077514 Mon Sep 17 00:00:00 2001 From: Chris Mc Date: Mon, 21 Nov 2022 08:04:11 -0800 Subject: [PATCH 3/6] fix extra del --- recipes/jasper/all/conanfile.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/recipes/jasper/all/conanfile.py b/recipes/jasper/all/conanfile.py index 1256814a35ab1..86a33437673c8 100644 --- a/recipes/jasper/all/conanfile.py +++ b/recipes/jasper/all/conanfile.py @@ -50,9 +50,9 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.rm_safe("fPIC") - del self.settings.rm_safe("compiler.cppstd") - del self.settings.rm_safe("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": From 288ced2ca50cbad7211541bf5dee71b4b59f3faf Mon Sep 17 00:00:00 2001 From: Chris Mc Date: Mon, 21 Nov 2022 08:07:27 -0800 Subject: [PATCH 4/6] tix typo --- recipes/jasper/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/jasper/all/conanfile.py b/recipes/jasper/all/conanfile.py index 86a33437673c8..ac01da0189847 100644 --- a/recipes/jasper/all/conanfile.py +++ b/recipes/jasper/all/conanfile.py @@ -2,7 +2,7 @@ from conan import ConanFile from conan.tools.files import get, rmdir, rm, replace_in_file, apply_conandata_patches, export_conandata_patches from conan.tools.scm import Version -from conan.error import ConanInvalidConfiguration +from conan.errors import ConanInvalidConfiguration import os import textwrap From a79e11a6bc91a7800aeca45f43fe53051aa18614 Mon Sep 17 00:00:00 2001 From: Chris Mc Date: Tue, 22 Nov 2022 08:44:15 -0800 Subject: [PATCH 5/6] update save to new helper --- recipes/jasper/all/conanfile.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/recipes/jasper/all/conanfile.py b/recipes/jasper/all/conanfile.py index ac01da0189847..1d99947bb1aae 100644 --- a/recipes/jasper/all/conanfile.py +++ b/recipes/jasper/all/conanfile.py @@ -1,6 +1,6 @@ from conans import CMake from conan import ConanFile -from conan.tools.files import get, rmdir, rm, replace_in_file, apply_conandata_patches, export_conandata_patches +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 @@ -110,8 +110,7 @@ def package(self): 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}) @@ -126,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): From 4894df5f51082a0dde9015e177fae1154e30e087 Mon Sep 17 00:00:00 2001 From: Chris Mc Date: Fri, 25 Nov 2022 10:37:42 -0800 Subject: [PATCH 6/6] Update recipes/jasper/all/conanfile.py Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com> --- recipes/jasper/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/jasper/all/conanfile.py b/recipes/jasper/all/conanfile.py index 1d99947bb1aae..796bf127244db 100644 --- a/recipes/jasper/all/conanfile.py +++ b/recipes/jasper/all/conanfile.py @@ -61,7 +61,7 @@ def requirements(self): self.requires("libjpeg/9e") def validate(self): - if self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version) >= "16": + 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):