Kaydet (Commit) 9f7130f8 authored tarafından Suleyman Poyraz's avatar Suleyman Poyraz

Kritik script düzenlemeleri

İmport edilmesi unutulan moduller temizlendi ve gereklilikler kontrol edildi.
cmp fonksiyonu yerine basit bir karşılaştırma ifadesi kullanıldı.
class parametresi yapılan repolist silindi.
üst 9c059fff
......@@ -157,12 +157,12 @@ def LDFLAGS():
def makeJOBS():
# Note: "auto" only works when /sys is mounted.
if env.jobs == "auto":
procs = 4
try:
procs = multiprocessing.cpu_count()
env.jobs = procs
except Exception as e:
ctx.ui.warning("Unable to retrieve CPU count: %s" % e)
env.jobs = 4
return env.jobs
......
......@@ -80,7 +80,7 @@ def install(parameters='install'):
if system('make {}'.format(parameters)):
raise InstallError(_('Make failed.'))
else:
if system('perl{} Build install'.get.curPERL()):
if system('perl{} Build install'.format(get.curPERL())):
raise MakeError(_('perl install failed.'))
removePacklist()
......
......@@ -58,7 +58,7 @@ Lists the packages that will be upgraded.
upgradable_pkgs = list(filter(is_upgradable, installdb.list_installed()))
# replaced packages can not pass is_upgradable test, so we add them manually
upgradable_pkgs.extend(list_replaces())
# upgradable_pkgs.extend(list_replaces())
# consider also blacklist filtering
upgradable_pkgs = inary.blacklist.exclude_from(upgradable_pkgs, ctx.const.blacklist)
......
......@@ -22,6 +22,7 @@ import inary.cli.command as command
import inary.context as ctx
from inary.operations import remove
import inary.db
import inary.blacklist
class RemoveOrphaned(command.PackageOp, metaclass=command.autocommand):
......
......@@ -37,6 +37,7 @@ import inary.analyzer.conflict
import inary.data.component as component
import inary.data.group as group
import inary.util as util
import inary.errors
import inary.db
......
......@@ -23,7 +23,6 @@ class ItemByRepo:
def __init__(self, dbobj, compressed=False):
self.dbobj = dbobj
self.compressed = compressed
self.repolist = inary.db.repodb.RepoDB().list_repos()
def has_repo(self, repo):
return repo in self.dbobj
......@@ -36,7 +35,7 @@ class ItemByRepo:
return False
def which_repo(self, item):
for r in self.repolist:
for r in inary.db.repodb.RepoDB().list_repos():
if r in self.dbobj and item in self.dbobj[r]:
return r
......@@ -95,4 +94,4 @@ class ItemByRepo:
repos = [repo]
return repos
else:
return self.repolist
return inary.db.repodb.RepoDB().list_repos()
......@@ -793,7 +793,7 @@ def strip_file(filepath, fileinfo, outpath):
def partition_freespace(directory):
"""Return free space of given directory's partition."""
st = os.statvfs(directory)
return st[os.fstatvfs.F_BSIZE] * st[os.fstatvfs.F_BFREE]
return st.f_frsize * st.f_bfree
########################################
......
......@@ -19,7 +19,6 @@ import gettext
__trans = gettext.translation('inary', fallback=True)
_ = __trans.gettext
import inary
import inary.errors
# Basic rule is:
......@@ -90,10 +89,11 @@ class Version(object):
return self.__version_string
def compare(self, ver):
# In old code it was written with cmp().
if isinstance(ver, str):
return cmp(self.__version, make_version(ver))
return (self.__version > make_version(ver)) - (self.__version < make_version(ver))
return cmp(self.__version, ver.__version)
return (self.__version > ver.__version) - (self.__version < ver.__version)
def __lt__(self, rhs):
if isinstance(rhs, str):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment