示例#1
0
  def build(self, targets, args, conn_timeout=None):
    test_targets = []
    binary_targets = []

    for target in targets:
      assert is_python(target), "PythonBuilder can only build PythonTargets, given %s" % str(target)

    if 'pylint' in args:
      real_args = list(args)
      real_args.remove('pylint')
      for target in targets:
        try:
          PythonLintBuilder([target], real_args, self.root_dir, conn_timeout=conn_timeout).run()
        except Exception as e:
          print('Failed to run lint for %s: %s' % (target, e))
      return 0

    # PythonBuilder supports PythonTests and PythonBinaries
    for target in targets:
      if isinstance(target, PythonTests) or isinstance(target, PythonTestSuite):
        test_targets.append(target)
      elif isinstance(target, PythonBinary):
        binary_targets.append(target)

    rv = PythonTestBuilder(test_targets, args, self.root_dir, conn_timeout=conn_timeout).run()
    if rv != 0: return rv

    for binary_target in binary_targets:
      rv = PythonBinaryBuilder(binary_target, args, self.root_dir, conn_timeout=conn_timeout).run()
      if rv != 0: return rv

    return 0
示例#2
0
    def build(self, targets, args):
        test_targets = []
        binary_targets = []

        for target in targets:
            assert is_python(
                target
            ), "PythonBuilder can only build PythonTargets, given %s" % str(
                target)

        if 'pylint' in args:
            real_args = list(args)
            real_args.remove('pylint')
            for target in targets:
                PythonLintBuilder([target], real_args, self.root_dir).run()
            return 0

        # PythonBuilder supports PythonTests and PythonBinaries
        for target in targets:
            if isinstance(target, PythonTests) or isinstance(
                    target, PythonTestSuite):
                test_targets.append(target)
            elif isinstance(target, PythonBinary):
                binary_targets.append(target)

        rv = PythonTestBuilder(test_targets, args, self.root_dir).run()
        if rv != 0: return rv

        for binary_target in binary_targets:
            rv = PythonBinaryBuilder(binary_target, args, self.root_dir).run()
            if rv != 0: return rv

        return 0
示例#3
0
  def build(self, targets, args):
    test_targets = []
    binary_targets = []

    for target in targets:
      assert is_python(target), "PythonBuilder can only build PythonTargets, given %s" % str(target)

    if 'pylint' in args:
      real_args = list(args)
      real_args.remove('pylint')
      for target in targets:
        PythonLintBuilder([target], real_args, self.root_dir).run()
      return 0

    # PythonBuilder supports PythonTests and PythonBinaries
    for target in targets:
      if isinstance(target, PythonTests) or isinstance(target, PythonTestSuite):
        test_targets.append(target)
      elif isinstance(target, PythonBinary):
        binary_targets.append(target)

    rv = PythonTestBuilder(test_targets, args, self.root_dir).run()
    if rv != 0: return rv

    for binary_target in binary_targets:
      rv = PythonBinaryBuilder(binary_target, args, self.root_dir).run()
      if rv != 0: return rv

    return 0
示例#4
0
    def execute(self):
        target = Target.get(self.address)

        if all(is_jvm(t) for t in target.resolve()):
            if self.is_graph:
                self._print_digraph(target)
            else:
                self._print_dependency_tree(target)
        elif is_python(target):
            if self.is_internal_only or self.is_external_only or self.is_minimal or self.is_graph:
                print('Unsupported option for Python target', file=sys.stderr)
                sys.exit(1)
            self._print_python_dependencies(target, 0)
示例#5
0
  def execute(self):
    target = Target.get(self.address)

    if all(is_jvm(t) for t in target.resolve()):
      if self.is_graph:
        self._print_digraph(target)
      else:
        self._print_dependency_tree(target)
    elif is_python(target):
      if self.is_internal_only or self.is_external_only or self.is_minimal or self.is_graph:
        print('Unsupported option for Python target', file=sys.stderr)
        sys.exit(1)
      self._print_python_dependencies(target, 0)
示例#6
0
文件: depmap.py 项目: cscotta/commons
    def execute(self):
        target = Target.get(self.address)

        if is_java(target):
            if self.is_graph:
                self._print_digraph(target)
            else:
                self._print_dependency_tree(target)
        elif is_python(target):
            if self.is_internal_only or self.is_external_only or self.is_minimal or self.is_graph:
                print >> sys.stderr, 'Unsupported option for Python target'
                sys.exit(1)
            self._print_python_dependencies(target, 0)
示例#7
0
  def execute(self):
    target = Target.get(self.address)

    if is_java(target):
      if self.is_graph:
        self._print_digraph(target)
      else:
        self._print_dependency_tree(target)
    elif is_python(target):
      if self.is_internal_only or self.is_external_only or self.is_minimal or self.is_graph:
        print >> sys.stderr, 'Unsupported option for Python target'
        sys.exit(1)
      self._print_python_dependencies(target, 0)
示例#8
0
  def console_output(self, targets):
    if len(self.context.target_roots) == 0:
      raise TaskError("One or more target addresses are required.")

    for target in self.context.target_roots:
      if all(self._is_jvm(t) for t in target.resolve() if is_concrete(t)):
        if self.is_graph:
          return self._output_digraph(target)
        else:
          return self._output_dependency_tree(target)
      elif is_python(target):
        raise TaskError('Unsupported for Python targets')
      else:
        raise TaskError('Unsupported for target %s' % target)
示例#9
0
  def console_output(self, unused_method_argument):
    for target in self.context.target_roots:
      if all(self._is_jvm(t) for t in target.resolve() if is_concrete(t)):
        for line in self._dependencies_list(target):
          yield line

      elif is_python(target):
        if self.is_internal_only:
          raise TaskError('Unsupported option for Python target: is_internal_only: %s' %
                          self.is_internal_only)
        if self.is_external_only:
          raise TaskError('Unsupported option for Python target: is_external_only: %s' %
                          self.is_external_only)
        for line in self._python_dependencies_list(target):
          yield line
示例#10
0
  def execute(self):
    print("Build operating on targets: %s" % self.targets)

    python_targets = OrderedSet()
    for target in self.targets:
      if is_python(target):
        python_targets.add(target)
      else:
        self.error("Cannot build target %s" % target)

    if python_targets:
      status = self._python_build(python_targets)
    else:
      status = -1

    return status
示例#11
0
  def execute(self):
    print("Build operating on targets: %s" % self.targets)

    python_targets = OrderedSet()
    for target in self.targets:
      if is_python(target):
        python_targets.add(target)
      else:
        self.error("Cannot build target %s" % target)

    if python_targets:
      status = self._python_build(python_targets)
    else:
      status = -1

    return status
示例#12
0
    def console_output(self, targets):
        if len(self.context.target_roots) == 0:
            raise TaskError("One or more target addresses are required.")

        for target in self.context.target_roots:
            if all(
                    self._is_jvm(t) for t in target.resolve()
                    if is_concrete(t)):
                if self.is_graph:
                    return self._output_digraph(target)
                else:
                    return self._output_dependency_tree(target)
            elif is_python(target):
                raise TaskError('Unsupported for Python targets')
            else:
                raise TaskError('Unsupported for target %s' % target)
示例#13
0
    def build(self, targets, args, conn_timeout=None):
        test_targets = []
        binary_targets = []

        for target in targets:
            assert is_python(
                target
            ), "PythonBuilder can only build PythonTargets, given %s" % str(
                target)

        if 'pylint' in args:
            real_args = list(args)
            real_args.remove('pylint')
            for target in targets:
                try:
                    PythonLintBuilder([target],
                                      real_args,
                                      self.root_dir,
                                      conn_timeout=conn_timeout).run()
                except Exception as e:
                    print('Failed to run lint for %s: %s' % (target, e))
            return 0

        # PythonBuilder supports PythonTests and PythonBinaries
        for target in targets:
            if isinstance(target, PythonTests) or isinstance(
                    target, PythonTestSuite):
                test_targets.append(target)
            elif isinstance(target, PythonBinary):
                binary_targets.append(target)

        rv = PythonTestBuilder(test_targets,
                               args,
                               self.root_dir,
                               conn_timeout=conn_timeout).run()
        if rv != 0: return rv

        for binary_target in binary_targets:
            rv = PythonBinaryBuilder(binary_target,
                                     args,
                                     self.root_dir,
                                     conn_timeout=conn_timeout).run()
            if rv != 0: return rv

        return 0
示例#14
0
    def console_output(self, unused_method_argument):
        for target in self.context.target_roots:
            if all(
                    self._is_jvm(t) for t in target.resolve()
                    if is_concrete(t)):
                for line in self._dependencies_list(target):
                    yield line

            elif is_python(target):
                if self.is_internal_only:
                    raise TaskError(
                        'Unsupported option for Python target: is_internal_only: %s'
                        % self.is_internal_only)
                if self.is_external_only:
                    raise TaskError(
                        'Unsupported option for Python target: is_external_only: %s'
                        % self.is_external_only)
                for line in self._python_dependencies_list(target):
                    yield line
示例#15
0
文件: build.py 项目: adamsxu/commons
  def execute(self):
    print("Build operating on targets: %s" % self.targets)

    jvm_targets = OrderedSet()
    python_targets = OrderedSet()
    for target in self.targets:
      targets = list(extract_jvm_targets([target]))
      if targets:
        jvm_targets.update(targets)
      elif is_python(target):
        python_targets.add(target)
      else:
        self.error("Cannot build target %s" % target)

    if jvm_targets:
      status = self._jvm_build(jvm_targets)
      if status != 0:
        return status

    if python_targets:
      status = self._python_build(python_targets)

    return status
示例#16
0
文件: build.py 项目: cscotta/commons
    def execute(self):
        print "Build operating on targets: %s" % self.targets

        jvm_targets = OrderedSet()
        python_targets = OrderedSet()
        for target in self.targets:
            targets = list(extract_jvm_targets([target]))
            if targets:
                jvm_targets.update(targets)
            elif is_python(target):
                python_targets.add(target)
            else:
                self.error("Cannot build target %s" % target)

        if jvm_targets:
            status = self._jvm_build(jvm_targets)
            if status != 0:
                return status

        if python_targets:
            status = self._python_build(python_targets)

        return status