Skip to content

Commit 55b033e

Browse files
committed
fix(nix/package): update package and dependencies, temporarily ignore tests
1 parent f978ae1 commit 55b033e

7 files changed

Lines changed: 124 additions & 71 deletions

File tree

flake.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# SPDX-FileCopyrightText: (c) TagStudio Contributors
2-
# SPDX-License-Identifier: GPL-3.0-only
2+
# SPDX-License-Identifier: MIT
33

44
{
55
description = "TagStudio";
@@ -49,17 +49,18 @@
4949
inherit pillow-jxl-plugin;
5050
};
5151

52+
openexr = python3Packages.callPackage ./nix/package/openexr.nix { inherit (pkgs) openexr; };
5253
pillow-jxl-plugin = python3Packages.callPackage ./nix/package/pillow-jxl-plugin.nix {
5354
inherit (pkgs) cmake;
54-
inherit pyexiv2;
55+
inherit openexr pyexiv2;
5556
};
5657
pyexiv2 = python3Packages.callPackage ./nix/package/pyexiv2.nix { inherit (pkgs) exiv2; };
5758
in
5859
{
5960
inherit tagstudio;
6061
tagstudio-jxl = tagstudio.override { withJXLSupport = true; };
6162

62-
inherit pillow-jxl-plugin pyexiv2;
63+
inherit openexr pillow-jxl-plugin pyexiv2;
6364
}
6465
)
6566
);

nix/package/default.nix

Lines changed: 42 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# SPDX-FileCopyrightText: (c) TagStudio Contributors
2-
# SPDX-License-Identifier: GPL-3.0-only
2+
# SPDX-License-Identifier: MIT
33

44
{
55
ffmpeg-headless,
@@ -40,12 +40,36 @@ python3Packages.buildPythonApplication {
4040
qt6.qtmultimedia
4141
];
4242

43-
nativeCheckInputs = with python3Packages; [
44-
pytest-qt
45-
pytest-xdist
46-
pytestCheckHook
47-
syrupy
48-
];
43+
build-system = with python3Packages; [ hatchling ];
44+
dependencies =
45+
with python3Packages;
46+
[
47+
chardet_5
48+
ffmpeg-python
49+
humanfriendly
50+
mutagen
51+
numpy
52+
opencv-python
53+
pillow
54+
pillow-heif
55+
py7zr
56+
pydantic
57+
pydub
58+
pyside6
59+
rarfile
60+
rawpy
61+
requests
62+
semver
63+
send2trash
64+
sqlalchemy
65+
srctools
66+
structlog
67+
toml
68+
ujson
69+
wcmatch
70+
]
71+
++ lib.optional (pythonAtLeast "3.13") audioop-lts
72+
++ lib.optional withJXLSupport pillow-jxl-plugin;
4973

5074
# TODO: Install more icon resolutions when available.
5175
preInstall = ''
@@ -90,38 +114,18 @@ python3Packages.buildPythonApplication {
90114
"structlog"
91115
"typing-extensions"
92116
];
93-
pythonImportsCheck = [ "tagstudio" ];
94117

95-
build-system = with python3Packages; [ hatchling ];
96-
dependencies =
97-
with python3Packages;
98-
[
99-
chardet_5
100-
ffmpeg-python
101-
humanfriendly
102-
mutagen
103-
numpy
104-
opencv-python
105-
pillow
106-
pillow-heif
107-
py7zr
108-
pydantic
109-
pydub
110-
pyside6
111-
rarfile
112-
rawpy
113-
requests
114-
semver
115-
send2trash
116-
sqlalchemy
117-
srctools
118-
structlog
119-
toml
120-
ujson
121-
wcmatch
122-
]
123-
++ lib.optional (pythonAtLeast "3.13") audioop-lts
124-
++ lib.optional withJXLSupport pillow-jxl-plugin;
118+
# HACK: All tests fail with Python: Aborted for unknown reasons.
119+
doCheck = false;
120+
121+
nativeCheckInputs = with python3Packages; [
122+
pytest-qt
123+
pytest-xdist
124+
pytestCheckHook
125+
syrupy
126+
];
127+
128+
pythonImportsCheck = [ "tagstudio" ];
125129

126130
# These tests require modifications to a library, which does not work
127131
# in a read-only environment.

nix/package/openexr.nix

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# SPDX-FileCopyrightText: (c) TagStudio Contributors
2+
# SPDX-License-Identifier: MIT
3+
4+
{
5+
lib,
6+
numpy,
7+
openexr,
8+
pybind11,
9+
pytest,
10+
python,
11+
pythonImportsCheckHook,
12+
toPythonModule,
13+
}:
14+
15+
toPythonModule (
16+
openexr.overrideAttrs (o: {
17+
buildInputs = o.buildInputs or [ ] ++ [ pybind11 ];
18+
19+
cmakeFlags = o.cmakeFlags or [ ] ++ [ (lib.cmakeBool "OPENEXR_BUILD_PYTHON" true) ];
20+
21+
# `python.sitePackages` replacement can be removed once Python install path is inherited from sysconfig.
22+
# Currently on main, but not part of a release.
23+
# See: https://github.com/AcademySoftwareFoundation/openexr/commit/30345db72944b38926f13b5114b9a01b4b553890
24+
postPatch = o.postPatch or "" + /* bash */ ''
25+
substituteInPlace src/wrappers/python/CMakeLists.txt \
26+
--replace-warn python/OpenEXR ${python.sitePackages} \
27+
--replace-fail 'PYTHONPATH=''${CMAKE_CURRENT_BINARY_DIR}' 'PYTHONPATH=''${CMAKE_CURRENT_BINARY_DIR}:'"$PYTHONPATH"
28+
'';
29+
30+
nativeCheckInputs = o.nativeCheckInputs or [ ] ++ [
31+
numpy
32+
pythonImportsCheckHook
33+
];
34+
checkInputs = o.checkInputs or [ ] ++ [ pytest ];
35+
36+
pythonImportsCheck = o.pythonImportsCheck or [ ] ++ [ "OpenEXR" ];
37+
})
38+
)

nix/package/pillow-jxl-plugin.nix

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# SPDX-FileCopyrightText: (c) TagStudio Contributors
2-
# SPDX-License-Identifier: GPL-3.0-only
2+
# SPDX-License-Identifier: MIT
33

44
{
55
buildPythonPackage,
66
cmake,
77
fetchPypi,
88
lib,
99
numpy,
10+
openexr,
1011
packaging,
1112
pillow,
1213
pyexiv2,
@@ -16,18 +17,18 @@
1617

1718
buildPythonPackage rec {
1819
pname = "pillow-jxl-plugin";
19-
version = "1.3.4";
20+
version = "1.3.8";
2021
pyproject = true;
2122

2223
src = fetchPypi {
2324
pname = "pillow_jxl_plugin";
2425
inherit version;
25-
hash = "sha256-jqWJ/FWep8XfzLQq9NgUj121CPX01FGDKLq1ox/LJo4=";
26+
hash = "sha256-RDD9d1eJl0IHnFSKfSU31tY88PHTIxgAlbwPbwPZ1Po=";
2627
};
2728

2829
cargoDeps = rustPlatform.fetchCargoVendor {
2930
inherit src;
30-
hash = "sha256-7j+sCn+P6q6tsm2MJ/cM7hF2KEjILJNA6SDb35tecPg=";
31+
hash = "sha256-IiVTlKtKkfZnRXme7QFA5MS8PPiL8+riOYOEoNaHHXc=";
3132
};
3233

3334
nativeBuildInputs = [
@@ -36,12 +37,22 @@ buildPythonPackage rec {
3637
rustPlatform.maturinBuildHook
3738
];
3839

40+
dependencies = [
41+
packaging
42+
pillow
43+
];
44+
45+
dontUseCmakeConfigure = true;
46+
3947
nativeCheckInputs = [
4048
numpy
49+
openexr
4150
pyexiv2
4251
pytestCheckHook
4352
];
4453

54+
pythonImportsCheck = [ "pillow_jxl" ];
55+
4556
# Working directory takes precedence in the Python path. Remove
4657
# `pillow_jxl` to prevent it from being loaded during pytest, rather than the
4758
# built module, as it includes a `pillow_jxl.pillow_jxl.so` that is imported.
@@ -51,15 +62,6 @@ buildPythonPackage rec {
5162
rm -r pillow_jxl
5263
'';
5364

54-
dontUseCmakeConfigure = true;
55-
56-
pythonImportsCheck = [ "pillow_jxl" ];
57-
58-
dependencies = [
59-
packaging
60-
pillow
61-
];
62-
6365
meta = {
6466
description = "Pillow plugin for JPEG-XL, using Rust for bindings";
6567
homepage = "https://github.com/Isotr0py/pillow-jpegxl-plugin";

nix/package/pyexiv2.nix

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,41 @@
11
# SPDX-FileCopyrightText: (c) TagStudio Contributors
2-
# SPDX-License-Identifier: GPL-3.0-only
2+
# SPDX-License-Identifier: MIT
33

44
{
5-
autoPatchelfHook,
65
buildPythonPackage,
76
exiv2,
87
fetchFromGitHub,
98
lib,
9+
pybind11,
10+
python,
1011
setuptools,
1112
}:
1213

1314
buildPythonPackage rec {
1415
pname = "pyexiv2";
15-
version = "2.15.3";
16+
version = "2.16.0";
1617
pyproject = true;
1718

1819
src = fetchFromGitHub {
1920
owner = "LeoHsiao1";
2021
repo = "pyexiv2";
2122
tag = "v${version}";
22-
hash = "sha256-83bFMaoXncvhRJNcCgkkC7B29wR5pjuLO/EdkQdqxxo=";
23+
hash = "sha256-FH5nbbh0vaErJzBl6L2HPh0SQXkQ558abTBml7nSLU8=";
2324
};
2425

25-
nativeBuildInputs = [ autoPatchelfHook ];
26-
buildInputs = [ exiv2.lib ];
27-
28-
pythonImportsCheck = [ "pyexiv2" ];
26+
buildInputs = [ exiv2.dev ];
2927

3028
build-system = [ setuptools ];
29+
dependencies = [ pybind11 ];
30+
31+
postBuild = ''
32+
lib_dir=$out/${python.sitePackages}/pyexiv2/lib
33+
34+
mkdir -p "$lib_dir"
35+
cp -rT ${exiv2.lib}/lib "$lib_dir"
36+
'';
37+
38+
pythonImportsCheck = [ "pyexiv2" ];
3139

3240
meta = {
3341
description = "Read and write image metadata, including EXIF, IPTC, XMP, ICC Profile";

nix/shell.nix

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# SPDX-FileCopyrightText: (c) TagStudio Contributors
2-
# SPDX-License-Identifier: GPL-3.0-only
2+
# SPDX-License-Identifier: MIT
33

44
{
55
lib,
@@ -21,7 +21,7 @@ let
2121
stdenv.cc.cc
2222
zstd
2323
]
24-
++ lib.optionals (!stdenv.isDarwin) [
24+
++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
2525
dbus
2626
libGL
2727
libdrm
@@ -35,7 +35,7 @@ let
3535
]
3636
);
3737

38-
libraryPath = "${lib.optionalString pkgs.stdenv.isDarwin "DY"}LD_LIBRARY_PATH";
38+
libraryPath = "${lib.optionalString pkgs.stdenv.hostPlatform.isDarwin "DY"}LD_LIBRARY_PATH";
3939

4040
python3Wrapped = pkgs.symlinkJoin {
4141
inherit (python3)

0 commit comments

Comments
 (0)