Skip to content

Commit

Permalink
Fix python 36 issue
Browse files Browse the repository at this point in the history
  • Loading branch information
perseoGI committed May 29, 2024
1 parent 3ae459a commit a302915
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions conan/tools/cmake/toolchain/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1030,11 +1030,11 @@ class ExtraVariablesBlock(Block):
CMAKE_CACHE_TYPES = ["BOOL","FILEPATH", "PATH", "STRING", "INTERNAL"]

def get_exact_type(self, key, value):
if type(value) == str:
if isinstance(value, str):
return f"\"{value}\""
elif type(value) == int or type(value) == float:
elif isinstance(value, (int, float)):
return value
elif type(value) == dict:
elif isinstance(value, dict):
var_value = self.get_exact_type(key, value.get("value"))
is_cache = value.get("cache")
if is_cache == True or str(is_cache).lower() == 'true':
Expand Down
4 changes: 2 additions & 2 deletions test/integration/toolchains/cmake/test_cmaketoolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -1585,12 +1585,12 @@ def test_toolchain_extra_variables():
tools.cmake.cmaketoolchain:extra_variables={'CMAKE_GENERATOR_INSTANCE': '${GENERATOR_INSTANCE}/buildTools/', 'FOO': '42' }
""")

client = TestClient(path_with_spaces=False)
client = TestClient()
client.save({"conanfile.txt": "[generators]\nCMakeToolchain",
"windows": windows_profile})

# Test passing extra_variables from pro ile
client.run("install . --profile:build=windows --profile:host=windows")
client.run("install . --profile:host=windows")
toolchain = client.load("conan_toolchain.cmake")
assert 'set(CMAKE_GENERATOR_INSTANCE "${GENERATOR_INSTANCE}/buildTools/")' in toolchain
assert 'set(FOO "42")' in toolchain
Expand Down

0 comments on commit a302915

Please sign in to comment.