2020-08-27 11:40:10 +01:00
|
|
|
{ stdenv, lib
|
|
|
|
, buildPythonPackage, fetchPypi, pythonOlder, setuptools_scm, pytestCheckHook
|
|
|
|
, aiohttp
|
|
|
|
, aiohttp-cors
|
|
|
|
, appdirs
|
|
|
|
, attrs
|
|
|
|
, click
|
2020-12-11 02:20:58 +00:00
|
|
|
, dataclasses
|
2020-08-27 11:40:10 +01:00
|
|
|
, mypy-extensions
|
|
|
|
, pathspec
|
|
|
|
, regex
|
|
|
|
, toml
|
|
|
|
, typed-ast
|
|
|
|
, typing-extensions }:
|
2018-04-05 08:11:53 +01:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "black";
|
2020-08-27 11:40:10 +01:00
|
|
|
version = "20.8b1";
|
2018-04-05 08:11:53 +01:00
|
|
|
|
|
|
|
disabled = pythonOlder "3.6";
|
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2020-08-27 11:40:10 +01:00
|
|
|
sha256 = "1spv6sldp3mcxr740dh3ywp25lly9s8qlvs946fin44rl1x5a0hw";
|
2018-04-05 08:11:53 +01:00
|
|
|
};
|
|
|
|
|
2019-11-09 10:24:18 +00:00
|
|
|
nativeBuildInputs = [ setuptools_scm ];
|
2018-07-23 16:45:58 +01:00
|
|
|
|
2019-06-24 15:13:43 +01:00
|
|
|
# Necessary for the tests to pass on Darwin with sandbox enabled.
|
|
|
|
# Black starts a local server and needs to bind a local address.
|
|
|
|
__darwinAllowLocalNetworking = true;
|
|
|
|
|
2020-08-27 11:40:10 +01:00
|
|
|
checkInputs = [ pytestCheckHook ];
|
|
|
|
|
|
|
|
preCheck = ''
|
|
|
|
export PATH="$PATH:$out/bin"
|
2018-07-23 16:45:58 +01:00
|
|
|
'';
|
|
|
|
|
2020-08-27 11:40:10 +01:00
|
|
|
disabledTests = [
|
|
|
|
# Don't know why these tests fails
|
|
|
|
"test_cache_multiple_files"
|
|
|
|
"test_failed_formatting_does_not_get_cached"
|
|
|
|
# requires network access
|
|
|
|
"test_gen_check_output"
|
|
|
|
"test_process_queue"
|
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
# fails on darwin
|
|
|
|
"test_expression_diff"
|
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
aiohttp
|
|
|
|
aiohttp-cors
|
|
|
|
appdirs
|
|
|
|
attrs
|
|
|
|
click
|
|
|
|
mypy-extensions
|
|
|
|
pathspec
|
|
|
|
regex
|
|
|
|
toml
|
|
|
|
typed-ast
|
|
|
|
typing-extensions
|
2020-12-11 02:20:58 +00:00
|
|
|
] ++ lib.optional (pythonOlder "3.7") dataclasses;
|
2018-04-05 08:11:53 +01:00
|
|
|
|
2020-08-27 11:40:10 +01:00
|
|
|
meta = with lib; {
|
2018-04-05 08:11:53 +01:00
|
|
|
description = "The uncompromising Python code formatter";
|
2020-04-30 01:06:34 +01:00
|
|
|
homepage = "https://github.com/psf/black";
|
2020-08-27 11:40:10 +01:00
|
|
|
changelog = "https://github.com/psf/black/blob/${version}/CHANGES.md";
|
2018-04-05 08:11:53 +01:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ sveitser ];
|
|
|
|
};
|
|
|
|
}
|