Path: csiph.com!newsfeed.xs4all.nl!newsfeed9.news.xs4all.nl!bofh.it!news.nic.it!robomod From: Julian Gilbey Newsgroups: linux.debian.maint.python Subject: Re: Advice wanted: handling weird vendoring situation Date: Tue, 08 Feb 2022 08:10:01 +0100 Message-ID: References: X-Mailbox-Line: From debian-python-request@lists.debian.org Tue Feb 8 07:04:22 2022 Old-Return-Path: X-Amavis-Spam-Status: No, score=-5.407 tagged_above=-10000 required=5.3 tests=[BAYES_00=-2, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, LDO_WHITELIST=-5, RDNS_NONE=0.793, WORD_WITHOUT_VOWELS=1] autolearn=no autolearn_force=no X-Policyd-Weight: using cached result; rate:hard: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Mailing-List: archive/latest/19748 List-ID: List-URL: List-Archive: https://lists.debian.org/msgid-search/YgIV6US1LavT+KXS@d-and-j.net Approved: robomod@news.nic.it Lines: 36 Organization: linux.* mail to news gateway Sender: robomod@news.nic.it X-Original-Date: Tue, 8 Feb 2022 07:04:09 +0000 X-Original-Message-ID: X-Original-References: Xref: csiph.com linux.debian.maint.python:13935 On Mon, Feb 07, 2022 at 09:27:28PM +0000, Julian Gilbey wrote: > [...] > > I thought I could address this issue by replacing the vendored copies > of the library modules by symlinks to /usr/lib/python3.X/, but now > I've hit another snag: some of these modules import other modules. > For example: > > pydev_imps/_pydev_SimpleXMLRPCServer.py > is a very old version of /usr/lib/python3.X/xmlrpc/server.py. It > contains within it the following lines: > > from _pydev_imps import _pydev_xmlrpclib as xmlrpclib > from _pydev_imps._pydev_xmlrpclib import Fault > from _pydev_imps import _pydev_SocketServer as SocketServer > from _pydev_imps import _pydev_BaseHTTPServer as BaseHTTPServer > [...] > Perhaps another possibility is to have symlinks in the _pydev_imps > directory to the standard library versions and then temporarily modify > sys.path to look in _pydev_imps before looking in standard locations. > I don't know whether this will work, though. I realise now that this "nice" solution won't work, as the standard library code says: import socketserver so modifying sys.path will just change the value of sys.modules["socketserver"]. However, the vendored code instead loads this module to sys.modules["_pydev_imps._pydev_SocketServer"] or something like that, deliberately avoiding interfering with sys.modules["socketserver"]. Ho hum. Julian