Skip to content

Commit 80b47f1

Browse files
authored
Custom environment in AutotoolsToolchain (#10631)
1 parent ff318a3 commit 80b47f1

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

conans/test/integration/toolchains/gnu/__init__.py

Whitespace-only changes.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import os
2+
import textwrap
3+
4+
from conans.test.utils.tools import TestClient
5+
from conans.util.files import load
6+
7+
8+
def test_autotools_custom_environment():
9+
client = TestClient()
10+
conanfile = textwrap.dedent("""
11+
from conan import ConanFile
12+
from conan.tools.gnu import AutotoolsToolchain
13+
14+
class Conan(ConanFile):
15+
settings = "os"
16+
def generate(self):
17+
at = AutotoolsToolchain(self)
18+
env = at.environment()
19+
env.define("FOO", "BAR")
20+
at.generate(env)
21+
""")
22+
23+
client.save({"conanfile.py": conanfile})
24+
client.run("install . -sh:os=Linux")
25+
content = load(os.path.join(client.current_folder, "conanautotoolstoolchain.sh"))
26+
assert 'export FOO="BAR"' in content

0 commit comments

Comments
 (0)