From 5f9985b783a10d06195fa3d489af0bda5cd8e184 Mon Sep 17 00:00:00 2001 From: System-Arch <33330183+System-Arch@users.noreply.github.com> Date: Tue, 14 Feb 2023 10:28:58 -0500 Subject: [PATCH] (#14980) icu: validate dat package file exists * ICU Conan 2.0 compatibility tweaks * Fix lint issues * Fixed typo * Removed unused import * Try dropping back to 1.54 * Apply suggestions from code review Co-authored-by: Chris Mc * Removed workarounds for conan-io/conan:#12642 and conan-io/conan:#12884 * Update file hash per code review feedback Co-authored-by: Marian Klymov * Fix argument to open() Co-authored-by: Marian Klymov * self.version.major needs parens in Conan 1.x * Revert use of version.major until 1.x support is dropped * Treat settings.compiler.version as str to test inequality * Apply suggestions from code review Co-authored-by: Uilian Ries * import Version * Validate existence of dat_package_file per code review suggesion * Apply suggestions from code review * missing import and leave old cross build stuff (its not used in CCI so lets ignore it) * missing import --------- Co-authored-by: Chris Mc Co-authored-by: Marian Klymov Co-authored-by: Uilian Ries Co-authored-by: Chris Mc --- recipes/icu/all/conanfile.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/recipes/icu/all/conanfile.py b/recipes/icu/all/conanfile.py index 9e0cb5d78c9a0..5b2773ee2d710 100644 --- a/recipes/icu/all/conanfile.py +++ b/recipes/icu/all/conanfile.py @@ -4,6 +4,7 @@ import shutil from conan import ConanFile +from conan.errors import ConanInvalidConfiguration from conan.tools.apple import is_apple_os from conan.tools.build import cross_building, stdcpp_library from conan.tools.env import Environment, VirtualBuildEnv @@ -11,6 +12,7 @@ from conan.tools.gnu import Autotools, AutotoolsToolchain from conan.tools.layout import basic_layout from conan.tools.microsoft import check_min_vs, is_msvc, unix_path +from conan.tools.scm import Version required_conan_version = ">=1.57.0" @@ -68,6 +70,11 @@ def configure(self): if self.options.shared: self.options.rm_safe("fPIC") + def validate(self): + if self.options.dat_package_file: + if not os.path.exists(self.options.dat_package_file): + raise ConanInvalidConfiguration("Non-existent dat_package_file specified") + def layout(self): basic_layout(self, src_folder="src") @@ -201,7 +208,7 @@ def build(self): @property def _data_filename(self): - vtag = self.version.split(".")[0] + vtag = Version(self.version).major return f"icudt{vtag}l.dat" @property @@ -209,7 +216,7 @@ def _data_path(self): data_dir_name = "icu" if self.settings.os == "Windows" and self.settings.build_type == "Debug": data_dir_name += "d" - data_dir = os.path.join(self.package_folder, "lib", data_dir_name, self.version) + data_dir = os.path.join(self.package_folder, "lib", data_dir_name, str(self.version)) return os.path.join(data_dir, self._data_filename) def package(self):