Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def query_pkg(raw_file):
- """
- Query which Debian package raw_file belongs.
- Use dlocate(1) instead of dpkg(1) for fast search
- If dlocate is not installed, fall back to dpkg(1)
- Return None if the query fails.
- """
- with open(os.devnull, "w") as fnull:
- program = dlocate_installed()
- try:
- result = subprocess.check_output(["dlocate", "-S", raw_file],
- stderr=fnull)
- except subprocess.CalledProcessError:
- pass
- try:
- return result.split(':')[0]
- except UnboundLocalError:
- pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement