evcc: 0.131.4 -> 0.131.5
[NixPkgs.git] / pkgs / development / python-modules / sudachidict / default.nix
blob1677ab1129269ad5980e1151fa07900ebdea5986
2   buildPythonPackage,
3   fetchFromGitHub,
4   sudachidict,
5   setuptools,
6   sudachipy,
7 }:
9 buildPythonPackage rec {
10   pname = "sudachidict-${sudachidict.dict-type}";
11   inherit (sudachidict) version meta;
12   pyproject = true;
14   src = fetchFromGitHub {
15     owner = "WorksApplications";
16     repo = "SudachiDict";
17     rev = "refs/tags/v${version}";
18     hash = "sha256-axa7eQ0jTo8GXJA5lwcvMyZLw9T573yeSo9xuvIm/gY=";
19   };
21   sourceRoot = "${src.name}/python";
23   # setup script tries to get data from the network but we use the nixpkgs' one
24   postPatch = ''
25     substituteInPlace setup.py \
26       --replace 'ZIP_NAME = urlparse(ZIP_URL).path.split("/")[-1]' "" \
27       --replace "not os.path.exists(RESOURCE_DIR)" "False"
28     substituteInPlace INFO.json \
29       --replace "%%VERSION%%" ${version} \
30       --replace "%%DICT_VERSION%%" ${version} \
31       --replace "%%DICT_TYPE%%" ${sudachidict.dict-type}
32   '';
34   nativeBuildInputs = [ setuptools ];
36   propagatedBuildInputs = [ sudachipy ];
38   # we need to prepare some files before the build
39   # https://github.com/WorksApplications/SudachiDict/blob/develop/package_python.sh
40   preBuild = ''
41     install -Dm644 ${sudachidict}/share/system.dic -t sudachidict_${sudachidict.dict-type}/resources
42     touch sudachidict_${sudachidict.dict-type}/__init__.py
43   '';