Skip to content
This repository was archived by the owner on Jan 27, 2023. It is now read-only.

Commit 6a207ed

Browse files
committed
Fixed Ubuntu version check
This code works with Python 2 and 3. Only the Python 3 version of os.uname() returns an object with the version attribute - in Python 2 it's just a tuple. But for backwards compatibility, the Python 3 object is also iterable, behaving like a five-tuple containing sysname, nodename, release, version, and machine in that order.
1 parent babe7f5 commit 6a207ed

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

searchengines/ack.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Ack (base.Base):
2222
def __init__(self, settings):
2323
base.Base.__init__(self, settings)
2424
# Ubuntu's ack from repos is called ack-grep by default
25-
if 'Ubuntu' in os.uname().version and self.path_to_executable=='ack' and os.system('which ack-grep')==0:
25+
if 'Ubuntu' in os.uname()[3] and self.path_to_executable=='ack' and os.system('which ack-grep')==0:
2626
self.path_to_executable = 'ack-grep'
2727

2828
engine_class = Ack

0 commit comments

Comments
 (0)