forked from conan-io/conan-center-index
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
No need to actually compile something with this tool we simply need to know if it runs. The win_bash for the run needs to be set explicitly due to the conf not working properly in the test_package see conan-io/conan#11975
- Loading branch information
1 parent
6aeafa2
commit d9ee4de
Showing
6 changed files
with
13 additions
and
118 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,29 @@ | ||
from conans import AutoToolsBuildEnvironment, ConanFile, tools | ||
from conan.tools.microsoft import is_msvc | ||
import contextlib | ||
import os | ||
import shutil | ||
from os import environ | ||
|
||
required_conan_version = ">=1.45.0" | ||
from conan import ConanFile | ||
from conan.tools.build import can_run | ||
|
||
required_conan_version = ">=1.50.0" | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
exports_sources = "configure.ac", "config.h.in", "Makefile.in", "test_package_c.c", "test_package_cpp.cpp", | ||
generators = "VirtualBuildEnv" | ||
test_type = "explicit" | ||
win_bash = True | ||
|
||
@property | ||
def _settings_build(self): | ||
return getattr(self, "settings_build", self.settings) | ||
|
||
def build_requirements(self): | ||
self.build_requires(self.tested_reference_str) | ||
if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): | ||
self.build_requires("msys2/cci.latest") | ||
|
||
@contextlib.contextmanager | ||
def _build_context(self): | ||
if is_msvc(self): | ||
with tools.vcvars(self): | ||
with tools.environment_append({"CC": "cl -nologo", "CXX": "cl -nologo",}): | ||
yield | ||
else: | ||
yield | ||
self.tool_requires(self.tested_reference_str) | ||
if self._settings_build.os == "Windows" and not environ.get("CONAN_BASH_PATH"): | ||
self.tool_requires("msys2/cci.latest") | ||
|
||
def build(self): | ||
for src in self.exports_sources: | ||
shutil.copy(os.path.join(self.source_folder, src), self.build_folder) | ||
self.run("{} --verbose".format(os.environ["AUTOCONF"]), | ||
win_bash=tools.os_info.is_windows, run_environment=True) | ||
self.run("{} --help".format(os.path.join(self.build_folder, "configure").replace("\\", "/")), | ||
win_bash=tools.os_info.is_windows, run_environment=True) | ||
autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) | ||
with self._build_context(): | ||
autotools.configure() | ||
autotools.make() | ||
pass | ||
|
||
def test(self): | ||
if not tools.cross_building(self): | ||
self.run(os.path.join(".", "test_package"), run_environment=True) | ||
if can_run(self): | ||
self.run("autoconf --version", run_environment=True, env="conanbuild", win_bash=self.settings.os == "Windows") |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.