diff options
author | Ricardo M. Correia <rcorreia@wizy.org> | 2014-01-14 03:24:27 +0100 |
---|---|---|
committer | Rok Garbas <rok@garbas.si> | 2014-01-18 20:45:27 +0000 |
commit | 0cf9a083d970c8d41c6c412a82bc65a395c30c2d (patch) | |
tree | 3cfed3877260d940114d402f85b907d40a26d480 /pkgs/applications/virtualization | |
parent | 51a5f9c3646d6796f119a61251231841ade09a74 (diff) | |
download | nixlib-0cf9a083d970c8d41c6c412a82bc65a395c30c2d.tar nixlib-0cf9a083d970c8d41c6c412a82bc65a395c30c2d.tar.gz nixlib-0cf9a083d970c8d41c6c412a82bc65a395c30c2d.tar.bz2 nixlib-0cf9a083d970c8d41c6c412a82bc65a395c30c2d.tar.lz nixlib-0cf9a083d970c8d41c6c412a82bc65a395c30c2d.tar.xz nixlib-0cf9a083d970c8d41c6c412a82bc65a395c30c2d.tar.zst nixlib-0cf9a083d970c8d41c6c412a82bc65a395c30c2d.zip |
virt-manager: Fix running with --no-fork
This removes nixpkgs' custom runners and instead copies the main python source files to the bin directory, then wraps them up as usual. Hopefully this will be more reliable than other previous wrapping methods.
Diffstat (limited to 'pkgs/applications/virtualization')
-rw-r--r-- | pkgs/applications/virtualization/virt-manager/custom_runner.py | 13 | ||||
-rw-r--r-- | pkgs/applications/virtualization/virt-manager/default.nix | 22 |
2 files changed, 5 insertions, 30 deletions
diff --git a/pkgs/applications/virtualization/virt-manager/custom_runner.py b/pkgs/applications/virtualization/virt-manager/custom_runner.py deleted file mode 100644 index 5322c20dd329..000000000000 --- a/pkgs/applications/virtualization/virt-manager/custom_runner.py +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/python -t -# this script was written to use /etc/nixos/nixpkgs/pkgs/development/python-modules/generic/wrap.sh -# which already automates python executable wrapping by extending the PATH/pythonPath - -# from http://docs.python.org/library/subprocess.html -# Warning Invoking the system shell with shell=True can be a security hazard if combined with untrusted input. See the warning under Frequently Used Arguments for details. - -from subprocess import Popen, PIPE, STDOUT - -cmd = 'PYTHON_EXECUTABLE_PATH -t THE_CUSTOM_PATH/share/virt-manager/THE_CUSTOM_PROGRAM.py' -p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True) -output = p.stdout.read() -print output diff --git a/pkgs/applications/virtualization/virt-manager/default.nix b/pkgs/applications/virtualization/virt-manager/default.nix index 9eee8c2ca4ea..fb2dde66442f 100644 --- a/pkgs/applications/virtualization/virt-manager/default.nix +++ b/pkgs/applications/virtualization/virt-manager/default.nix @@ -41,10 +41,6 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ makeWrapper pythonPackages.wrapPython ]; - # patch the runner script in order to make wrapPythonPrograms work and run the program using a syscall - # example code: /etc/nixos/nixpkgs/pkgs/development/interpreters/spidermonkey/1.8.0-rc1.nix - customRunner = ./custom_runner.py; - # TODO # virt-manager -> import gtk.glade -> No module named glade --> fixed by removing 'pygtk' and by only using pyGtkGlade # -> import gconf -> ImportError: No module named gconf @@ -62,21 +58,13 @@ stdenv.mkDerivation rec { # -> fixed by http://nixos.org/wiki/Solve_GConf_errors_when_running_GNOME_applications & a restart # virt-manager-tui -> ImportError: No module named newt_syrup.dialogscreen - patchPhase = '' - cat ${customRunner} > src/virt-manager.in - substituteInPlace "src/virt-manager.in" --replace "THE_CUSTOM_PATH" "$out" - substituteInPlace "src/virt-manager.in" --replace "THE_CUSTOM_PROGRAM" "virt-manager" - substituteInPlace "src/virt-manager.in" --replace "PYTHON_EXECUTABLE_PATH" "${python}/bin/python" - - cat ${customRunner} > src/virt-manager-tui.in - substituteInPlace "src/virt-manager-tui.in" --replace "THE_CUSTOM_PATH" "$out" - substituteInPlace "src/virt-manager-tui.in" --replace "THE_CUSTOM_PROGRAM" "virt-manager-tui" - substituteInPlace "src/virt-manager-tui.in" --replace "PYTHON_EXECUTABLE_PATH" "${python}/bin/python" - ''; - - # /etc/nixos/nixpkgs/pkgs/development/python-modules/generic/wrap.sh installPhase = '' make install + + # A hack, but the most reliable method so far + echo "#!/usr/bin/env python" | cat - src/virt-manager.py > $out/bin/virt-manager + echo "#!/usr/bin/env python" | cat - src/virt-manager-tui.py > $out/bin/virt-manager-tui + wrapPythonPrograms ''; |