Unverified Commit a2c3e847 authored by jopejoe1's avatar jopejoe1 Committed by GitHub
Browse files

timekpr: avoid using an env variable (#488548)

parents c2067105 1b5787e2
Loading
Loading
Loading
Loading
+46 −43
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@
  sound-theme-freedesktop,
  stdenv,
  wrapGAppsHook4,
  writeText,
}:
python3Packages.buildPythonApplication rec {
  pname = "timekpr";
@@ -42,8 +43,10 @@ python3Packages.buildPythonApplication rec {
    psutil
  ];

  postPatch =
    let
      # Generate setup.py because the upstream repository does not include it
  SETUP_PY = ''
      setup-py = writeText "setup.py" ''
        from setuptools import setup, find_namespace_packages

        package_dir={"timekpr": "."}
@@ -61,8 +64,8 @@ python3Packages.buildPythonApplication rec {
          ],
        )
      '';

  postPatch = ''
    in
    ''
      shopt -s globstar extglob nullglob

      substituteInPlace bin/* **/*.py resource/server/systemd/timekpr.service \
@@ -83,7 +86,7 @@ python3Packages.buildPythonApplication rec {
      substituteInPlace client/admin/adminprocessor.py \
        --replace-fail '"/timekpra" in ' '"/..timekpra-wrapped-wrapped" in '

    printf %s "$SETUP_PY" > setup.py
      ln -s ${setup-py} setup.py
    '';

  # We need to manually inject $PYTHONPATH here, because `buildPythonApplication` does not recognize timekpr's executables as Python scripts, and therefore it does not automatically inject $PYTHONPATH into them.