Skip to content

Commit

Permalink
Merge pull request #37 from cfournie/wheel
Browse files Browse the repository at this point in the history
Universal wheel support
  • Loading branch information
cfournie committed Feb 6, 2017
2 parents 6a7924f + 297e237 commit 212d20d
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 21 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ htmlcov
.coverage
*.swp
MANIFEST
dist
dist/
build/
2 changes: 1 addition & 1 deletion constraints.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pip<=4
pip<=7
click<=3
1 change: 1 addition & 0 deletions dev_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ pylint # Linting
autopep8 # Autolinting
ipdb # Interactive debugger
ipython # Interactive shell
wheel # Used to create wheels

# Modules tested
dnspython # Installed as directory `dns`
Expand Down
2 changes: 1 addition & 1 deletion important/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# Use of this source code is governed by a MIT-style license that can be found
# in the LICENSE file.

__version__ = '0.1.1'
__version__ = '0.1.2'
11 changes: 5 additions & 6 deletions important/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ def parse_file_imports(filepath, exclusions=None, directory=None):
module, lineno, col_offset = statement
yield Import(module, display_filepath, lineno, col_offset)
except SyntaxError as exc:
LOGGER.warning('Skipping %(filename)s due to syntax error: %(error)s',
filename=exc.filename, error=str(exc))
LOGGER.warning('Skipping %s due to syntax error: %s',
exc.filename, str(exc))
except UnicodeDecodeError as exc:
LOGGER.warning('Skipping %(filename)s due to decode error: %(error)s',
filename=filepath, error=str(exc))
LOGGER.warning('Skipping %s due to decode error: %s',
filepath, str(exc))


def _is_script(filepath):
Expand All @@ -94,8 +94,7 @@ def _is_script(filepath):
return bool(RE_SHEBANG.match(first_line))
except UnicodeDecodeError as exc:
LOGGER.warning(
'Skipping %(filename)s due to decode error: %(error)s',
filename=filepath, error=str(exc))
'Skipping %s due to decode error: %s', filepath, str(exc))
return False


Expand Down
8 changes: 7 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,10 @@ ignore=
flake8
exclude=
.git
sourcecode=.
sourcecode=.

[bdist_wheel]
universal = 1

[metadata]
license_file = LICENSE
11 changes: 9 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
# in the LICENSE file.
import re

from distutils.core import setup
try:
from setuptools import setup
except:
from distutils.core import setup

with open('README.rst') as fh:
long_description = fh.read()
Expand Down Expand Up @@ -48,5 +51,9 @@
'important = important.__main__:check',
],
},
install_requires=['pip>=8', 'click>=5'],
install_requires=[
'pip>=8',
'click>=5',
'setuptools>=0.9',
],
)
15 changes: 6 additions & 9 deletions tests/important/test_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,8 @@ def test_file_imports_with_syntax_error(mocker, python_source_file):
# Attempt to parse and assert that it logged a warning
list(parse_file_imports(python_source_file))
logger.warning.assert_called_with(
'Skipping %(filename)s due to syntax error: %(error)s',
filename=python_source_file,
error='invalid syntax (test.py, line 23)'
'Skipping %s due to syntax error: %s', python_source_file,
'invalid syntax (test.py, line 23)'
)


Expand Down Expand Up @@ -75,9 +74,8 @@ def test_file_imports_binary_file(mocker, binary_file, encoding):
# Attempt to parse and assert that it logged a warning
list(parse_file_imports(binary_file))
logger.warning.assert_called_with(
'Skipping %(filename)s due to decode error: %(error)s',
filename=binary_file,
error="'{encoding}' codec can't decode byte 0xff in position 0:\
'Skipping %s due to decode error: %s', binary_file,
"'{encoding}' codec can't decode byte 0xff in position 0:\
invalid start byte".format(encoding=encoding)
)

Expand All @@ -91,9 +89,8 @@ def test_is_script_binary_file(mocker, binary_file, encoding):
# Attempt to parse and assert that it logged a warning
_is_script(binary_file)
logger.warning.assert_called_with(
'Skipping %(filename)s due to decode error: %(error)s',
filename=binary_file,
error="'{encoding}' codec can't decode byte 0xff in position 0:\
'Skipping %s due to decode error: %s', binary_file,
"'{encoding}' codec can't decode byte 0xff in position 0:\
invalid start byte".format(encoding=encoding)
)

Expand Down

0 comments on commit 212d20d

Please sign in to comment.