2018-07-23 15:45:58 +00:00
|
|
|
{ stdenv, buildPythonPackage, fetchPypi, pythonOlder
|
2019-04-03 16:09:04 +00:00
|
|
|
, attrs, click, toml, appdirs, aiohttp, aiohttp-cors
|
2019-11-08 15:45:16 +00:00
|
|
|
, glibcLocales, typed-ast, pathspec, regex
|
|
|
|
, setuptools_scm, pytest }:
|
2018-04-05 07:11:53 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "black";
|
2019-11-08 15:45:16 +00:00
|
|
|
version = "19.10b0";
|
2018-04-05 07:11:53 +00:00
|
|
|
|
|
|
|
disabled = pythonOlder "3.6";
|
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2019-11-08 15:45:16 +00:00
|
|
|
sha256 = "0f8mr0yzj78q1dx7v6ggbgfir2wv0n5z2shfbbvfdq7910xbgvf2";
|
2018-04-05 07:11:53 +00:00
|
|
|
};
|
|
|
|
|
2019-11-09 10:24:18 +00:00
|
|
|
nativeBuildInputs = [ setuptools_scm ];
|
2018-07-23 15:45:58 +00:00
|
|
|
checkInputs = [ pytest glibcLocales ];
|
|
|
|
|
2019-06-24 14:13:43 +00: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;
|
|
|
|
|
2019-01-13 20:22:24 +00:00
|
|
|
# Don't know why these tests fails
|
2019-11-14 09:20:00 +00:00
|
|
|
# Disable test_expression_diff, because it fails on darwin
|
2018-07-23 15:45:58 +00:00
|
|
|
checkPhase = ''
|
2019-01-13 20:22:24 +00:00
|
|
|
LC_ALL="en_US.UTF-8" pytest \
|
2019-11-14 09:20:00 +00:00
|
|
|
--deselect tests/test_black.py::BlackTestCase::test_expression_diff \
|
2019-01-13 20:22:24 +00:00
|
|
|
--deselect tests/test_black.py::BlackTestCase::test_cache_multiple_files \
|
|
|
|
--deselect tests/test_black.py::BlackTestCase::test_failed_formatting_does_not_get_cached
|
2018-07-23 15:45:58 +00:00
|
|
|
'';
|
|
|
|
|
2019-11-08 15:45:16 +00:00
|
|
|
propagatedBuildInputs = [ attrs appdirs click toml aiohttp aiohttp-cors pathspec regex typed-ast ];
|
2018-04-05 07:11:53 +00:00
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "The uncompromising Python code formatter";
|
2020-04-30 00:06:34 +00:00
|
|
|
homepage = "https://github.com/psf/black";
|
2018-04-05 07:11:53 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ sveitser ];
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|