diff --git a/.gitignore b/.gitignore index 2190c8b..7b27c77 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ htmlcov .coverage *.swp MANIFEST -dist +dist/ +build/ diff --git a/constraints.txt b/constraints.txt index befde82..31d9506 100644 --- a/constraints.txt +++ b/constraints.txt @@ -1,2 +1,2 @@ -pip<=4 +pip<=7 click<=3 diff --git a/dev_requirements.txt b/dev_requirements.txt index a79f5ed..dcf5234 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -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` diff --git a/important/__init__.py b/important/__init__.py index cc0dd6c..41ec1a5 100644 --- a/important/__init__.py +++ b/important/__init__.py @@ -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' diff --git a/important/parse.py b/important/parse.py index aa36ed7..620deef 100644 --- a/important/parse.py +++ b/important/parse.py @@ -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): @@ -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 diff --git a/setup.cfg b/setup.cfg index 4b4d537..dc322b7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -8,4 +8,10 @@ ignore= flake8 exclude= .git -sourcecode=. \ No newline at end of file +sourcecode=. + +[bdist_wheel] +universal = 1 + +[metadata] +license_file = LICENSE diff --git a/setup.py b/setup.py index 54676ca..5aaceef 100644 --- a/setup.py +++ b/setup.py @@ -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() @@ -48,5 +51,9 @@ 'important = important.__main__:check', ], }, - install_requires=['pip>=8', 'click>=5'], + install_requires=[ + 'pip>=8', + 'click>=5', + 'setuptools>=0.9', + ], ) diff --git a/tests/important/test_parse.py b/tests/important/test_parse.py index cbb6418..e9ff8a0 100644 --- a/tests/important/test_parse.py +++ b/tests/important/test_parse.py @@ -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)' ) @@ -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) ) @@ -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) )