Use constants from constants.py
This commit is contained in:
+3
-3
@@ -937,7 +937,7 @@ def clearCache(all=False):
|
|||||||
def getRemoveOrder(cacheDir, pkgList):
|
def getRemoveOrder(cacheDir, pkgList):
|
||||||
sizes = {}
|
sizes = {}
|
||||||
for pkg in pkgList:
|
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
|
# sort dictionary by value from PEP-265
|
||||||
from operator import itemgetter
|
from operator import itemgetter
|
||||||
@@ -949,7 +949,7 @@ def clearCache(all=False):
|
|||||||
totalSize += size
|
totalSize += size
|
||||||
if totalSize >= limit:
|
if totalSize >= limit:
|
||||||
try:
|
try:
|
||||||
os.remove(os.path.join(cacheDir, pkg) + ".pisi")
|
os.remove(os.path.join(cacheDir, pkg) + ctx.const.package_suffix)
|
||||||
except exceptions.OSError:
|
except exceptions.OSError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@@ -963,7 +963,7 @@ def clearCache(all=False):
|
|||||||
|
|
||||||
cacheDir = ctx.config.cached_packages_dir()
|
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:
|
if not all:
|
||||||
# Cache limits from pisi.conf
|
# Cache limits from pisi.conf
|
||||||
config = pisi.configfile.ConfigurationFile("/etc/pisi/pisi.conf")
|
config = pisi.configfile.ConfigurationFile("/etc/pisi/pisi.conf")
|
||||||
|
|||||||
+1
-1
@@ -383,7 +383,7 @@ class ArchiveZip(ArchiveBase):
|
|||||||
self.zip_obj.writestr(attr, dest)
|
self.zip_obj.writestr(attr, dest)
|
||||||
else:
|
else:
|
||||||
comp_type = zipfile.ZIP_DEFLATED
|
comp_type = zipfile.ZIP_DEFLATED
|
||||||
if file_name.endswith(".lzma"):
|
if file_name.endswith(ctx.const.lzma_suffix):
|
||||||
comp_type = zipfile.ZIP_STORED
|
comp_type = zipfile.ZIP_STORED
|
||||||
self.zip_obj.write(file_name, arc_name, comp_type)
|
self.zip_obj.write(file_name, arc_name, comp_type)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user