コード例 #1
0
  def select(self, context):
    self.get_options()
    workdir = os.path.join(self.get_options().pants_workdir, self.options_scope,
                           'versions', self.get_options().version)
    tool_path = os.path.join(workdir, 'bin/protoc-gen-go')

    if not os.path.exists(tool_path):
      safe_mkdir(workdir, clean=True)

      # Checkout the git repo at a given version. `go get` always gets master.
      repo = Git.clone('https://github.com/golang/protobuf.git',
                       os.path.join(workdir, 'src/github.com/golang/protobuf'))
      repo.set_state(self.get_options().version)

      go = GoDistribution.global_instance()
      result, go_cmd = go.execute_go_cmd(
        cmd='install',
        gopath=workdir,
        args=['github.com/golang/protobuf/protoc-gen-go'],
        workunit_factory=context.new_workunit,
        workunit_labels=[WorkUnitLabel.BOOTSTRAP],
      )

      if result != 0:
        raise SubsystemError('{} failed with exit code {}'.format(go_cmd, result))

    logger.info('Selected {} binary bootstrapped to: {}'.format(self.options_scope, tool_path))
    return tool_path
コード例 #2
0
ファイル: protoc_gen_go.py プロジェクト: cosmicexplorer/pants
  def select(self, context):
    self.get_options()
    workdir = os.path.join(self.get_options().pants_workdir, self.options_scope,
                           'versions', self.get_options().version)
    tool_path = os.path.join(workdir, 'bin/protoc-gen-go')

    if not os.path.exists(tool_path):
      safe_mkdir(workdir, clean=True)

      # Checkout the git repo at a given version. `go get` always gets master.
      repo = Git.clone('https://github.com/golang/protobuf.git',
                       os.path.join(workdir, 'src/github.com/golang/protobuf'))
      repo.set_state(self.get_options().version)

      go = GoDistribution.global_instance()
      result, go_cmd = go.execute_go_cmd(
        cmd='install',
        gopath=workdir,
        args=['github.com/golang/protobuf/protoc-gen-go'],
        workunit_factory=context.new_workunit,
        workunit_labels=[WorkUnitLabel.BOOTSTRAP],
      )

      if result != 0:
        raise SubsystemError('{} failed with exit code {}'.format(go_cmd, result))

    logger.info('Selected {} binary bootstrapped to: {}'.format(self.options_scope, tool_path))
    return tool_path
コード例 #3
0
    def select(self, context):
        self.get_options()
        workdir = os.path.join(
            self.get_options().pants_workdir,
            self.options_scope,
            "versions",
            self.get_options().version,
        )
        tool_path = os.path.join(workdir, "bin/protoc-gen-go")

        if not os.path.exists(tool_path):
            safe_mkdir(workdir, clean=True)

            # Checkout the git repo at a given version. `go get` always gets master.
            repo = Git.clone(
                "https://github.com/golang/protobuf.git",
                os.path.join(workdir, "src/github.com/golang/protobuf"),
            )
            repo.set_state(self.get_options().version)

            go = GoDistribution.global_instance()
            result, go_cmd = go.execute_go_cmd(
                cmd="install",
                gopath=workdir,
                args=["github.com/golang/protobuf/protoc-gen-go"],
                workunit_factory=context.new_workunit,
                workunit_labels=[WorkUnitLabel.BOOTSTRAP],
            )

            if result != 0:
                raise SubsystemError(
                    f"{go_cmd} failed with exit code {result}")

        logger.info(
            f"Selected {self.options_scope} binary bootstrapped to: {tool_path}"
        )
        return tool_path
コード例 #4
0
ファイル: go_task.py プロジェクト: mpopenko-exos/pants
 def go_dist(self):
     return GoDistribution.scoped_instance(self)
コード例 #5
0
ファイル: go_task.py プロジェクト: mpopenko-exos/pants
 def subsystem_dependencies(cls):
     return super().subsystem_dependencies() + (
         GoDistribution.scoped(cls), )
コード例 #6
0
ファイル: go_task.py プロジェクト: foursquare/pants
 def go_dist(self):
   return GoDistribution.scoped_instance(self)
コード例 #7
0
ファイル: go_task.py プロジェクト: foursquare/pants
 def subsystem_dependencies(cls):
   return super(GoTask, cls).subsystem_dependencies() + (GoDistribution.scoped(cls),)