diff --git a/.pylintrc b/.pylintrc index 4dc386d32..4e1bc8083 100644 --- a/.pylintrc +++ b/.pylintrc @@ -17,7 +17,7 @@ jobs=0 # --enable=similarities". If you want to run only the classes checker, but have # no Warning level messages displayed, use"--disable=all --enable=classes # --disable=W" -disable=redefined-builtin,C0330,duplicate-code,logging-format-interpolation,line-too-long,implicit-str-concat,logging-fstring-interpolation +disable=redefined-builtin,C0330,duplicate-code,logging-format-interpolation,line-too-long,implicit-str-concat,logging-fstring-interpolation,unsubscriptable-object,inherit-non-class [REPORTS] diff --git a/CHANGELOG.md b/CHANGELOG.md index 501a87cae..52b4938bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,13 @@ The versions follow [semantic versioning](https://semver.org). ### Security --> +## Unreleased - YYYY-MM-DD + +### Fixed + +- Declared dependency on `python-debian <= 0.1.38`. Later versions of the + dependency do not import on Windows. + ## 0.12.1 - 2020-12-17 ### Fixed diff --git a/Makefile b/Makefile index 88aececfc..dd140d90a 100644 --- a/Makefile +++ b/Makefile @@ -53,7 +53,7 @@ blackcheck: ## check with black .PHONY: black black: ## format with black - isort -y -s build -s dist + isort src/ tests/ *.py black . .PHONY: reuse diff --git a/requirements-dev.txt b/requirements-dev.txt index 3078c16fa..24e251618 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -4,22 +4,22 @@ -r requirements.txt -recommonmark==0.6.0 -sphinx_rtd_theme==0.4.3 -sphinx-autodoc-typehints==1.10.3 -sphinx==3.0.4 +recommonmark==0.7.1 +sphinx==3.4.3 +sphinx-autodoc-typehints==1.11.1 +sphinx-rtd-theme==0.5.1 sphinxcontrib-apidoc==0.3.0 -black==19.10b0 -isort==4.3.21 -pylint==2.5.2 +black==20.8b1 +isort==5.7.0 +pylint==2.6.0 -pytest-cov==2.9.0 -pytest==5.4.2 -tox==3.15.1 +pytest==6.2.2 +pytest-cov==2.11.1 +tox==3.21.2 -bump2version==1.0.0 -pre-commit==2.4.0 -twine==3.1.1 +bump2version==1.0.1 +pre-commit==2.9.3 +twine==3.3.0 -wheel==0.34.2 +wheel==0.36.2 diff --git a/requirements.txt b/requirements.txt index f80356e22..bbe6266f3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,5 +9,5 @@ license-expression==1.2 python-debian==0.1.38 requests==2.25.1 -setuptools==51.0.0 +setuptools==52.0.0 setuptools-scm==5.0.1 diff --git a/setup.py b/setup.py index 72a54666e..76ce3b2f0 100644 --- a/setup.py +++ b/setup.py @@ -15,8 +15,8 @@ from setuptools.command.build_py import build_py requirements = [ - # For parsing .reuse/dep5. - "python-debian", + # For parsing .reuse/dep5. TODO: Later versions do not work on Windows. + "python-debian <= 0.1.38", # For downloading from spdx/spdx-license-list-data. Could maybe use # standard library instead? "requests", diff --git a/src/reuse/_util.py b/src/reuse/_util.py index eca18c2af..bae01bf12 100644 --- a/src/reuse/_util.py +++ b/src/reuse/_util.py @@ -287,18 +287,20 @@ def __call__(self, string): if not path.exists() and os.access(path.parent, os.W_OK): return path raise ArgumentTypeError(_("can't write to '{}'").format(path)) - except OSError: - raise ArgumentTypeError(_("can't read or write '{}'").format(path)) + except OSError as error: + raise ArgumentTypeError( + _("can't read or write '{}'").format(path) + ) from error def spdx_identifier(text: str) -> Expression: """argparse factory for creating SPDX expressions.""" try: return _LICENSING.parse(text) - except (ExpressionError, ParseError): + except (ExpressionError, ParseError) as error: raise ArgumentTypeError( _("'{}' is not a valid SPDX expression, aborting").format(text) - ) + ) from error def similar_spdx_identifiers(identifier: str) -> List[str]: diff --git a/src/reuse/header.py b/src/reuse/header.py index e54f4bd20..d84c94fc8 100644 --- a/src/reuse/header.py +++ b/src/reuse/header.py @@ -61,7 +61,7 @@ _NEWLINE_PATTERN = re.compile(r"\n", re.MULTILINE) -class _TextSections(NamedTuple): +class _TextSections(NamedTuple): # pylint: disable=too-few-public-methods """Used to split up text in three parts.""" before: str diff --git a/src/reuse/report.py b/src/reuse/report.py index 4bd71b2d0..977532c88 100644 --- a/src/reuse/report.py +++ b/src/reuse/report.py @@ -46,7 +46,9 @@ def __call__(self, file_): return _MultiprocessingResult(file_, None, exc) -class _MultiprocessingResult(NamedTuple): +class _MultiprocessingResult( + NamedTuple +): # pylint: disable=too-few-public-methods """Result of :class:`MultiprocessingContainer`.""" path: PathLike diff --git a/tests/test_comment.py b/tests/test_comment.py index e33f78dd3..be2775fad 100644 --- a/tests/test_comment.py +++ b/tests/test_comment.py @@ -83,8 +83,7 @@ def test_parse_comment_generic_multi(Style): def test_base_class_throws_errors(): - """When trying to do much of anything with the base class, expect errors. - """ + """When trying to do much of anything with the base class, expect errors.""" with pytest.raises(CommentParseError): CommentStyle.parse_comment("hello") with pytest.raises(CommentCreateError): @@ -166,8 +165,7 @@ def test_create_comment_python_force_multi(): def test_parse_comment_python_strip_newlines(): - """When given a comment, remove newlines before and after before parsing. - """ + """When given a comment, remove newlines before and after before parsing.""" text = dedent( """ diff --git a/tests/test_download.py b/tests/test_download.py index a5c2140db..4a130eeaf 100644 --- a/tests/test_download.py +++ b/tests/test_download.py @@ -39,8 +39,7 @@ def test_download_404(monkeypatch): def test_download_exception(monkeypatch): - """If requests raises an exception itself, that exception is not escaped. - """ + """If requests raises an exception itself, that exception is not escaped.""" def raise_exception(_): raise requests.RequestException() diff --git a/tests/test_header.py b/tests/test_header.py index fe45586a1..85fb8d98b 100644 --- a/tests/test_header.py +++ b/tests/test_header.py @@ -340,8 +340,7 @@ def test_find_and_replace_separate_shebang(): def test_find_and_replace_only_shebang(): - """When the file only contains a shebang, keep it at the top of the file. - """ + """When the file only contains a shebang, keep it at the top of the file.""" spdx_info = SpdxInfo({"GPL-3.0-or-later"}, set()) text = cleandoc( """