Use make_version instead of Version class

Also use int for release numbers.
This commit is contained in:
Fatih Aşıcı
2010-03-08 12:09:37 +00:00
parent 9802f80d1f
commit 39ae683a8f
3 changed files with 12 additions and 8 deletions
+1 -1
View File
@@ -589,7 +589,7 @@ class Builder:
def check_versioning(self, version, release):
try:
int(release)
pisi.version.Version(version)
pisi.version.make_version(version)
except (ValueError, InvalidVersionError):
raise Error(_("%s-%s is not a valid PiSi version format") % (version, release))
+9 -5
View File
@@ -67,10 +67,12 @@ def find_upgrades(packages, replaces):
if not security_update:
continue
if pkg.distribution == distro and pisi.version.Version(pkg.distributionRelease) > pisi.version.Version(distro_release):
if pkg.distribution == distro and \
pisi.version.make_version(pkg.distributionRelease) > pisi.version.make_version(distro_release):
Ap.append(i_pkg)
elif ignore_build or (not build) or (not pkg.build):
if pisi.version.Version(release) < pisi.version.Version(pkg.release):
if int(release) < int(pkg.release):
Ap.append(i_pkg)
else:
ctx.ui.info(_('Package %s is already at the latest release %s.')
@@ -308,13 +310,14 @@ def upgrade_base(A = set()):
def is_upgradable(name, ignore_build = False):
installdb = pisi.db.installdb.InstallDB()
packagedb = pisi.db.packagedb.PackageDB()
if not installdb.has_package(name):
return False
(i_version, i_release, i_build, i_distro, i_distro_release) = installdb.get_version_and_distro_release(name)
packagedb = pisi.db.packagedb.PackageDB()
try:
version, release, build, distro, distro_release = packagedb.get_version_and_distro_release(name, packagedb.which_repo(name))
except KeyboardInterrupt:
@@ -322,9 +325,10 @@ def is_upgradable(name, ignore_build = False):
except Exception: #FIXME: what exception could we catch here, replace with that.
return False
if distro == i_distro and pisi.version.Version(distro_release) > pisi.version.Version(i_distro_release):
if distro == i_distro and \
pisi.version.make_version(distro_release) > pisi.version.make_version(i_distro_release):
return True
elif ignore_build or (not i_build) or (not build):
return pisi.version.Version(i_release) < pisi.version.Version(release)
return int(i_release) < int(release)
else:
return i_build < build
+2 -2
View File
@@ -661,8 +661,8 @@ def filter_latest_packages(package_paths):
continue
elif l_release == r_release:
l_version = pisi.version.Version(l_version)
r_version = pisi.version.Version(r_version)
l_version = pisi.version.make_version(l_version)
r_version = pisi.version.make_version(r_version)
if l_version > r_version:
continue