This results in a major refactor of the code to use launchpadlib directly
instead of the ubuntutools.lp.lpapicache module in ubuntu-dev-tools which is
idiosyncratic and does not expose the full launchpad API. Easier to rewrite
to use the standard library.
Do it at the begin instead of replicating the same code inside the tool itself.
This fixes e.g. this failure:
./ubuntu-build --batch --retry morsmall
Traceback (most recent call last):
File "/tmp/ubuntu-dev-tools/ubuntu-build", line 317, in <module>
main()
File "/tmp/ubuntu-dev-tools/ubuntu-build", line 289, in main
can_retry = args.retry and me.canUploadPackage(
AttributeError: 'NoneType' object has no attribute 'canUploadPackage'
pylint complains about C0209: Formatting a regular string which could be
a f-string (consider-using-f-string)
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
pylint complains about W1201: Use lazy % formatting in logging functions
(logging-not-lazy) and W1203: Use lazy % formatting in logging functions
(logging-fstring-interpolation).
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
Python logging by default sends all output to stderr, but that's not what
normal programs usually do and is not expected for these scripts.
Change the ubuntutools.getLogger() method to return a logger with handlers
correctly set up to send INFO level (or lower) logs to stdout and WARNING
level (or higher; technically INFO+1 level or higher) logs to stderr.
This results in normally logged output going to stdout and warnings/errors
going to stderr, as expected.
* PersonTeam.canUploadPackage() can now also check package sets for upload
permissions. This requires now to also pass the distroseries as package sets
are per distroseries.
* Drop PersonTeam.isPerPackageUploader() as it's also handled by canUploadPackage()
ubuntu-build: Update for the PersonTeam.canUploadChange().
ubuntutools/requestsync/{lp,mail}.py:
* needSponsorship() now also expects a release name because of the above mentioned
change to PersonTeam.canUploadPackage().
requestsync: Update for needSponsorship() change.