Skip to content

Commit

Permalink
fix bug in windows_store vcvars (#6296)
Browse files Browse the repository at this point in the history
* fix bug in windows_store vcvars

* simplified test
  • Loading branch information
memsharded committed Jan 8, 2020
1 parent 1e8464b commit 812c8ec
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 14 deletions.
24 changes: 12 additions & 12 deletions conans/client/tools/win.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,18 +421,18 @@ def vcvars_command(settings, arch=None, compiler_version=None, force=False, vcva
if vcvars_ver:
command.append("-vcvars_ver=%s" % vcvars_ver)

if os_setting == 'WindowsStore':
os_version_setting = settings.get_safe("os.version")
if os_version_setting == '8.1':
command.append('store 8.1')
elif os_version_setting == '10.0':
windows_10_sdk = find_windows_10_sdk()
if not windows_10_sdk:
raise ConanException("cross-compiling for WindowsStore 10 (UWP), "
"but Windows 10 SDK wasn't found")
command.append('store %s' % windows_10_sdk)
else:
raise ConanException('unsupported Windows Store version %s' % os_version_setting)
if os_setting == 'WindowsStore':
os_version_setting = settings.get_safe("os.version")
if os_version_setting == '8.1':
command.append('store 8.1')
elif os_version_setting == '10.0':
windows_10_sdk = find_windows_10_sdk()
if not windows_10_sdk:
raise ConanException("cross-compiling for WindowsStore 10 (UWP), "
"but Windows 10 SDK wasn't found")
command.append('store %s' % windows_10_sdk)
else:
raise ConanException('unsupported Windows Store version %s' % os_version_setting)
return " ".join(command)


Expand Down
16 changes: 14 additions & 2 deletions conans/test/unittests/util/tools_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,9 +417,8 @@ def vswhere_path_test(self):
with tools.environment_append(env):
self.assertTrue(vswhere())

@unittest.skipUnless(platform.system() == "Windows", "Requires Windows")
def vcvars_echo_test(self):
if platform.system() != "Windows":
return
settings = Settings.loads(default_settings_yml)
settings.os = "Windows"
settings.compiler = "Visual Studio"
Expand All @@ -439,6 +438,19 @@ def vcvars_echo_test(self):
self.assertIn("Conan:vcvars already set", str(output))
self.assertIn("VS140COMNTOOLS=", str(output))

@unittest.skipUnless(platform.system() == "Windows", "Requires Windows")
def vcvars_with_store_echo_test(self):
settings = Settings.loads(default_settings_yml)
settings.os = "WindowsStore"
settings.os.version = "8.1"
settings.compiler = "Visual Studio"
settings.compiler.version = "14"
cmd = tools.vcvars_command(settings, output=self.output)
self.assertIn("store 8.1", cmd)
with tools.environment_append({"VisualStudioVersion": "14"}):
cmd = tools.vcvars_command(settings, output=self.output)
self.assertEqual("echo Conan:vcvars already set", cmd)

@unittest.skipUnless(platform.system() == "Windows", "Requires Windows")
def vcvars_env_not_duplicated_path_test(self):
"""vcvars is not looking at the current values of the env vars, with PATH it is a problem
Expand Down

0 comments on commit 812c8ec

Please sign in to comment.