1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, fetchpatch
5, glibcLocales
6, pycodestyle
7, pytestCheckHook
8, pythonOlder
9, tomli
10}:
11
12buildPythonPackage rec {
13 pname = "autopep8";
14 version = "2.0.1";
15 format = "setuptools";
16
17 disabled = pythonOlder "3.7";
18
19 src = fetchFromGitHub {
20 owner = "hhatto";
21 repo = "autopep8";
22 rev = "refs/tags/v${version}";
23 hash = "sha256-YEPSsUzJG4MPiiloVAf9m/UiChkhkN0+lK6spycpSvo=";
24 };
25
26 patches = [
27 # Ignore DeprecationWarnings to fix tests on Python 3.11, https://github.com/hhatto/autopep8/pull/665
28 (fetchpatch {
29 name = "ignore-deprecation-warnings.patch";
30 url = "https://github.com/hhatto/autopep8/commit/75b444d7cf510307ef67dc2b757d384b8a241348.patch";
31 hash = "sha256-5hcJ2yAuscvGyI7zyo4Cl3NEFG/fZItQ8URstxhzwzE=";
32 })
33 ];
34
35 propagatedBuildInputs = [
36 pycodestyle
37 ] ++ lib.optionals (pythonOlder "3.11") [
38 tomli
39 ];
40
41 nativeCheckInputs = [
42 glibcLocales
43 pytestCheckHook
44 ];
45
46 LC_ALL = "en_US.UTF-8";
47
48 meta = with lib; {
49 changelog = "https://github.com/hhatto/autopep8/releases/tag/v${version}";
50 description = "A tool that automatically formats Python code to conform to the PEP 8 style guide";
51 homepage = "https://github.com/hhatto/autopep8";
52 license = licenses.mit;
53 maintainers = with maintainers; [ bjornfor ];
54 };
55}