Use constants from constants.py

This commit is contained in:
Ozan Çağlayan
2010-03-01 14:44:34 +00:00
parent bf71c9e10d
commit c20c4895ed
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -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")
+1 -1
View File
@@ -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)