diff --git a/pkgs/development/python-modules/docformatter/default.nix b/pkgs/development/python-modules/docformatter/default.nix index f7be25f61509..0eb7506a2ce1 100644 --- a/pkgs/development/python-modules/docformatter/default.nix +++ b/pkgs/development/python-modules/docformatter/default.nix @@ -2,6 +2,9 @@ , buildPythonPackage , pythonOlder , fetchFromGitHub +, poetry-core +, charset-normalizer +, tomli , untokenize , mock , pytestCheckHook @@ -9,20 +12,37 @@ buildPythonPackage rec { pname = "docformatter"; - version = "1.5.0"; + version = "1.5.1"; disabled = pythonOlder "3.6"; - format = "setuptools"; + format = "pyproject"; src = fetchFromGitHub { owner = "PyCQA"; repo = pname; rev = "refs/tags/v${version}"; - hash = "sha256-GSfsM6sPSLOIH0YJYFVTB3SigI62/ps51mA2iZ7GOEg="; + hash = "sha256-r+8FOl9Rrfi3V8f8wD41bRsaqDb+UrOBWuR3goK43xY="; }; + patches = [ + ./test-path.patch + ]; + + postPatch = '' + substituteInPlace pyproject.toml \ + --replace 'charset_normalizer = "^2.0.0"' 'charset_normalizer = ">=2.0.0"' + substituteInPlace tests/conftest.py \ + --subst-var-by docformatter $out/bin/docformatter + ''; + + nativeBuildInputs = [ + poetry-core + ]; + propagatedBuildInputs = [ + charset-normalizer + tomli untokenize ]; @@ -34,6 +54,7 @@ buildPythonPackage rec { pythonImportsCheck = [ "docformatter" ]; meta = { + changelog = "https://github.com/PyCQA/docformatter/blob/${src.rev}/CHANGELOG.md"; description = "Formats docstrings to follow PEP 257"; homepage = "https://github.com/myint/docformatter"; license = lib.licenses.mit; diff --git a/pkgs/development/python-modules/docformatter/test-path.patch b/pkgs/development/python-modules/docformatter/test-path.patch new file mode 100644 index 000000000000..bd61c0ca829b --- /dev/null +++ b/pkgs/development/python-modules/docformatter/test-path.patch @@ -0,0 +1,29 @@ +diff --git a/tests/conftest.py b/tests/conftest.py +index 5f5a9aa..3289222 100644 +--- a/tests/conftest.py ++++ b/tests/conftest.py +@@ -92,21 +92,9 @@ def run_docformatter(arguments, temporary_file): + + Return subprocess object. + """ +- if "DOCFORMATTER_COVERAGE" in os.environ and int( +- os.environ["DOCFORMATTER_COVERAGE"] +- ): +- DOCFORMATTER_COMMAND = [ +- "coverage", +- "run", +- "--branch", +- "--parallel", +- "--omit=*/site-packages/*", +- os.environ["VIRTUAL_ENV"] + "/bin/docformatter", +- ] +- else: +- DOCFORMATTER_COMMAND = [ +- os.environ["VIRTUAL_ENV"] + "/bin/docformatter", +- ] # pragma: no cover ++ DOCFORMATTER_COMMAND = [ ++ "@docformatter@" ++ ] + + if "-" not in arguments: + arguments.append(temporary_file)