import asyncio
import argparse
-import os.path
import sys
import tempfile
-import time
import pakfire.config
import pakfire.hub
help=_("One or multiple IDs"))
upload_delete.set_defaults(func=self._delete_upload)
- # watch-build
- watch_build = subparsers.add_parser("watch-build",
- help=_("Watch the status of a build"))
- watch_build.add_argument("id",
- help=_("Build ID"))
- watch_build.set_defaults(func=self._watch_build)
-
- # watch-job
- watch_job = subparsers.add_parser("watch-job",
- help=_("Watch the status of a job"))
- watch_job.add_argument("id",
- help=_("Job ID"))
- watch_job.set_defaults(func=self._watch_job)
-
args = parser.parse_args()
# Print usage if no action was given
print(_("Deleted upload %s") % upload_id)
- async def _watch_build(self, hub, ns):
- build = hub.get_build(ns.id[0])
-
- return self._watch_something(build)
-
- async def _watch_job(self, hub, ns):
- job = hub.get_job(ns.id[0])
-
- return self._watch_something(job)
-
- async def _watch_something(self, o):
- while True:
- s = o.dump()
- print(s)
-
- # Break the loop if the build/job is not active any more
- # (since we don't expect any changes)
- if not o.is_active():
- break
-
- time.sleep(60)
-
- # Update data before the next loop is shown
- o.refresh()
-
if __name__ == "__main__":
c = Cli()