Skip to content

Commit

Permalink
(#14980) icu: validate dat package file exists
Browse files Browse the repository at this point in the history
* 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 <prince.chrismc@gmail.com>

* Removed workarounds for conan-io/conan:#12642 and conan-io/conan:#12884

* Update file hash per code review feedback

Co-authored-by: Marian Klymov <nekto1989@gmail.com>

* Fix argument to open()

Co-authored-by: Marian Klymov <nekto1989@gmail.com>

* 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 <uilianries@gmail.com>

* 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 <prince.chrismc@gmail.com>
Co-authored-by: Marian Klymov <nekto1989@gmail.com>
Co-authored-by: Uilian Ries <uilianries@gmail.com>
Co-authored-by: Chris Mc <christopherm@jfrog.com>
  • Loading branch information
5 people authored Feb 14, 2023
1 parent 336915d commit 5f9985b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions recipes/icu/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
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
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, mkdir, rename, replace_in_file, rm, rmdir, save
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"

Expand Down Expand Up @@ -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")

Expand Down Expand Up @@ -201,15 +208,15 @@ 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
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):
Expand Down

0 comments on commit 5f9985b

Please sign in to comment.