9 buildPythonPackage rec {
10 pname = "sudachidict-${sudachidict.dict-type}";
11 inherit (sudachidict) version meta;
14 src = fetchFromGitHub {
15 owner = "WorksApplications";
17 rev = "refs/tags/v${version}";
18 hash = "sha256-axa7eQ0jTo8GXJA5lwcvMyZLw9T573yeSo9xuvIm/gY=";
21 sourceRoot = "${src.name}/python";
23 # setup script tries to get data from the network but we use the nixpkgs' one
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}
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
41 install -Dm644 ${sudachidict}/share/system.dic -t sudachidict_${sudachidict.dict-type}/resources
42 touch sudachidict_${sudachidict.dict-type}/__init__.py