Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Conan v2 #1

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions recipes/innoextract/all/CMakeLists.txt

This file was deleted.

2 changes: 0 additions & 2 deletions recipes/innoextract/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,4 @@ sources:
patches:
"1.9.0":
- patch_file: "patches/0001-cmake-fix-module.patch"
base_path: "source_subfolder"
- patch_file: "patches/0002-remove-custom-cmake-find-modules.patch"
base_path: "source_subfolder"
86 changes: 43 additions & 43 deletions recipes/innoextract/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,71 +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.80.0",
"xz_utils/5.2.5",
"libiconv/1.17"
)
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)
6 changes: 3 additions & 3 deletions recipes/innoextract/all/patches/0001-cmake-fix-module.patch
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ index dbb64f1..a8a67e8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -105,7 +105,7 @@ endif()

include(CheckSymbolExists)

-set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") # For custom cmake modules
+list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") # For custom cmake modules
+list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") # For custom cmake modules
include(BuildType)
include(CompileCheck)
include(CreateSourceGroups)
23 changes: 9 additions & 14 deletions recipes/innoextract/all/test_package/conanfile.py
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")
19 changes: 19 additions & 0 deletions recipes/innoextract/all/test_v1_package/conanfile.py
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)