mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-18 10:26:29 +01:00
Updated version from GetFromInstalled class
Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
parent
b219415326
commit
cb0324b9f6
7 changed files with 18 additions and 11 deletions
|
@ -1399,7 +1399,7 @@ Check for the installed packages:
|
|||
>>> GetFromInstalled(package="ffmpeg").name()
|
||||
'ffmpeg'
|
||||
>>> GetFromInstalled(package="ffmpeg").version()
|
||||
'-3.2.4'
|
||||
'3.2.4'
|
||||
```
|
||||
|
||||
##### Copyright
|
||||
|
|
|
@ -244,7 +244,7 @@ class BinaryInstall(BlackList, Utils):
|
|||
installed"""
|
||||
name = split_package(package)[0]
|
||||
rep_ver = split_package(package)[1]
|
||||
ins_ver = GetFromInstalled(name).version()[1:]
|
||||
ins_ver = GetFromInstalled(name).version()
|
||||
if not ins_ver:
|
||||
ins_ver = "0"
|
||||
if parse_version(rep_ver) < parse_version(ins_ver):
|
||||
|
@ -301,6 +301,8 @@ class BinaryInstall(BlackList, Utils):
|
|||
COLOR = self.meta.color["RED"]
|
||||
uni_sum += 1
|
||||
ver = GetFromInstalled(pkg_repo[0]).version()
|
||||
if ver:
|
||||
ver = f"-{ver}"
|
||||
print(f" {COLOR}{pkg_repo[0] + ver}{self.endc}"
|
||||
f"{' ' * (23-len(pkg_repo[0] + ver))} {pkg_repo[1]}"
|
||||
f"{' ' * (18-len(pkg_repo[1]))} {pkg_repo[2]}"
|
||||
|
|
|
@ -46,7 +46,7 @@ class GetFromInstalled:
|
|||
"""Return version from installed packages
|
||||
"""
|
||||
if self.find:
|
||||
return self.meta.sp + split_package(self.find)[1]
|
||||
return split_package(self.find)[1]
|
||||
return ""
|
||||
|
||||
def name(self):
|
||||
|
|
|
@ -187,7 +187,8 @@ class PackageManager(Utils):
|
|||
for pkg in self.binary:
|
||||
name = GetFromInstalled(pkg).name()
|
||||
ver = GetFromInstalled(pkg).version()
|
||||
package = find_package(f"{name}{ver}{self.meta.sp}", self.meta.pkg_path)
|
||||
package = find_package(f"{name}-{ver}{self.meta.sp}",
|
||||
self.meta.pkg_path)
|
||||
if pkg and name == pkg:
|
||||
removed.append(pkg)
|
||||
packages.append(package[0])
|
||||
|
@ -257,7 +258,7 @@ class PackageManager(Utils):
|
|||
for dep in dependencies:
|
||||
if GetFromInstalled(dep).name():
|
||||
ver = GetFromInstalled(dep).version()
|
||||
packages.append(dep + ver)
|
||||
packages.append(f"{dep}-{ver}")
|
||||
else:
|
||||
dependencies.remove(dep)
|
||||
if packages:
|
||||
|
@ -307,7 +308,7 @@ class PackageManager(Utils):
|
|||
for dep in dependencies:
|
||||
if dep not in self.skip and GetFromInstalled(dep).name():
|
||||
ver = GetFromInstalled(dep).version()
|
||||
removes.append(dep + ver)
|
||||
removes.append(f"{dep}-{ver}")
|
||||
self._removepkg(dep)
|
||||
return removes
|
||||
|
||||
|
@ -317,7 +318,7 @@ class PackageManager(Utils):
|
|||
removes = []
|
||||
if GetFromInstalled(package).name() and package not in self.skip:
|
||||
ver = GetFromInstalled(package).version()
|
||||
removes.append(package + ver)
|
||||
removes.append(f"{package}-{ver}")
|
||||
self._removepkg(package)
|
||||
return removes
|
||||
|
||||
|
@ -453,7 +454,7 @@ class PackageManager(Utils):
|
|||
for pkg in self.binary:
|
||||
name = GetFromInstalled(pkg).name()
|
||||
ver = GetFromInstalled(pkg).version()
|
||||
find = find_package(f"{name}{ver}{self.meta.sp}",
|
||||
find = find_package(f"{name}-{ver}{self.meta.sp}",
|
||||
self.meta.pkg_path)
|
||||
if find:
|
||||
package = self.read_file(
|
||||
|
|
|
@ -269,6 +269,8 @@ class SBoInstall(BlackList, Utils):
|
|||
args[3] arch
|
||||
"""
|
||||
ver = GetFromInstalled(args[1]).version()
|
||||
if ver:
|
||||
ver = f"-{ver}"
|
||||
print(f" {args[0]}{args[1] + ver} {self.endc}"
|
||||
f"{' ' * (24-len(args[1] + ver))}{args[2]}"
|
||||
f"{' ' * (18-len(args[2]))} {args[3]}"
|
||||
|
@ -372,7 +374,7 @@ class SBoInstall(BlackList, Utils):
|
|||
installed"""
|
||||
name = "-".join(prgnam.split("-")[:-1])
|
||||
sbo_ver = prgnam.split("-")[-1]
|
||||
ins_ver = GetFromInstalled(name).version()[1:]
|
||||
ins_ver = GetFromInstalled(name).version()
|
||||
if not ins_ver:
|
||||
ins_ver = "0"
|
||||
if parse_version(sbo_ver) < parse_version(ins_ver):
|
||||
|
|
|
@ -142,7 +142,7 @@ class Patches(BlackList, Utils):
|
|||
if (GetFromInstalled(pkg_name).name() and
|
||||
repo_pkg_name not in black and
|
||||
repo_pkg_name not in self.skip and
|
||||
pkg_ver > GetFromInstalled(pkg_name).version()[1:]):
|
||||
pkg_ver > GetFromInstalled(pkg_name).version()):
|
||||
self.dwn_links.append(f"{mirrors('', '')}{loc}/{name}")
|
||||
self.comp_sum.append(comp)
|
||||
self.uncomp_sum.append(uncomp)
|
||||
|
@ -203,6 +203,8 @@ class Patches(BlackList, Utils):
|
|||
if pkg_repo[0] == pkg_inst:
|
||||
color = self.yellow
|
||||
ver = GetFromInstalled(pkg_repo[0]).version()
|
||||
if ver:
|
||||
ver = f"-{ver}"
|
||||
print(f" {color}{pkg_repo[0] + ver}{self.endc}"
|
||||
f"{' ' * (23-len(pkg_repo[0] + ver))} {pkg_repo[1]}"
|
||||
f"{' ' * (18-len(pkg_repo[1]))} {pkg_repo[2]}"
|
||||
|
|
|
@ -38,7 +38,7 @@ def choose_upg(packages):
|
|||
for pkg in packages:
|
||||
name = GetFromInstalled(pkg).name()
|
||||
ver = GetFromInstalled(pkg).version()
|
||||
binary = f"{name}{ver}"
|
||||
binary = f"{name}-{ver}"
|
||||
installed = find_package(binary + _meta_.sp, _meta_.pkg_path)[0]
|
||||
data.append(installed)
|
||||
text = "Press 'spacebar' to unchoose packages from upgrade"
|
||||
|
|
Loading…
Reference in a new issue