Example #1
0
 def _run(self, command):
     compiler = self._settings.get_safe("compiler")
     the_os = self._settings.get_safe("os")
     is_clangcl = the_os == 'Windows' and compiler == 'clang'
     is_msvc = compiler == 'Visual Studio'
     if (is_msvc or is_clangcl) and self.generator in ['Ninja', 'NMake Makefiles', 'NMake Makefiles JOM']:
         with tools.vcvars(self._settings, force=True, filter_known_paths=False):
             self._conanfile.run(command)
     else:
         self._conanfile.run(command)
Example #2
0
 def _run(self, command):
     compiler = self._settings.get_safe("compiler")
     the_os = self._settings.get_safe("os")
     is_clangcl = the_os == "Windows" and compiler == "clang"
     is_msvc = compiler == "Visual Studio"
     if (is_msvc or is_clangcl) and self.generator in ["Ninja", "NMake Makefiles",
                                                       "NMake Makefiles JOM"]:
         with tools.vcvars(self._settings, force=True, filter_known_paths=False,
                           output=self._conanfile.output):
             self._conanfile.run(command)
     else:
         self._conanfile.run(command)
Example #3
0
    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 because you
        can already have set some of the vars and accumulate unnecessary entries."""
        settings = Settings.loads(default_settings_yml)
        settings.os = "Windows"
        settings.compiler = "Visual Studio"
        settings.compiler.version = "15"
        settings.arch = "x86"
        settings.arch_build = "x86_64"

        # Set the env with a PATH containing the vcvars paths
        tmp = tools.vcvars_dict(settings, only_diff=False, output=self.output)
        tmp = {key.lower(): value for key, value in tmp.items()}
        with tools.environment_append({"path": tmp["path"]}):
            previous_path = os.environ["PATH"].split(";")
            # Duplicate the path, inside the tools.vcvars shouldn't have repeated entries in PATH
            with tools.vcvars(settings, output=self.output):
                path = os.environ["PATH"].split(";")
                values_count = {value: path.count(value) for value in path}
                for value, counter in values_count.items():
                    if value and counter > 1 and previous_path.count(value) != counter:
                        # If the entry was already repeated before calling "tools.vcvars" we keep it
                        self.fail("The key '%s' has been repeated" % value)
Example #4
0
 def _run(self, command):
     with tools.vcvars(self._settings, output=self._conanfile.output
                       ) if self._vcvars_needed else tools.no_op():
         env_build = AutoToolsBuildEnvironment(self._conanfile)
         with tools.environment_append(env_build.vars):
             self._conanfile.run(command)