Unverified Commit cb9e5af7 authored by Peder Bergebakken Sundt's avatar Peder Bergebakken Sundt Committed by GitHub
Browse files

tauon: 7.9.0 -> 8.0.1 (#405753)

parents 41ff7e19 59041b8f
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
diff --git a/src/tauon/__main__.py b/src/tauon/__main__.py
index 04691586..e48afa02 100755
--- a/src/tauon/__main__.py
+++ b/src/tauon/__main__.py
@@ -115,8 +115,8 @@ def transfer_args_and_exit() -> None:
 if "--no-start" in sys.argv:
 	transfer_args_and_exit()
 
-# If we're installed, use home data locations
-install_mode = bool(str(install_directory).startswith(("/opt/", "/usr/", "/app/", "/snap/")) or sys.platform in ("darwin", "win32"))
+# Nixpkgs install, use home data dirs.
+install_mode = True
 
 # Assume that it's a classic Linux install, use standard paths
 if str(install_directory).startswith("/usr/") and Path("/usr/share/TauonMusicBox").is_dir():
+34 −13
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
  lib,
  stdenv,
  fetchFromGitHub,
  fetchPypi,
  kissfft,
  miniaudio,
  pkg-config,
@@ -16,6 +17,7 @@
  librsvg,
  libsamplerate,
  libvorbis,
  xorg,
  mpg123,
  opusfile,
  pango,
@@ -26,16 +28,32 @@
  withDiscordRPC ? true,
}:

let
  # fork of pypresence, to be reverted if/when there's an upstream release
  lynxpresence = python3Packages.buildPythonPackage rec {
    pname = "lynxpresence";
    version = "4.4.1";
    format = "setuptools";

    src = fetchPypi {
      inherit pname version;
      hash = "sha256-y/KboyhEGs9RvyKayEIQu2+WaiQNOdsHDl1/pEoqEkQ=";
    };

    doCheck = false; # tests require internet connection
    pythonImportsCheck = [ "lynxpresence" ];
  };
in
python3Packages.buildPythonApplication rec {
  pname = "tauon";
  version = "7.9.0";
  version = "8.0.1";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "Taiko2k";
    repo = "Tauon";
    tag = "v${version}";
    hash = "sha256-6aEUniLoE5Qtfht3OAe+zvC9yZwjH+KpskmjGowDuuU=";
    hash = "sha256-m94/zdlJu/u/dchIXhqB47bkl6Uej2hVr8R6RNg8Vaw=";
  };

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

  postPatch = ''
    substituteInPlace src/tauon/__main__.py \
      --replace-fail 'install_mode = False' 'install_mode = True'
  patches = [
    ./install_mode_true.patch
  ];

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

  pythonRemoveDeps = [
    "pysdl2-dll"
    "opencc"
    "tekore"
  ];
@@ -105,23 +123,26 @@ python3Packages.buildPythonApplication rec {
      pychromecast
      pylast
      pygobject3
      pysdl2
      pysdl3
      requests
      send2trash
      setproctitle
      tidalapi
    ]
    ++ lib.optional withDiscordRPC pypresence
    ++ lib.optional withDiscordRPC lynxpresence
    ++ lib.optional stdenv.hostPlatform.isLinux pulsectl;

  makeWrapperArgs = [
    "--prefix PATH : ${lib.makeBinPath [ ffmpeg ]}"
    "--prefix LD_LIBRARY_PATH : ${
      lib.makeLibraryPath [
      lib.makeLibraryPath (
        [
          game-music-emu
          libopenmpt
          pulseaudio
        ]
        ++ lib.optional stdenv.hostPlatform.isLinux xorg.libXcursor
      )
    }"
    "--prefix PYTHONPATH : $out/share/tauon"
    "--set GI_TYPELIB_PATH $GI_TYPELIB_PATH"
+102 −0
Original line number Diff line number Diff line
{
  stdenv,
  lib,
  fetchurl,
  fetchFromGitHub,
  python,
  buildPythonPackage,
  setuptools-scm,
  packaging,
  aiohttp,
  requests,

  # native dependencies
  sdl3,
  sdl3-ttf,
  sdl3-image,
}:

let
  dochash =
    if stdenv.hostPlatform.isLinux then
      "sha256-+1zLd308zL+m68kLMeOWWxT0wYDgCd6g9cc2hEtaeUs="
    else if stdenv.hostPlatform.isDarwin then
      "sha256-2uB9+ABgv5O376LyHb0ShGjM4LHYzMRMxk/k+1LBmv0="
    else if stdenv.hostPlatform.isWindows then
      "sha256-46bQSPYctycizf2GXichd5V74LjxwIAPhBmklXAJ/Jg="
    else
      throw "PySDL3 does not support ${stdenv.hostPlatform.uname.system}";
  lib_ext = stdenv.hostPlatform.extensions.sharedLibrary;
in
buildPythonPackage rec {
  pname = "pysdl3";
  version = "0.9.8b1";
  pyproject = true;

  pythonImportsCheck = [ "sdl3" ];

  src = fetchFromGitHub {
    owner = "Aermoss";
    repo = "PySDL3";
    tag = "v${version}";
    hash = "sha256-FVUCcqKTq6qdNkYHTYFiUxt2HIaNC5LK0BEUfz8Mue8=";
  };

  docfile = fetchurl {
    url = "https://github.com/Aermoss/PySDL3/releases/download/v${version}/${stdenv.hostPlatform.uname.system}-Docs.py";
    hash = "${dochash}";
  };

  postUnpack = ''
    cp ${docfile} source/sdl3/__doc__.py
  '';

  postInstall = ''
    mkdir $out/${python.sitePackages}/sdl3/bin
    ln -s ${sdl3}/lib/libSDL3${lib_ext} -t $out/${python.sitePackages}/sdl3/bin
    ln -s ${sdl3-ttf}/lib/libSDL3_ttf${lib_ext} -t $out/${python.sitePackages}/sdl3/bin
    ln -s ${sdl3-image}/lib/libSDL3_image${lib_ext} -t $out/${python.sitePackages}/sdl3/bin
  '';

  build-system = [
    setuptools-scm
  ];

  buildInputs = [
    sdl3
    sdl3-ttf
    sdl3-image
  ];

  dependencies = [
    packaging
    aiohttp
    requests
  ];

  # PySDL3 tries to update both itself and SDL binaries at runtime. This hook
  # sets some env variables to tell it not to do that.
  setupHook = ./setup-hook.sh;

  env = {
    SDL_VIDEODRIVER = "dummy";
    SDL_AUDIODRIVER = "dummy";
    SDL_RENDER_DRIVER = "software";
    PYTHONFAULTHANDLER = "1";
  };

  meta = {
    description = "Pure Python wrapper for SDL3";
    homepage = "https://github.com/Aermoss/PySDL3";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ jansol ];
    platforms = [
      "aarch64-linux"
      "x86_64-linux"
      "aarch64-windows"
      "x86_64-windows"
      "aarch64-darwin"
      "x86_64-darwin"
    ];
  };
}
+10 −0
Original line number Diff line number Diff line
# See also
# https://pysdl3.readthedocs.io/en/latest/install.html#the-environment-variable-method

# Don't check Pypi for new PySDL3 releases at runtime
export SDL_CHECK_VERSION=0
# Don't try to download SDL binaries at runtime
export SDL_DOWNLOAD_BINARIES=0
# Nixpkgs does not provide a metadata.json. Instead we want PySDL3 to find the
# SDL libraries we symlink into its site-packages
export SDL_DISABLE_METADATA=1
+2 −0
Original line number Diff line number Diff line
@@ -13370,6 +13370,8 @@ self: super: with self; {
  pysdl2 = callPackage ../development/python-modules/pysdl2 { };
  pysdl3 = callPackage ../development/python-modules/pysdl3 { };
  pysearpc = toPythonModule (pkgs.libsearpc.override { python3 = self.python; });
  pysecretsocks = callPackage ../development/python-modules/pysecretsocks { };