Exemplo n.º 1
0
    def run(self,
            command,
            output=True,
            cwd=None,
            win_bash=False,
            subsystem=None,
            msys_mingw=True,
            ignore_errors=False,
            run_environment=False):
        def _run():
            if not win_bash:
                return self._runner(command, output,
                                    os.path.abspath(RUN_LOG_NAME), cwd)
            # FIXME: run in windows bash is not using output
            return tools.run_in_windows_bash(self,
                                             bashcmd=command,
                                             cwd=cwd,
                                             subsystem=subsystem,
                                             msys_mingw=msys_mingw)

        if run_environment:
            with tools.environment_append(RunEnvironment(self).vars):
                if os_info.is_macos:
                    command = 'DYLD_LIBRARY_PATH="%s" %s' % (os.environ.get(
                        'DYLD_LIBRARY_PATH', ''), command)
                retcode = _run()
        else:
            retcode = _run()

        if not ignore_errors and retcode != 0:
            raise ConanException("Error %d while executing %s" %
                                 (retcode, command))

        return retcode
Exemplo n.º 2
0
 def __init__(self, conanfile):
     super(CustomRunEnvGenerator, self).__init__(conanfile)
     run_env = RunEnvironment(conanfile)
     self.env = run_env.vars
     os_info = OSInfo()
     if os_info.is_posix:
         self.env['FONTCONFIG_PATH'] = "/etc/fonts"
 def test(self):
     os.chdir('bin')
     re = RunEnvironment(self)
     with tools.environment_append(re.vars):
         if platform.system() == "Darwin":
             lpath = os.environ["DYLD_LIBRARY_PATH"]
             self.run('DYLD_LIBRARY_PATH=%s ./example' % (lpath))
         else:
             self.run(".%sexample" % os.sep)
Exemplo n.º 4
0
    def run_vars_test(self):
        conanfile = MockConanfile()
        conanfile.deps_cpp_info["one"].bin_paths.append("path/bin")
        conanfile.deps_cpp_info["two"].lib_paths.append("path/libs")
        be = RunEnvironment(conanfile)

        self.assertEqual(be.vars,  {'PATH': ['path/bin'],
                                     'LD_LIBRARY_PATH': ['path/libs'],
                                     'DYLD_LIBRARY_PATH': ['path/libs']})
Exemplo n.º 5
0
 def test(self):
     bt = self.settings.build_type
     re = RunEnvironment(self)
     with tools.environment_append(re.vars):
         if platform.system() == "Darwin":
             lpath = os.environ["DYLD_LIBRARY_PATH"]
             self.run('DYLD_LIBRARY_PATH=%s ctest --output-on-error -C %s' % (lpath, bt))
         else:
             self.run('ctest --output-on-error -C %s' % bt)
         if self.options["boost"].python:
             os.chdir("bin")
             sys.path.append(".")
             import hello_ext
             hello_ext.greet()
Exemplo n.º 6
0
    def apple_frameworks_test(self):
        conanfile = ConanFileMock()
        conanfile.deps_cpp_info["one"].bin_paths.append("path/bin")
        conanfile.deps_cpp_info["two"].lib_paths.append("path/libs")
        conanfile.deps_cpp_info["one"].framework_paths.append(
            "path/Frameworks")
        be = RunEnvironment(conanfile)

        self.assertEqual(
            be.vars, {
                'PATH': ['path/bin'],
                'LD_LIBRARY_PATH': ['path/libs'],
                'DYLD_LIBRARY_PATH': ['path/libs'],
                'DYLD_FRAMEWORK_PATH': ['path/Frameworks']
            })
Exemplo n.º 7
0
def run_environment(conanfile):
    with environment_append(RunEnvironment(conanfile).vars):
        yield
Exemplo n.º 8
0
 def __init__(self, conanfile):
     super(VirtualRunEnvGenerator, self).__init__(conanfile)
     self.venv_name = "conanrunenv"
     run_env = RunEnvironment(conanfile)
     self.env = run_env.vars