pyenchant: Fix for darwin/macOS
This allows pyenchant to be installable on macOS again, which, in turn, will allow pylint to also be installable. * Switches dependencies to enchant-2 (enchant-1 is not building on macOS). The existing $src (2.0.0) already has compatibility with enchant-2. * Improves patch hack by hijacking the $PYENCHANT_LIBRARY_PATH envvar lookup to explicitly specify the correct library path.
This commit is contained in:
parent
ef9939e36f
commit
2bf75af84a
@ -1,7 +1,7 @@
|
|||||||
{ stdenv
|
{ stdenv
|
||||||
, buildPythonPackage
|
, buildPythonPackage
|
||||||
, fetchPypi
|
, fetchPypi
|
||||||
, pkgs
|
, enchant2
|
||||||
}:
|
}:
|
||||||
|
|
||||||
buildPythonPackage rec {
|
buildPythonPackage rec {
|
||||||
@ -13,15 +13,21 @@ buildPythonPackage rec {
|
|||||||
sha256 = "fc31cda72ace001da8fe5d42f11c26e514a91fa8c70468739216ddd8de64e2a0";
|
sha256 = "fc31cda72ace001da8fe5d42f11c26e514a91fa8c70468739216ddd8de64e2a0";
|
||||||
};
|
};
|
||||||
|
|
||||||
propagatedBuildInputs = [ pkgs.enchant1 ];
|
propagatedBuildInputs = [ enchant2 ];
|
||||||
|
|
||||||
patchPhase = let
|
postPatch = let
|
||||||
path_hack_script = "s|LoadLibrary(e_path)|LoadLibrary('${pkgs.enchant1}/lib/' + e_path)|";
|
libext = stdenv.hostPlatform.extensions.sharedLibrary;
|
||||||
in ''
|
in ''
|
||||||
sed -i "${path_hack_script}" enchant/_enchant.py
|
# Use the $PYENCHANT_LIBRARY_PATH envvar lookup line to hard-code the
|
||||||
|
# location of the nix enchant-2 library into _enchant.py.
|
||||||
# They hardcode a bad path for Darwin in their library search code
|
#
|
||||||
substituteInPlace enchant/_enchant.py --replace '/opt/local/lib/' ""
|
# 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/' ""
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# dictionaries needed for tests
|
# dictionaries needed for tests
|
||||||
@ -31,7 +37,6 @@ buildPythonPackage rec {
|
|||||||
description = "pyenchant: Python bindings for the Enchant spellchecker";
|
description = "pyenchant: Python bindings for the Enchant spellchecker";
|
||||||
homepage = https://github.com/pyenchant/pyenchant;
|
homepage = https://github.com/pyenchant/pyenchant;
|
||||||
license = licenses.lgpl21;
|
license = licenses.lgpl21;
|
||||||
badPlatforms = [ "x86_64-darwin" ];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4834,7 +4834,7 @@ in {
|
|||||||
|
|
||||||
pyelftools = callPackage ../development/python-modules/pyelftools { };
|
pyelftools = callPackage ../development/python-modules/pyelftools { };
|
||||||
|
|
||||||
pyenchant = callPackage ../development/python-modules/pyenchant { };
|
pyenchant = callPackage ../development/python-modules/pyenchant { enchant2 = pkgs.enchant2; };
|
||||||
|
|
||||||
pyexcelerator = callPackage ../development/python-modules/pyexcelerator { };
|
pyexcelerator = callPackage ../development/python-modules/pyexcelerator { };
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user