-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(#13586) innoextract: requirements version bump
* innoextract: Bump requirement versions * innoextract: There are no include directories - Silence hook error. * Support Conan 2.0 Signed-off-by: Uilian Ries <uilianries@gmail.com> Signed-off-by: Uilian Ries <uilianries@gmail.com> Co-authored-by: Uilian Ries <uilianries@gmail.com>
- Loading branch information
1 parent
b7ebc4b
commit 50b09ba
Showing
6 changed files
with
75 additions
and
69 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,71 @@ | ||
from conan import ConanFile | ||
from conan.tools.files import get, rmdir, copy, apply_conandata_patches, export_conandata_patches | ||
from conan.tools.cmake import cmake_layout, CMake, CMakeDeps, CMakeToolchain | ||
from conan.tools.env import VirtualBuildEnv | ||
import os | ||
import functools | ||
from conans import ConanFile, CMake, tools | ||
|
||
required_conan_version = ">=1.33.0" | ||
|
||
required_conan_version = ">=1.52.0" | ||
|
||
|
||
class InnoextractConan(ConanFile): | ||
name = "innoextract" | ||
description = "Extract contents of Inno Setup installers" | ||
license = "innoextract License" | ||
license = "LicenseRef-LICENSE" | ||
topics = ("inno-setup", "decompression") | ||
homepage = "https://constexpr.org/innoextract/" | ||
homepage = "https://constexpr.org/innoextract" | ||
url = "https://github.com/conan-io/conan-center-index" | ||
exports_sources = ["CMakeLists.txt", "patches/*"] | ||
requires = ( | ||
"boost/1.78.0", | ||
"xz_utils/5.2.5", | ||
"libiconv/1.16" | ||
) | ||
generators = "cmake", "cmake_find_package" | ||
settings = "os", "arch", "compiler", "build_type" | ||
|
||
@property | ||
def _source_subfolder(self): | ||
return "source_subfolder" | ||
def export_sources(self): | ||
export_conandata_patches(self) | ||
|
||
@property | ||
def _build_subfolder(self): | ||
return "build_subfolder" | ||
def layout(self): | ||
cmake_layout(self, src_folder="src") | ||
|
||
def source(self): | ||
tools.get(**self.conan_data["sources"][self.version], strip_root=True, | ||
destination=self._source_subfolder) | ||
def requirements(self): | ||
self.requires("boost/1.80.0") | ||
self.requires("xz_utils/5.2.5") | ||
self.requires("libiconv/1.17") | ||
|
||
def build(self): | ||
for patch in self.conan_data.get("patches", {}).get(self.version, []): | ||
tools.patch(**patch) | ||
os.remove(os.path.join(self._source_subfolder, 'cmake', 'FindLZMA.cmake')) | ||
os.remove(os.path.join(self._source_subfolder, 'cmake', 'Findiconv.cmake')) | ||
cmake = self._configure_cmake() | ||
cmake.build() | ||
def package_id(self): | ||
del self.info.settings.compiler | ||
self.info.requires.clear() | ||
|
||
@functools.lru_cache(1) | ||
def _configure_cmake(self): | ||
cmake = CMake(self) | ||
def source(self): | ||
get(self, **self.conan_data["sources"][self.version], strip_root=True, | ||
destination=self.source_folder) | ||
|
||
def generate(self): | ||
env = VirtualBuildEnv(self) | ||
env.generate() | ||
tc = CMakeToolchain(self) | ||
# Turn off static library detection, which is on by default on Windows. | ||
# This keeps the CMakeLists.txt from trying to detect static Boost | ||
# libraries and use Boost components for zlib and BZip2. Getting the | ||
# libraries via Conan does the correct thing without other assistance. | ||
cmake.definitions["USE_STATIC_LIBS"] = False | ||
cmake.configure(build_folder=self._build_subfolder) | ||
return cmake | ||
tc.variables["USE_STATIC_LIBS"] = False | ||
tc.generate() | ||
tc = CMakeDeps(self) | ||
tc.generate() | ||
|
||
def build(self): | ||
apply_conandata_patches(self) | ||
os.remove(os.path.join(self.source_folder, 'cmake', 'FindLZMA.cmake')) | ||
os.remove(os.path.join(self.source_folder, 'cmake', 'Findiconv.cmake')) | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def package(self): | ||
self.copy("LICENSE", dst="licenses", src=self._source_subfolder) | ||
cmake = self._configure_cmake() | ||
copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) | ||
cmake = CMake(self) | ||
cmake.install() | ||
tools.rmdir(os.path.join(self.package_folder, "share")) | ||
|
||
def package_id(self): | ||
del self.info.settings.compiler | ||
self.info.requires.clear() | ||
rmdir(self, os.path.join(self.package_folder, "share")) | ||
|
||
def package_info(self): | ||
self.cpp_info.includedirs = [] | ||
self.cpp_info.libdirs = [] | ||
bindir = os.path.join(self.package_folder, "bin") | ||
self.output.info("Appending PATH environment variable: {}" | ||
.format(bindir)) | ||
self.output.info(f"Appending PATH environment variable: {bindir}") | ||
self.env_info.PATH.append(bindir) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,14 @@ | ||
from six import StringIO | ||
from conans import ConanFile, tools | ||
|
||
from conan import ConanFile | ||
from conan.tools.build import can_run | ||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "arch", "build_type", "compiler" | ||
generators = "VirtualRunEnv" | ||
test_type = "explicit" | ||
|
||
def requirements(self): | ||
self.requires(self.tested_reference_str) | ||
|
||
def test(self): | ||
if not tools.cross_building(self): | ||
output = StringIO() | ||
self.run("innoextract --version", output=output, | ||
run_environment=True) | ||
output_str = str(output.getvalue()) | ||
self.output.info("Installed version: {}".format(output_str)) | ||
require_version = str(self.deps_cpp_info["innoextract"].version) | ||
require_version = ".".join(require_version.split(".")[:2]) | ||
self.output.info("Expected version: {}".format(require_version)) | ||
assert_innoextract_version = "innoextract %s" % require_version | ||
assert(assert_innoextract_version in output_str) | ||
if can_run(self): | ||
self.run("innoextract --version", env="conanrun") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from six import StringIO | ||
from conans import ConanFile, tools | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "arch", "build_type", "compiler" | ||
|
||
def test(self): | ||
if not tools.cross_building(self): | ||
output = StringIO() | ||
self.run("innoextract --version", output=output, | ||
run_environment=True) | ||
output_str = str(output.getvalue()) | ||
self.output.info("Installed version: {}".format(output_str)) | ||
require_version = str(self.deps_cpp_info["innoextract"].version) | ||
require_version = ".".join(require_version.split(".")[:2]) | ||
self.output.info("Expected version: {}".format(require_version)) | ||
assert_innoextract_version = "innoextract %s" % require_version | ||
assert(assert_innoextract_version in output_str) |