summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorBjørn Forsman <bjorn.forsman@gmail.com>2015-07-04 19:41:18 +0200
committerBjørn Forsman <bjorn.forsman@gmail.com>2015-07-04 20:12:16 +0200
commit8e4edf52dc534bc89dc2249cf8e565a97fd64066 (patch)
tree1d6ed5e3373b97c75d2a10210e6e680ec1d94a96 /pkgs
parent3d70bd276356a57f6ea6c783d89f0e2355679d83 (diff)
downloadnixlib-8e4edf52dc534bc89dc2249cf8e565a97fd64066.tar
nixlib-8e4edf52dc534bc89dc2249cf8e565a97fd64066.tar.gz
nixlib-8e4edf52dc534bc89dc2249cf8e565a97fd64066.tar.bz2
nixlib-8e4edf52dc534bc89dc2249cf8e565a97fd64066.tar.lz
nixlib-8e4edf52dc534bc89dc2249cf8e565a97fd64066.tar.xz
nixlib-8e4edf52dc534bc89dc2249cf8e565a97fd64066.tar.zst
nixlib-8e4edf52dc534bc89dc2249cf8e565a97fd64066.zip
python-namebench: fix error preventing it from starting
namebench expects to be run from its own source tree (it uses relative
paths to various resources), make it work.

The current version fails like this:

  $ ./result/bin/namebench.py
  Traceback (most recent call last):
    File "/nix/store/04d29llycr5xcxplfv4gn556nzm1mrl7-python2.7-namebench-1.0.5/bin/.namebench.py-wrapped", line 46, in <module>
      (options, supplied_ns, global_ns, regional_ns) = config.GetConfiguration()
    File "/nix/store/04d29llycr5xcxplfv4gn556nzm1mrl7-python2.7-namebench-1.0.5/lib/python2.7/site-packages/libnamebench/config.py", line 27, in GetConfiguration
      (configured_options, global_ns, regional_ns) = ProcessConfigurationFile(options)
    File "/nix/store/04d29llycr5xcxplfv4gn556nzm1mrl7-python2.7-namebench-1.0.5/lib/python2.7/site-packages/libnamebench/config.py", line 100, in ProcessConfigurationFile
      general = dict(config.items('general'))
    File "/nix/store/z6vp5aix4ks1zdjdry7v7dahg8dd02sy-python-2.7.10/lib/python2.7/ConfigParser.py", line 642, in items
      raise NoSectionError(section)
  ConfigParser.NoSectionError: No section: 'general'
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/top-level/python-packages.nix6
1 files changed, 6 insertions, 0 deletions
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 47fe45b97600..686772645872 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -7708,6 +7708,12 @@ let
     # error: invalid command 'test'
     doCheck = false;
 
+    # namebench expects to be run from its own source tree (it uses relative
+    # paths to various resources), make it work.
+    postInstall = ''
+      sed -i "s|import os|import os; os.chdir(\"$out/namebench\")|" "$out/bin/namebench.py"
+    '';
+
     meta = {
       homepage = http://namebench.googlecode.com/;
       description = "Find fastest DNS servers available";