From 8974c1ced3f693dd717964a5c40697e443df6f23 Mon Sep 17 00:00:00 2001 From: helium18 Date: Sun, 5 Jun 2022 16:28:17 +0530 Subject: [PATCH] grapejuice: 4.10.2 -> 5.1.1 Co-authored-by: Artturi --- pkgs/games/grapejuice/default.nix | 50 ++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 11 deletions(-) diff --git a/pkgs/games/grapejuice/default.nix b/pkgs/games/grapejuice/default.nix index 4ddb58c81482..901045f750ff 100644 --- a/pkgs/games/grapejuice/default.nix +++ b/pkgs/games/grapejuice/default.nix @@ -1,6 +1,7 @@ { lib , fetchFromGitLab , gobject-introspection +, pciutils , python3Packages , gtk3 , wrapGAppsHook @@ -9,21 +10,21 @@ , desktop-file-utils , xdg-utils , xdg-user-dirs -, wine +, gettext , winetricks -, pciutils +, wine , glxinfo }: python3Packages.buildPythonApplication rec { pname = "grapejuice"; - version = "4.10.2"; + version = "5.1.1"; src = fetchFromGitLab { owner = "BrinkerVII"; repo = "grapejuice"; - rev = "9a7cf806d35b4d53b3d3762339eba7d861b5043d"; - sha256 = "sha256-cKZv9qPCnl7i4kb6PG8RYx3HNLcwgI4d2zkw899MA6E="; + rev = "v${version}"; + sha256 = "sha256-31pxQtKw5sLGnnNdboF7AAIFqsan5pXKHIHtKq/ErRE="; }; nativeBuildInputs = [ @@ -36,16 +37,19 @@ python3Packages.buildPythonApplication rec { buildInputs = [ cairo + gettext ]; propagatedBuildInputs = with python3Packages; [ - requests - pygobject3 - dbus-python - packaging psutil + dbus-python + pygobject3 + packaging + wheel setuptools + requests unidecode + click ]; dontWrapGApps = true; @@ -58,6 +62,7 @@ python3Packages.buildPythonApplication rec { postPatch = '' substituteInPlace src/grapejuice_common/assets/desktop/grapejuice.desktop \ --replace \$GRAPEJUICE_EXECUTABLE "$out/bin/grapejuice" \ + --replace \$GRAPEJUICE_GUI_EXECUTABLE "$out/bin/grapejuice-gui" \ --replace \$GRAPEJUICE_ICON grapejuice substituteInPlace src/grapejuice_common/assets/desktop/roblox-player.desktop \ @@ -71,6 +76,12 @@ python3Packages.buildPythonApplication rec { substituteInPlace src/grapejuice_common/assets/desktop/roblox-studio.desktop \ --replace \$GRAPEJUICE_EXECUTABLE "$out/bin/grapejuice" \ --replace \$STUDIO_ICON "grapejuice-roblox-studio" + + substituteInPlace src/grapejuice_common/paths.py \ + --replace 'return local_share() / "locale"' 'return Path("${placeholder "out"}/share/locale")' + + substituteInPlace src/grapejuice_common/features/settings.py \ + --replace 'k_default_wine_home: "",' 'k_default_wine_home: "${wine}",' ''; postInstall = '' @@ -78,6 +89,23 @@ python3Packages.buildPythonApplication rec { cp -r src/grapejuice_common/assets/desktop/* $out/share/applications/ cp -r src/grapejuice_common/assets/icons $out/share/ cp src/grapejuice_common/assets/mime_xml/*.xml $out/share/mime/packages/ + + # compile locales (*.po -> *.mo) + # from https://gitlab.com/brinkervii/grapejuice/-/blob/master/src/grapejuice_common/util/mo_util.py + LOCALE_DIR="$out/share/locale" + PO_DIR="src/grapejuice_common/assets/po" + LINGUAS_FILE="src/grapejuice_common/assets/po/LINGUAS" + + for lang in $(<"$LINGUAS_FILE") # extract langs from LINGUAS_FILE + do + po_file="$PO_DIR/$lang.po" + mo_file_dir="$LOCALE_DIR/$lang/LC_MESSAGES" + + mkdir -p $mo_file_dir + + mo_file="$mo_file_dir/grapejuice.mo" + msgfmt $po_file -o $mo_file # msgfmt from gettext + done ''; # No tests @@ -87,9 +115,9 @@ python3Packages.buildPythonApplication rec { meta = with lib; { homepage = "https://gitlab.com/brinkervii/grapejuice"; - description = "A wine+Roblox management application"; + description = "Simple Wine+Roblox management tool"; license = licenses.gpl3Plus; platforms = platforms.linux; - maintainers = with maintainers; [ artturin ]; + maintainers = with maintainers; [ artturin helium ]; }; }