summary refs log tree commit diff
diff options
context:
space:
mode:
authorRobert Schütz <nix@dotlambda.de>2022-12-19 09:59:48 -0800
committerRobert Schütz <github@dotlambda.de>2023-02-08 14:20:41 -0800
commit5a2b689d2549748e6b4c4e863788d8b5d4ffe7f2 (patch)
treefbdade2d56e9c8a2bf5a4616218d0d54704b0e48
parent72c236b163c28788580c36502ee1d32d518b2f66 (diff)
downloadnixpkgs-5a2b689d2549748e6b4c4e863788d8b5d4ffe7f2.tar
nixpkgs-5a2b689d2549748e6b4c4e863788d8b5d4ffe7f2.tar.gz
nixpkgs-5a2b689d2549748e6b4c4e863788d8b5d4ffe7f2.tar.bz2
nixpkgs-5a2b689d2549748e6b4c4e863788d8b5d4ffe7f2.tar.lz
nixpkgs-5a2b689d2549748e6b4c4e863788d8b5d4ffe7f2.tar.xz
nixpkgs-5a2b689d2549748e6b4c4e863788d8b5d4ffe7f2.tar.zst
nixpkgs-5a2b689d2549748e6b4c4e863788d8b5d4ffe7f2.zip
python310Packages.docformatter: 1.5.0 -> 1.5.1
https://github.com/PyCQA/docformatter/blob/v1.5.1/CHANGELOG.md
-rw-r--r--pkgs/development/python-modules/docformatter/default.nix27
-rw-r--r--pkgs/development/python-modules/docformatter/test-path.patch29
2 files changed, 53 insertions, 3 deletions
diff --git a/pkgs/development/python-modules/docformatter/default.nix b/pkgs/development/python-modules/docformatter/default.nix
index f7be25f6150..0eb7506a2ce 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 00000000000..bd61c0ca829
--- /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)