From c20c4895eda0ee7a7bc7a22a1ff126ef42ffde52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ozan=20=C3=87a=C4=9Flayan?= Date: Mon, 1 Mar 2010 14:44:34 +0000 Subject: [PATCH] Use constants from constants.py --- pisi/api.py | 6 +++--- pisi/archive.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pisi/api.py b/pisi/api.py index 8c58cd00..d624b892 100644 --- a/pisi/api.py +++ b/pisi/api.py @@ -937,7 +937,7 @@ def clearCache(all=False): def getRemoveOrder(cacheDir, pkgList): sizes = {} for pkg in pkgList: - sizes[pkg] = os.stat(os.path.join(cacheDir, pkg) + ".pisi").st_size + sizes[pkg] = os.stat(os.path.join(cacheDir, pkg) + ctx.const.package_suffix).st_size # sort dictionary by value from PEP-265 from operator import itemgetter @@ -949,7 +949,7 @@ def clearCache(all=False): totalSize += size if totalSize >= limit: try: - os.remove(os.path.join(cacheDir, pkg) + ".pisi") + os.remove(os.path.join(cacheDir, pkg) + ctx.const.package_suffix) except exceptions.OSError: pass @@ -963,7 +963,7 @@ def clearCache(all=False): cacheDir = ctx.config.cached_packages_dir() - pkgList = map(lambda x: os.path.basename(x).split(".pisi")[0], glob.glob("%s/*.pisi" % cacheDir)) + pkgList = map(lambda x: os.path.basename(x).split(ctx.const.package_suffix)[0], glob.glob("%s/*.pisi" % cacheDir)) if not all: # Cache limits from pisi.conf config = pisi.configfile.ConfigurationFile("/etc/pisi/pisi.conf") diff --git a/pisi/archive.py b/pisi/archive.py index d4869b45..ada7b209 100644 --- a/pisi/archive.py +++ b/pisi/archive.py @@ -383,7 +383,7 @@ class ArchiveZip(ArchiveBase): self.zip_obj.writestr(attr, dest) else: comp_type = zipfile.ZIP_DEFLATED - if file_name.endswith(".lzma"): + if file_name.endswith(ctx.const.lzma_suffix): comp_type = zipfile.ZIP_STORED self.zip_obj.write(file_name, arc_name, comp_type)