Skip to content

Commit

Permalink
Jump through more hoops to make tests work with Conan 1.x
Browse files Browse the repository at this point in the history
  • Loading branch information
System-Arch committed Feb 10, 2023
1 parent 7a3a5ae commit 5b27f9c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
5 changes: 1 addition & 4 deletions recipes/autoconf-archive/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from conan.tools.gnu import AutotoolsToolchain, Autotools
from conan.tools.microsoft import is_msvc, unix_path
from conan.tools.layout import basic_layout
from conan.tools.env import VirtualBuildEnv
import os
import shutil

Expand All @@ -14,6 +13,7 @@ class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
exports_sources = "configure.ac", "Makefile.am", "test_package.c"
test_type = "explicit"
generators = "VirtualBuildEnv" # Need VirtualBuildEnv for Conan 1.x env_info support
win_bash = True # This assignment must be *here* to avoid "Cannot wrap command with different envs." in Conan 1.x

@property
Expand All @@ -39,9 +39,6 @@ def generate(self):
env.define("CC", "cl -nologo")
env.define("CXX", "cl -nologo")
tc.generate(env)
# Need VirtualBuildEnv for Conan 1.x env_info support
env = VirtualBuildEnv(self)
env.generate()

def build(self):
if not cross_building(self):
Expand Down
7 changes: 5 additions & 2 deletions recipes/autoconf-archive/all/test_v1_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os
import shutil

required_conan_version = ">=1.36.0"
required_conan_version = ">=1.56.0"


class TestPackageConan(ConanFile):
Expand Down Expand Up @@ -37,7 +37,10 @@ def _build_context(self):
def build(self):
for src in self.exports_sources:
shutil.copy(os.path.join(self.source_folder, src), self.build_folder)
self.run("{} -fiv".format(tools.get_env("AUTORECONF")), run_environment=True, win_bash=self._settings_build.os == "Windows")

# Work around the fact that "used_special_vars" in conans/client/tools/win.py doesn't handle ACLOCAL_PATH
aclocal_path = "$ACLOCAL_PATH:" + self.deps_env_info.vars["ACLOCAL_PATH"][0].lower()
self.run("ACLOCAL_PATH={} autoreconf -fiv".format(aclocal_path), win_bash=self._settings_build.os == "Windows")
with self._build_context():
autotools = AutoToolsBuildEnvironment(self, win_bash=self._settings_build.os == "Windows")
autotools.libs = []
Expand Down

0 comments on commit 5b27f9c

Please sign in to comment.