[elbe-devel] [PATCH 1/1] cdrom: ignore deprecation warning
Torben Hohn
torben.hohn at linutronix.de
Fri Apr 5 10:07:52 CEST 2019
On Fri, Apr 05, 2019 at 06:52:18AM +0200, Manuel Traut wrote:
> python-apt from debian/stretch produces another deprecation warning.
> ignore it, to be able to build cdroms again:
>
> --8<--
> Build failed
> Traceback (most recent call last):
> File "/var/cache/elbe/devel/elbepack/asyncworker.py", line 158, in execute
> skip_pbuild=self.skip_pbuilder)
> File "/var/cache/elbe/devel/elbepack/elbeproject.py", line 582, in build
> self.build_cdroms(build_bin, build_sources, cdrom_size)
> File "/var/cache/elbe/devel/elbepack/elbeproject.py", line 405, in build_cdroms
> cdrom_size=cdrom_size)
> File "/var/cache/elbe/devel/elbepack/cdroms.py", line 159, in mk_binary_cdrom
> pkg.installed_version)
> File "<string>", line 2, in download_binary
> File "/usr/lib/python2.7/multiprocessing/managers.py", line 774, in _callmethod
> raise convert_to_error(kind, result)
> DeprecationWarning: MD5Hash is deprecated, use Hashes instead
>
> Exception:
> MD5Hash is deprecated, use Hashes instead
> --8<--
>
> Signed-off-by: Manuel Traut <manut at linutronix.de>
I dont like that pattern.
But its used already...
Acked-by: Torben Hohn <torben.hohn at linutronix.de>
some day we should put the warnings catcher into wrapper functions,
so that the actual code is esier to read.
> DeprecationWarning: MD5Hash is deprecated, use Hashes in
> ---
> elbepack/rpcaptcache.py | 26 +++++++++++++++++++-------
> 1 file changed, 19 insertions(+), 7 deletions(-)
>
> diff --git a/elbepack/rpcaptcache.py b/elbepack/rpcaptcache.py
> index c5487aaf..d621a5e9 100644
> --- a/elbepack/rpcaptcache.py
> +++ b/elbepack/rpcaptcache.py
> @@ -247,10 +247,15 @@ class RPCAPTCache(InChRootObject):
> pkgver = p.installed
> else:
> pkgver = p.versions[version]
> -
> - rel_filename = pkgver.fetch_binary(path,
> - ElbeAcquireProgress())
> - return self.rfs.fname(rel_filename)
> + # avoid DeprecationWarning:
> + # "MD5Hash is deprecated, use Hashes instead"
> + # triggerd by python-apt
> + with warnings.catch_warnings():
> + warnings.filterwarnings("ignore",
> + category=DeprecationWarning)
> + rel_filename = pkgver.fetch_binary(path,
> + ElbeAcquireProgress())
> + return self.rfs.fname(rel_filename)
>
> def download_source(self, pkgname, path, version=None):
> p = self.cache[pkgname]
> @@ -259,9 +264,16 @@ class RPCAPTCache(InChRootObject):
> else:
> pkgver = p.versions[version]
>
> - rel_filename = pkgver.fetch_source(path,
> - ElbeAcquireProgress(), unpack=False)
> - return self.rfs.fname(rel_filename)
> + # avoid DeprecationWarning:
> + # "MD5Hash is deprecated, use Hashes instead"
> + # triggerd by python-apt
> + with warnings.catch_warnings():
> + warnings.filterwarnings("ignore",
> + category=DeprecationWarning)
> + rel_filename = pkgver.fetch_source(path,
> + ElbeAcquireProgress(),
> + unpack=False)
> + return self.rfs.fname(rel_filename)
>
>
> class MyMan(BaseManager):
> --
> 2.20.1
>
--
Torben Hohn
Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen
Phone: +49 7556 25 999 18; Fax.: +49 7556 25 999 99
Hinweise zum Datenschutz finden Sie hier (Informations on data privacy
can be found here): https://linutronix.de/kontakt/Datenschutz.php
Linutronix GmbH | Firmensitz (Registered Office): Uhldingen-Mühlhofen |
Registergericht (Registration Court): Amtsgericht Freiburg i.Br., HRB700
806 | Geschäftsführer (Managing Directors): Heinz Egger, Thomas Gleixner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.linutronix.de/pipermail/elbe-devel/attachments/20190405/38b6d48e/attachment.sig>
More information about the elbe-devel
mailing list