2018-10-26 14:30:06 +01:00
|
|
|
{ stdenv
|
|
|
|
, buildPythonPackage
|
2020-05-11 19:55:14 +01:00
|
|
|
, isPy27
|
2018-10-26 14:30:06 +01:00
|
|
|
, fetchPypi
|
2020-01-23 01:14:52 +00:00
|
|
|
, enchant2
|
2018-10-26 14:30:06 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pyenchant";
|
2020-06-05 18:44:36 +01:00
|
|
|
version = "3.1.1";
|
2020-05-11 19:55:14 +01:00
|
|
|
disabled = isPy27;
|
2018-10-26 14:30:06 +01:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2020-06-05 18:44:36 +01:00
|
|
|
sha256 = "ce0915d7acd771fde6e8c2dce8ad0cb0e6f7c4fa8430cc96e3e7134e99aeb12f";
|
2018-10-26 14:30:06 +01:00
|
|
|
};
|
|
|
|
|
2020-01-23 01:14:52 +00:00
|
|
|
propagatedBuildInputs = [ enchant2 ];
|
2018-10-26 14:30:06 +01:00
|
|
|
|
2020-01-23 01:14:52 +00:00
|
|
|
postPatch = let
|
|
|
|
libext = stdenv.hostPlatform.extensions.sharedLibrary;
|
2018-10-26 14:30:06 +01:00
|
|
|
in ''
|
2020-01-23 01:14:52 +00:00
|
|
|
# Use the $PYENCHANT_LIBRARY_PATH envvar lookup line to hard-code the
|
|
|
|
# location of the nix enchant-2 library into _enchant.py.
|
|
|
|
#
|
|
|
|
# Also, they hardcode a bad path for Darwin in their library search code;
|
|
|
|
# This code should never be hit, but in case it does, we don't want to have
|
|
|
|
# it "accidentally" work by pulling something from /opt.
|
|
|
|
substituteInPlace enchant/_enchant.py \
|
|
|
|
--replace 'os.environ.get("PYENCHANT_LIBRARY_PATH")' \
|
|
|
|
"'${enchant2}/lib/libenchant-2${libext}'" \
|
|
|
|
--replace '/opt/local/lib/' ""
|
2018-10-26 14:30:06 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
# dictionaries needed for tests
|
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "pyenchant: Python bindings for the Enchant spellchecker";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://github.com/pyenchant/pyenchant";
|
2018-10-26 14:30:06 +01:00
|
|
|
license = licenses.lgpl21;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|