示例#1
0
文件: py.py 项目: DikangGu/commons
 def execute(self):
   print "Build operating on target: %s" % self.target
   executor = PythonChroot(self.target, self.root_dir)
   executor.dump()
   binary = None
   if isinstance(self.target, PythonBinary):
     binary = os.path.join(executor.path(), '__main__.py')
   launcher = Launcher(executor.path(), binary)
   launcher.run(args=list(self.args))
示例#2
0
文件: py.py 项目: cscotta/commons
 def execute(self):
     print "Build operating on target: %s" % self.target
     executor = PythonChroot(self.target, self.root_dir)
     executor.dump()
     binary = None
     if isinstance(self.target, PythonBinary):
         binary = os.path.join(executor.path(), '__main__.py')
     launcher = Launcher(executor.path(), binary)
     launcher.run(args=list(self.args))
示例#3
0
  def _run_python_test(self, target):
    chroot = PythonChroot(target, self.root_dir)
    chroot.dump()
    launcher = Launcher(chroot.path())

    extra_deps = PythonTestBuilder.get_pytest_eggs(self.root_dir)
    test_args = ['-m', 'pytest']
    test_args.extend(PythonTestBuilder.generate_junit_args(target))
    test_args.extend(self.args)  # Pass any extra args in to pytest.
    sources = [os.path.join(target.target_base, source) for source in target.sources]
    return launcher.run(interpreter_args=test_args,
                        args=list(sources),
                        extra_deps=extra_deps)
示例#4
0
    def _run_python_test(self, target):
        chroot = PythonChroot(target, self.root_dir)
        chroot.dump()
        launcher = Launcher(chroot.path())

        extra_deps = PythonTestBuilder.get_pytest_eggs(self.root_dir)
        test_args = ['-m', 'pytest']
        test_args.extend(PythonTestBuilder.generate_junit_args(target))
        test_args.extend(self.args)  # Pass any extra args in to pytest.
        sources = [
            os.path.join(target.target_base, source)
            for source in target.sources
        ]
        return launcher.run(interpreter_args=test_args,
                            args=list(sources),
                            extra_deps=extra_deps)
示例#5
0
    def _run_lint(self, target, args):
        chroot = PythonChroot(target, self.root_dir)
        chroot.dump()
        launcher = Launcher(chroot.path())

        interpreter_args = [
            '-m', 'pylint.lint',
            '--rcfile=%s' %
            os.path.join(self.root_dir, 'build-support', 'pylint', 'pylint.rc')
        ]
        if args:
            interpreter_args.extend(args)
        sources = OrderedSet([])
        if not isinstance(target, PythonEgg):
            target.walk(lambda trg: sources.update(trg.sources),
                        lambda trg: not isinstance(trg, PythonEgg))
        launcher.run(interpreter_args=interpreter_args,
                     args=list(sources),
                     with_chroot=True)