Example #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
Example #2
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
Example #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
Example #4
0
 def go_dist(self):
     return GoDistribution.scoped_instance(self)
Example #5
0
 def subsystem_dependencies(cls):
     return super().subsystem_dependencies() + (
         GoDistribution.scoped(cls), )
Example #6
0
 def go_dist(self):
   return GoDistribution.scoped_instance(self)
Example #7
0
 def subsystem_dependencies(cls):
   return super(GoTask, cls).subsystem_dependencies() + (GoDistribution.scoped(cls),)