Path: csiph.com!news.redatomik.org!aioe.org!bofh.it!news.nic.it!robomod From: Christoph Biedl Newsgroups: linux.debian.bugs.dist,linux.debian.maint.python Subject: Bug#877849: [tryton-debian] Namespace conflict for python-magic Date: Mon, 08 Jan 2018 12:00:02 +0100 Message-ID: References: X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org Mon Jan 8 10:51:10 2018 Old-Return-Path: X-Spam-Flag: NO X-Spam-Score: -3.961 Reply-To: Christoph Biedl , 877849@bugs.debian.org Resent-To: debian-bugs-dist@lists.debian.org Resent-Cc: wnpp@debian.org X-Debian-Pr-Message: followup 877849 X-Debian-Pr-Package: wnpp X-Spam-Bayes: score:0.0000 Tokens: new, 23; hammy, 150; neutral, 136; spammy, 0. spammytokens: hammytokens:0.000-+--H*UA:2014-03-12, 0.000-+--H*u:2014-03-12, 0.000-+--H*u:1.5.23, 0.000-+--H*UA:1.5.23, 0.000-+--H*c:pgp-sha512 MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="uJrvpPjGB3z5kYrA" Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-Debian-Message: from BTS X-Mailing-List: archive/latest/1431809 List-ID: List-URL: Approved: robomod@news.nic.it Lines: 107 Organization: linux.* mail to news gateway Sender: robomod@news.nic.it X-Original-Cc: Mathias Behrle , Tryton package maintenance in Debian , Christos Zoulas , debian-python X-Original-Date: Mon, 8 Jan 2018 11:48:59 +0100 X-Original-Message-ID: <1515408308@msgid.manchmal.in-ulm.de> X-Original-References: <20170904174256.40241925@monsterix.mbehrle.de> <1504545692@msgid.manchmal.in-ulm.de> <20170905130017.1eb29221@monsterix.mbehrle.de> <1504628090@msgid.manchmal.in-ulm.de> <20170906102348.6587419c@monsterix.mbehrle.de> <20171005120116.3a92221a@monsterix.mbehrle.de> <20171027144420.5194574a@monsterix.mbehrle.de> <1507271366@msgid.manchmal.in-ulm.de> <1507271366@msgid.manchmal.in-ulm.de> Xref: csiph.com linux.debian.bugs.dist:874019 linux.debian.maint.python:10023 --uJrvpPjGB3z5kYrA Content-Type: multipart/mixed; boundary="MrRUTeZlqqNo1jQ9" Content-Disposition: inline --MrRUTeZlqqNo1jQ9 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Adam Hupp wrote... > I've pushed an update here: > > https://github.com/ahupp/python-magic/tree/libmagic-compat > > It includes a copy of libmagic's bindings, wrapped in deprecation > warnings. So apps should work regardless of which they depend on. > Could you take a look and see if this works for your case? There are two glitches, you got mails in private about these. Doing a first round of tests showed regressions so far. Hence, here is a preliminary packaging of python-magic for Debian: https://www.in-ulm.de/~cbiedl/debian/python-magic/python-magic_0.4.15-1~exp1.dsc Debianites, please give it a try. About the deprecation warning: I figured out right now (at least for Debian) it would mostly scare users. Once Christos acknowledges your work (hopefully) and deprecates the [file] python-magic implementation, it's about time to alert authors of programs that use python-magic but no earlier. Therefore I created a switch that mutes that warning unless a PYTHONMAGIC_WARN_DEPRECATED environment variable is set, patch below. Using this switch, users can already test whether a particular application needs an adjustment for the [pypi] API. At least in Debian, I expect this transition to take two years anyway. Cheers, Christoph --MrRUTeZlqqNo1jQ9 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="make-deprecation-warning-switchable.patch" Content-Transfer-Encoding: quoted-printable Subject: Make the deprecation warning switchable Author: Christoph Biedl Date: 2018-01-08 Forwarded: soon --- a/magic/__init__.py +++ b/magic/__init__.py @@ -19,6 +19,7 @@ =20 import sys import glob +import os import os.path import ctypes import ctypes.util @@ -325,9 +326,10 @@ =20 def deprecation_wrapper(compat, fn, alternate): def _(*args, **kwargs): - warnings.warn( - "Using compatability mode with libmagic's python binding", - DeprecationWarning) + if "PYTHONMAGIC_WARN_DEPRECATED" in os.environ: + warnings.warn( + "Using compatibility mode with libmagic's python bindi= ng", + DeprecationWarning) =20 return compat[fn](*args, **kwargs) return _ --MrRUTeZlqqNo1jQ9-- --uJrvpPjGB3z5kYrA Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJaU0ybAAoJEMQsWOtZFJL9nrQP/0hEV05RArHVFAyOrazVt0MX dSWM6ManNExtv6WBDMjBZ1f+W5De2zK9jRikFrRAOlmCfBBmEYpLP8l/fuiOgdDg 51WqtIE2e+vdsZoYEH7OrQXHBoKtvXG3tm06JJVXY0Y7q78uBWos3RK3RKKrMyZM f1yLOUCcAtAEexVZUQQoJR2yAjn1c5/gpMGWGclx5Wv0txsI+EUA+67bshlQ1tlK AfBQrd/sDwWAjCiCDh+yZ8LZfYU67OAlRWWvBrLLPMI2NmjbQ7Kk/8tsiCEvtbN4 8Wao+kqDSoKYFVQ40Oc1xIu1U4iKP6sdnShBVFf/DHpIsZkQ7slJy5Ys8M2hYItx xZTFIHxFvBZxB0qxJgmvRdnzC4EnUFJ10RmmbAUEvBEQ1+w2iXVowBZvDgAQ/FyU AY7taEyUbaovflHw8IkDAflVgg0Nz5sNtkLItxKOc0t9/dydH+uVN+bJJCKOJ1ZU ohRT3NLC1pabkPq6e/SRcBogAKRBCRcrnzx4FD+CFOhcMfm7IMWUSKCBrrO9M+hU zpRQuAKGjaoi4BE6G3MikaPP+BQcluJgbTVl5oQoqScGspOR3HPlPEArwRjiodGA wyBcbOG8geT6eCwk1mdwLBAOvVCU9iISl20gglBze1/TfS027wEDmr0h/8Ur87oh hb6mY+6OaM/j8OfkXnii =gMQZ -----END PGP SIGNATURE----- --uJrvpPjGB3z5kYrA--