Skip to content

Commit cb9e5af

Browse files
authored
tauon: 7.9.0 -> 8.0.1 (#405753)
2 parents 41ff7e1 + 59041b8 commit cb9e5af

5 files changed

Lines changed: 163 additions & 13 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
diff --git a/src/tauon/__main__.py b/src/tauon/__main__.py
2+
index 04691586..e48afa02 100755
3+
--- a/src/tauon/__main__.py
4+
+++ b/src/tauon/__main__.py
5+
@@ -115,8 +115,8 @@ def transfer_args_and_exit() -> None:
6+
if "--no-start" in sys.argv:
7+
transfer_args_and_exit()
8+
9+
-# If we're installed, use home data locations
10+
-install_mode = bool(str(install_directory).startswith(("/opt/", "/usr/", "/app/", "/snap/")) or sys.platform in ("darwin", "win32"))
11+
+# Nixpkgs install, use home data dirs.
12+
+install_mode = True
13+
14+
# Assume that it's a classic Linux install, use standard paths
15+
if str(install_directory).startswith("/usr/") and Path("/usr/share/TauonMusicBox").is_dir():

pkgs/by-name/ta/tauon/package.nix

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
lib,
33
stdenv,
44
fetchFromGitHub,
5+
fetchPypi,
56
kissfft,
67
miniaudio,
78
pkg-config,
@@ -16,6 +17,7 @@
1617
librsvg,
1718
libsamplerate,
1819
libvorbis,
20+
xorg,
1921
mpg123,
2022
opusfile,
2123
pango,
@@ -26,16 +28,32 @@
2628
withDiscordRPC ? true,
2729
}:
2830

31+
let
32+
# fork of pypresence, to be reverted if/when there's an upstream release
33+
lynxpresence = python3Packages.buildPythonPackage rec {
34+
pname = "lynxpresence";
35+
version = "4.4.1";
36+
format = "setuptools";
37+
38+
src = fetchPypi {
39+
inherit pname version;
40+
hash = "sha256-y/KboyhEGs9RvyKayEIQu2+WaiQNOdsHDl1/pEoqEkQ=";
41+
};
42+
43+
doCheck = false; # tests require internet connection
44+
pythonImportsCheck = [ "lynxpresence" ];
45+
};
46+
in
2947
python3Packages.buildPythonApplication rec {
3048
pname = "tauon";
31-
version = "7.9.0";
49+
version = "8.0.1";
3250
pyproject = true;
3351

3452
src = fetchFromGitHub {
3553
owner = "Taiko2k";
3654
repo = "Tauon";
3755
tag = "v${version}";
38-
hash = "sha256-6aEUniLoE5Qtfht3OAe+zvC9yZwjH+KpskmjGowDuuU=";
56+
hash = "sha256-m94/zdlJu/u/dchIXhqB47bkl6Uej2hVr8R6RNg8Vaw=";
3957
};
4058

4159
postUnpack = ''
@@ -46,16 +64,16 @@ python3Packages.buildPythonApplication rec {
4664
ln -s ${miniaudio.src} source/src/phazor/miniaudio
4765
'';
4866

49-
postPatch = ''
50-
substituteInPlace src/tauon/__main__.py \
51-
--replace-fail 'install_mode = False' 'install_mode = True'
67+
patches = [
68+
./install_mode_true.patch
69+
];
5270

71+
postPatch = ''
5372
substituteInPlace src/tauon/t_modules/t_phazor.py \
5473
--replace-fail 'base_path = Path(pctl.install_directory).parent.parent / "build"' 'base_path = Path("${placeholder "out"}/${python3Packages.python.sitePackages}")'
5574
'';
5675

5776
pythonRemoveDeps = [
58-
"pysdl2-dll"
5977
"opencc"
6078
"tekore"
6179
];
@@ -105,23 +123,26 @@ python3Packages.buildPythonApplication rec {
105123
pychromecast
106124
pylast
107125
pygobject3
108-
pysdl2
126+
pysdl3
109127
requests
110128
send2trash
111129
setproctitle
112130
tidalapi
113131
]
114-
++ lib.optional withDiscordRPC pypresence
132+
++ lib.optional withDiscordRPC lynxpresence
115133
++ lib.optional stdenv.hostPlatform.isLinux pulsectl;
116134

117135
makeWrapperArgs = [
118136
"--prefix PATH : ${lib.makeBinPath [ ffmpeg ]}"
119137
"--prefix LD_LIBRARY_PATH : ${
120-
lib.makeLibraryPath [
121-
game-music-emu
122-
libopenmpt
123-
pulseaudio
124-
]
138+
lib.makeLibraryPath (
139+
[
140+
game-music-emu
141+
libopenmpt
142+
pulseaudio
143+
]
144+
++ lib.optional stdenv.hostPlatform.isLinux xorg.libXcursor
145+
)
125146
}"
126147
"--prefix PYTHONPATH : $out/share/tauon"
127148
"--set GI_TYPELIB_PATH $GI_TYPELIB_PATH"
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
{
2+
stdenv,
3+
lib,
4+
fetchurl,
5+
fetchFromGitHub,
6+
python,
7+
buildPythonPackage,
8+
setuptools-scm,
9+
packaging,
10+
aiohttp,
11+
requests,
12+
13+
# native dependencies
14+
sdl3,
15+
sdl3-ttf,
16+
sdl3-image,
17+
}:
18+
19+
let
20+
dochash =
21+
if stdenv.hostPlatform.isLinux then
22+
"sha256-+1zLd308zL+m68kLMeOWWxT0wYDgCd6g9cc2hEtaeUs="
23+
else if stdenv.hostPlatform.isDarwin then
24+
"sha256-2uB9+ABgv5O376LyHb0ShGjM4LHYzMRMxk/k+1LBmv0="
25+
else if stdenv.hostPlatform.isWindows then
26+
"sha256-46bQSPYctycizf2GXichd5V74LjxwIAPhBmklXAJ/Jg="
27+
else
28+
throw "PySDL3 does not support ${stdenv.hostPlatform.uname.system}";
29+
lib_ext = stdenv.hostPlatform.extensions.sharedLibrary;
30+
in
31+
buildPythonPackage rec {
32+
pname = "pysdl3";
33+
version = "0.9.8b1";
34+
pyproject = true;
35+
36+
pythonImportsCheck = [ "sdl3" ];
37+
38+
src = fetchFromGitHub {
39+
owner = "Aermoss";
40+
repo = "PySDL3";
41+
tag = "v${version}";
42+
hash = "sha256-FVUCcqKTq6qdNkYHTYFiUxt2HIaNC5LK0BEUfz8Mue8=";
43+
};
44+
45+
docfile = fetchurl {
46+
url = "https://github.com/Aermoss/PySDL3/releases/download/v${version}/${stdenv.hostPlatform.uname.system}-Docs.py";
47+
hash = "${dochash}";
48+
};
49+
50+
postUnpack = ''
51+
cp ${docfile} source/sdl3/__doc__.py
52+
'';
53+
54+
postInstall = ''
55+
mkdir $out/${python.sitePackages}/sdl3/bin
56+
ln -s ${sdl3}/lib/libSDL3${lib_ext} -t $out/${python.sitePackages}/sdl3/bin
57+
ln -s ${sdl3-ttf}/lib/libSDL3_ttf${lib_ext} -t $out/${python.sitePackages}/sdl3/bin
58+
ln -s ${sdl3-image}/lib/libSDL3_image${lib_ext} -t $out/${python.sitePackages}/sdl3/bin
59+
'';
60+
61+
build-system = [
62+
setuptools-scm
63+
];
64+
65+
buildInputs = [
66+
sdl3
67+
sdl3-ttf
68+
sdl3-image
69+
];
70+
71+
dependencies = [
72+
packaging
73+
aiohttp
74+
requests
75+
];
76+
77+
# PySDL3 tries to update both itself and SDL binaries at runtime. This hook
78+
# sets some env variables to tell it not to do that.
79+
setupHook = ./setup-hook.sh;
80+
81+
env = {
82+
SDL_VIDEODRIVER = "dummy";
83+
SDL_AUDIODRIVER = "dummy";
84+
SDL_RENDER_DRIVER = "software";
85+
PYTHONFAULTHANDLER = "1";
86+
};
87+
88+
meta = {
89+
description = "Pure Python wrapper for SDL3";
90+
homepage = "https://github.com/Aermoss/PySDL3";
91+
license = lib.licenses.mit;
92+
maintainers = with lib.maintainers; [ jansol ];
93+
platforms = [
94+
"aarch64-linux"
95+
"x86_64-linux"
96+
"aarch64-windows"
97+
"x86_64-windows"
98+
"aarch64-darwin"
99+
"x86_64-darwin"
100+
];
101+
};
102+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# See also
2+
# https://pysdl3.readthedocs.io/en/latest/install.html#the-environment-variable-method
3+
4+
# Don't check Pypi for new PySDL3 releases at runtime
5+
export SDL_CHECK_VERSION=0
6+
# Don't try to download SDL binaries at runtime
7+
export SDL_DOWNLOAD_BINARIES=0
8+
# Nixpkgs does not provide a metadata.json. Instead we want PySDL3 to find the
9+
# SDL libraries we symlink into its site-packages
10+
export SDL_DISABLE_METADATA=1

pkgs/top-level/python-packages.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13370,6 +13370,8 @@ self: super: with self; {
1337013370

1337113371
pysdl2 = callPackage ../development/python-modules/pysdl2 { };
1337213372

13373+
pysdl3 = callPackage ../development/python-modules/pysdl3 { };
13374+
1337313375
pysearpc = toPythonModule (pkgs.libsearpc.override { python3 = self.python; });
1337413376

1337513377
pysecretsocks = callPackage ../development/python-modules/pysecretsocks { };

0 commit comments

Comments
 (0)