Skip to content

Commit

Permalink
Port go to py3 (pantsbuild#6139)
Browse files Browse the repository at this point in the history
### Problem

Upgrading go to be compat w/py3

### Solution

Very few, script handled 100% but I did revert a couple of excess lists.
  • Loading branch information
GoingTharn authored and Stu Hood committed Jul 17, 2018
1 parent 6c41ecf commit 68bbe91
Show file tree
Hide file tree
Showing 15 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -29,3 +29,4 @@ At a minimum, pants requires the following to run properly:
Additionally, if you use the jvm backend to work with java or scala code (installed by default):

* OpenJDK or Oracle JDK version 7 or greater

1 change: 1 addition & 0 deletions contrib/go/src/python/pants/contrib/go/subsystems/BUILD
Expand Up @@ -3,6 +3,7 @@

python_library(
dependencies=[
'3rdparty/python:future',
'3rdparty/python:requests',
'3rdparty/python:pyopenssl',
'3rdparty/python:six',
Expand Down
Expand Up @@ -5,6 +5,7 @@
from __future__ import absolute_import, division, print_function, unicode_literals

import os
from builtins import str
from collections import OrderedDict, namedtuple

from pants.base.workunit import WorkUnit, WorkUnitLabel
Expand Down
1 change: 1 addition & 0 deletions contrib/go/src/python/pants/contrib/go/targets/BUILD
@@ -1,5 +1,6 @@
python_library(
dependencies=[
'3rdparty/python:future',
'src/python/pants/base:build_environment',
'src/python/pants/base:deprecated',
'src/python/pants/base:exceptions',
Expand Down
Expand Up @@ -5,6 +5,7 @@
from __future__ import absolute_import, division, print_function, unicode_literals

import os
from builtins import str

from pants.base.exceptions import TargetDefinitionException
from pants.base.payload import Payload
Expand Down
1 change: 1 addition & 0 deletions contrib/go/src/python/pants/contrib/go/tasks/BUILD
Expand Up @@ -4,6 +4,7 @@
python_library(
sources=globs('*.py'), # Need explicit sources, because `go_test.py` won't match the default.
dependencies=[
'3rdparty/python:future',
'3rdparty/python/twitter/commons:twitter.common.collections',
'3rdparty/python:ansicolors',
'contrib/go/src/python/pants/contrib/go/subsystems',
Expand Down
Expand Up @@ -5,6 +5,7 @@
from __future__ import absolute_import, division, print_function, unicode_literals

import hashlib
from builtins import str

from pants.base.fingerprint_strategy import FingerprintStrategy

Expand Down
3 changes: 2 additions & 1 deletion contrib/go/src/python/pants/contrib/go/tasks/go_buildgen.py
Expand Up @@ -5,6 +5,7 @@
from __future__ import absolute_import, division, print_function, unicode_literals

import os
from builtins import object, str
from collections import defaultdict, namedtuple
from textwrap import dedent

Expand Down Expand Up @@ -61,7 +62,7 @@ def generate(self, local_go_targets):
for local_go_target in local_go_targets:
deps = self._list_deps(gopath, local_go_target.address)
self._generate_missing(gopath, local_go_target.address, deps, visited)
return visited.items()
return list(visited.items())

def _generate_missing(self, gopath, local_address, import_listing, visited):
target_type = GoBinary if import_listing.pkg_name == 'main' else GoLibrary
Expand Down
1 change: 1 addition & 0 deletions contrib/go/src/python/pants/contrib/go/tasks/go_task.py
Expand Up @@ -6,6 +6,7 @@

import json
import re
from builtins import object, str
from collections import namedtuple

from pants.base.workunit import WorkUnit, WorkUnitLabel
Expand Down
2 changes: 2 additions & 0 deletions contrib/go/src/python/pants/contrib/go/tasks/go_test.py
Expand Up @@ -4,6 +4,8 @@

from __future__ import absolute_import, division, print_function, unicode_literals

from builtins import filter

from pants.base.exceptions import TaskError
from pants.base.workunit import WorkUnitLabel

Expand Down
Expand Up @@ -5,6 +5,7 @@
from __future__ import absolute_import, division, print_function, unicode_literals

import os
from builtins import zip
from itertools import chain

from pants.base.build_environment import get_buildroot
Expand Down
Expand Up @@ -15,6 +15,7 @@ python_tests(
name='go_distribution',
sources=['test_go_distribution.py'],
dependencies=[
'3rdparty/python:future',
'contrib/go/src/python/pants/contrib/go/subsystems',
'src/python/pants/util:contextutil',
'src/python/pants/util:process_handler',
Expand Down
Expand Up @@ -6,6 +6,7 @@

import os
import unittest
from builtins import str

from pants.util.contextutil import environment_as
from pants.util.process_handler import subprocess
Expand Down
1 change: 1 addition & 0 deletions contrib/go/tests/python/pants_test/contrib/go/tasks/BUILD
Expand Up @@ -4,6 +4,7 @@
python_tests(
sources = globs('*.py', exclude=[globs('*_integration.py')]),
dependencies=[
'3rdparty/python:future',
'contrib/go/src/python/pants/contrib/go/subsystems',
'contrib/go/src/python/pants/contrib/go/targets',
'contrib/go/src/python/pants/contrib/go/tasks',
Expand Down
Expand Up @@ -5,6 +5,7 @@
from __future__ import absolute_import, division, print_function, unicode_literals

import types
from builtins import object
from textwrap import dedent

from pants.build_graph.target import Target
Expand Down

0 comments on commit 68bbe91

Please sign in to comment.