From: Michael Tremer Date: Mon, 7 Feb 2011 01:47:20 +0000 (+0100) Subject: Skip files with wrong extension when walking through a directory with packages. X-Git-Tag: 0.9.3~193 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ad963cd65d70ff3f20e8625136821ba622d2dd9a;p=pakfire.git Skip files with wrong extension when walking through a directory with packages. --- diff --git a/pakfire/index.py b/pakfire/index.py index 4cc2d21b3..bb6b43c7a 100644 --- a/pakfire/index.py +++ b/pakfire/index.py @@ -5,6 +5,8 @@ import os import packages +from constants import * + class Index(object): def __init__(self, pakfire, repo): self.pakfire = pakfire @@ -64,6 +66,10 @@ class DirectoryIndex(Index): for dir, subdirs, files in os.walk(self.path): for file in files: + # Skip files that do not have the right extension + if not file.endswith(".%s" % PACKAGE_EXTENSION): + continue + file = os.path.join(dir, file) package = packages.BinaryPackage(self.pakfire, self.repo, file)