Browse Source

dpkg_which: fail if cmd not installed via dpkg

Fabian Peter Hammerle 5 years ago
parent
commit
010ff548d6
1 changed files with 3 additions and 2 deletions
  1. 3 2
      rc.xsh

+ 3 - 2
rc.xsh

@@ -56,8 +56,9 @@ def dpkg_which(cmd):
     cmd_path = shutil.which(cmd)
     assert cmd_path, 'cmd {!r} not found'.format(cmd)
     matches = dpkg_search(cmd_path)
-    assert len(matches) in [0, 1]
-    return matches[0] if len(matches) == 1 else None
+    assert len(matches) != 0, '{!r} not installed via dpkg'.format(cmd_path)
+    assert len(matches) == 1
+    return matches[0]
 
 def locate(*patterns, match_all=True, ignore_case=True):
     params = []