def _run(self, command): compiler = self._settings.get_safe("compiler") conan_v2_error("compiler setting should be defined.", not compiler) the_os = self._settings.get_safe("os") is_clangcl = the_os == "Windows" and compiler == "clang" is_msvc = compiler == "Visual Studio" is_intel = compiler == "intel" context = tools.no_op() if (is_msvc or is_clangcl) and platform.system() == "Windows": if self.generator in [ "Ninja", "NMake Makefiles", "NMake Makefiles JOM" ]: vcvars_dict = tools.vcvars_dict(self._settings, force=True, filter_known_paths=False, output=self._conanfile.output) context = _environment_add(vcvars_dict, post=self._append_vcvars) elif is_intel: if self.generator in [ "Ninja", "NMake Makefiles", "NMake Makefiles JOM", "Unix Makefiles" ]: intel_compilervars_dict = tools.intel_compilervars_dict( self._conanfile, force=True) context = _environment_add(intel_compilervars_dict, post=self._append_vcvars) with context: self._conanfile.run(command)
def _run(self, command): def _build(): self._conanfile.run(command) if self._vcvars_needed: vcvars_dict = tools.vcvars_dict(self._settings, output=self._conanfile.output) with _environment_add(vcvars_dict, post=self._append_vcvars): _build() else: _build()
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 platform.system() == "Windows" and self.generator in ["Ninja", "NMake Makefiles", "NMake Makefiles JOM"]): vcvars_dict = tools.vcvars_dict(self._settings, force=True, filter_known_paths=False, output=self._conanfile.output) with _environment_add(vcvars_dict, post=self._append_vcvars): self._conanfile.run(command) else: self._conanfile.run(command)
def test_conan_username(self): t = self.get_client() conanfile = textwrap.dedent(""" from conans import ConanFile class Recipe(ConanFile): name = "name" version = "version" """) t.save({'conanfile.py': conanfile}) with _environment_add({'CONAN_USERNAME': "******"}): t.run('create .', assert_error=True) self.assertIn( "Conan v2 incompatible: Environment variable 'CONAN_USERNAME' is deprecated", t.out)