first provides implementation, smarter than pacman ;)
This commit is contained in:
parent
d08e0aac2f
commit
6119f97126
@ -4,6 +4,7 @@
|
|||||||
<object class="GtkDialog" id="ChooseDialog">
|
<object class="GtkDialog" id="ChooseDialog">
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="border_width">5</property>
|
<property name="border_width">5</property>
|
||||||
|
<property name="title" translatable="yes"> </property>
|
||||||
<property name="modal">True</property>
|
<property name="modal">True</property>
|
||||||
<property name="window_position">center-on-parent</property>
|
<property name="window_position">center-on-parent</property>
|
||||||
<property name="type_hint">dialog</property>
|
<property name="type_hint">dialog</property>
|
||||||
@ -42,7 +43,7 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel" id="chooselabel">
|
<object class="GtkLabel" id="choose_label">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="label" translatable="yes">label</property>
|
<property name="label" translatable="yes">label</property>
|
||||||
|
@ -29,6 +29,7 @@ top_label = interface.get_object('top_label')
|
|||||||
bottom_label = interface.get_object('bottom_label')
|
bottom_label = interface.get_object('bottom_label')
|
||||||
ChooseDialog = interface.get_object('ChooseDialog')
|
ChooseDialog = interface.get_object('ChooseDialog')
|
||||||
choose_list = interface.get_object('choose_list')
|
choose_list = interface.get_object('choose_list')
|
||||||
|
choose_label = interface.get_object('choose_label')
|
||||||
|
|
||||||
installed_column.set_sort_column_id(1)
|
installed_column.set_sort_column_id(1)
|
||||||
name_column.set_sort_column_id(0)
|
name_column.set_sort_column_id(0)
|
||||||
@ -317,6 +318,7 @@ def choose_provides():
|
|||||||
to_check = []
|
to_check = []
|
||||||
depends = []
|
depends = []
|
||||||
provides = {}
|
provides = {}
|
||||||
|
already_provided = False
|
||||||
for pkgname in transaction.to_add:
|
for pkgname in transaction.to_add:
|
||||||
for repo in transaction.handle.get_syncdbs():
|
for repo in transaction.handle.get_syncdbs():
|
||||||
pkg = repo.get_pkg(pkgname)
|
pkg = repo.get_pkg(pkgname)
|
||||||
@ -334,10 +336,6 @@ def choose_provides():
|
|||||||
if pkg.name in depends:
|
if pkg.name in depends:
|
||||||
depends.remove(pkg.name)
|
depends.remove(pkg.name)
|
||||||
if depends:
|
if depends:
|
||||||
for installed_pkg in transaction.handle.get_localdb().pkgcache:
|
|
||||||
for name in pkg.provides:
|
|
||||||
if common.format_pkg_name(name) in depends:
|
|
||||||
depends.remove(common.format_pkg_name(name))
|
|
||||||
for repo in transaction.handle.get_syncdbs():
|
for repo in transaction.handle.get_syncdbs():
|
||||||
for pkg in repo.pkgcache:
|
for pkg in repo.pkgcache:
|
||||||
for depend in depends:
|
for depend in depends:
|
||||||
@ -350,7 +348,6 @@ def choose_provides():
|
|||||||
if provides:
|
if provides:
|
||||||
for virtualdep, liste in provides.items():
|
for virtualdep, liste in provides.items():
|
||||||
if ('-module' in virtualdep) or ('linux' in virtualdep):
|
if ('-module' in virtualdep) or ('linux' in virtualdep):
|
||||||
print('choose module')
|
|
||||||
pkgs = transaction.handle.get_localdb().search('linux3')
|
pkgs = transaction.handle.get_localdb().search('linux3')
|
||||||
installed_linux = []
|
installed_linux = []
|
||||||
to_remove_from_add = []
|
to_remove_from_add = []
|
||||||
@ -375,7 +372,15 @@ def choose_provides():
|
|||||||
if not transaction.handle.get_localdb().get_pkg(name):
|
if not transaction.handle.get_localdb().get_pkg(name):
|
||||||
if linux in name:
|
if linux in name:
|
||||||
transaction.to_add.append(name)
|
transaction.to_add.append(name)
|
||||||
|
already_provided = True
|
||||||
|
for installed_pkg in transaction.handle.get_localdb().pkgcache:
|
||||||
|
for name in installed_pkg.provides:
|
||||||
|
if common.format_pkg_name(name) == virtualdep:
|
||||||
|
already_provided = True
|
||||||
|
if already_provided:
|
||||||
|
pass
|
||||||
else:
|
else:
|
||||||
|
choose_label.set_markup('<b>{} is provided by {} packages.\nPlease choose the one(s) you want to install:</b>'.format(virtualdep,str(len(liste))))
|
||||||
choose_list.clear()
|
choose_list.clear()
|
||||||
for name in liste:
|
for name in liste:
|
||||||
if transaction.handle.get_localdb().get_pkg(name):
|
if transaction.handle.get_localdb().get_pkg(name):
|
||||||
@ -599,7 +604,6 @@ class Handler:
|
|||||||
if choose_list[line][1] in transaction.to_add:
|
if choose_list[line][1] in transaction.to_add:
|
||||||
transaction.to_add.remove(choose_list[line][1])
|
transaction.to_add.remove(choose_list[line][1])
|
||||||
line += 1
|
line += 1
|
||||||
print(transaction.to_add)
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
interface.connect_signals(Handler())
|
interface.connect_signals(Handler())
|
||||||
|
Loading…
Reference in New Issue
Block a user