Improve modules check

There are actually two improvements here.
1) this.ko.bak and that.konan won't match anymore
2) Both lines become constant time opperations rather than having to seek from
   beggining to end of each string looking for the extension.
This commit is contained in:
Jeff Hutchins 2012-12-20 15:42:16 -07:00
parent 107c265664
commit 6a9f9fb51d

View File

@ -53,8 +53,8 @@ def available():
mod_dir = os.path.join('/lib/modules/', os.uname()[2])
for root, dirs, files in os.walk(mod_dir):
for fn_ in files:
if '.ko' in fn_:
ret.append(fn_[:fn_.index('.ko')])
if fn_.endswith('.ko'):
ret.append(fn_[:-3])
return sorted(list(ret))