Skip to content

Commit

Permalink
Work around multi-python pex issues for checker. (pantsbuild#7178)
Browse files Browse the repository at this point in the history
PEX does not support multi-python pexes in-general and in-particular it
cannot properly build a pex for a py2/3 compatible sdist today. Work
around this limitation by removing future (which is distributed as an
sdist) from the checker deps.

Hack to workaround pantsbuild#7158
  • Loading branch information
jsirois authored Jan 29, 2019
1 parent 4d6864e commit 097e19e
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ python_library(
}
),
dependencies=[
'3rdparty/python:future',
'3rdparty/python:pycodestyle',
'3rdparty/python:pyflakes',
'3rdparty/python:six',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
from __future__ import absolute_import, division, print_function, unicode_literals

import ast
import io
import itertools
import os
import re
import textwrap
import tokenize
from builtins import object, open
from io import StringIO

import six

Expand Down Expand Up @@ -139,7 +138,7 @@ def parse(cls, filename, root=None):
else:
full_filename = filename

with open(full_filename, 'rb') as fp:
with io.open(full_filename, 'rb') as fp:
blob = fp.read()

tree = cls._parse(blob, filename)
Expand All @@ -165,7 +164,7 @@ def iter_tokens(cls, blob):
:param blob: Input string with python file contents
:return: token iterator
"""
readline_func = StringIO(blob.decode('utf-8')).readline
readline_func = io.StringIO(blob.decode('utf-8')).readline
return tokenize.generate_tokens(readline_func)

@property
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import ast

from future.utils import PY3
from six import PY3

from pants.contrib.python.checks.checker.common import CheckstylePlugin

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

from __future__ import absolute_import, division, print_function, unicode_literals

import io
import os
import re
from builtins import object, open


class FileExcluder(object):
Expand All @@ -15,7 +15,7 @@ def __init__(self, excludes_path, log):
if excludes_path:
if not os.path.exists(excludes_path):
raise ValueError('Excludes file does not exist: {0}'.format(excludes_path))
with open(excludes_path, 'r') as fh:
with io.open(excludes_path, 'r') as fh:
for line in fh.readlines():
if line and not line.startswith('#') and '::' in line:
pattern, plugins = line.strip().split('::', 2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import ast
import os
from builtins import object
from distutils import sysconfig

from pants.contrib.python.checks.checker.common import CheckstylePlugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import ast

from future.utils import PY3
from six import PY3

from pants.contrib.python.checks.checker.common import CheckstylePlugin

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import ast
import re

from future.utils import PY3
from six import PY3

from pants.contrib.python.checks.checker.common import CheckstylePlugin

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@

import sys
import tokenize
from builtins import range
from collections import defaultdict

from six.moves import range

from pants.contrib.python.checks.checker.common import CheckstylePlugin


Expand Down

0 comments on commit 097e19e

Please sign in to comment.