Commit 82a4ee01 authored by patrick's avatar patrick

Mettre à jour examples/python/empty_transaction.py

parent c7284d94
...@@ -8,14 +8,17 @@ def on_emit_action (transaction, action, data): ...@@ -8,14 +8,17 @@ def on_emit_action (transaction, action, data):
print(action) print(action)
def on_emit_action_progress (transaction, action, status, progress, data): def on_emit_action_progress (transaction, action, status, progress, data):
print("{} {}".format(action, status)) print(f"{action} {status}")
def on_emit_hook_progress (transaction, action, details, status, progress, data):
print(f"{action} {details} {status}")
def on_emit_warning (transaction, message, data): def on_emit_warning (transaction, message, data):
print(message) print(message)
def on_emit_error (transaction, message, details, details_length, data): def on_emit_error (transaction, message, details, details_length, data):
if details_length > 0: if details_length > 0:
print("{}:".format(message)) print(f"{message}:")
for detail in details: for detail in details:
print(detail) print(detail)
else: else:
...@@ -29,9 +32,10 @@ def start_transaction(): ...@@ -29,9 +32,10 @@ def start_transaction():
to_remove = [] to_remove = []
to_load = [] to_load = []
to_build = [] to_build = []
temporary_ignorepkgs = []
overwrite_files = [] overwrite_files = []
if transaction.get_lock(): if transaction.get_lock():
transaction.start (to_install, to_remove, to_load, to_build, overwrite_files) transaction.start (to_install, to_remove, to_load, to_build, temporary_ignorepkgs, overwrite_files)
# launch a loop to wait for finished signal to be emitted # launch a loop to wait for finished signal to be emitted
loop.run() loop.run()
...@@ -48,6 +52,7 @@ if __name__ == "__main__": ...@@ -48,6 +52,7 @@ if __name__ == "__main__":
data = None data = None
transaction.connect ("emit-action", on_emit_action, data) transaction.connect ("emit-action", on_emit_action, data)
transaction.connect ("emit-action-progress", on_emit_action_progress, data) transaction.connect ("emit-action-progress", on_emit_action_progress, data)
transaction.connect ("emit-hook-progress", on_emit_hook_progress, data)
transaction.connect ("emit-error", on_emit_error, data) transaction.connect ("emit-error", on_emit_error, data)
transaction.connect ("emit-warning", on_emit_warning, data) transaction.connect ("emit-warning", on_emit_warning, data)
transaction.connect ("finished", on_trans_finished, data) transaction.connect ("finished", on_trans_finished, data)
......
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