Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 702016 - dev-libs/newt, dev-libs/libxml2: py3.7+3.8 site-packages installed into lib64 instead of lib
Summary: dev-libs/newt, dev-libs/libxml2: py3.7+3.8 site-packages installed into lib64...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Linux Gnome Desktop Team
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2019-12-05 02:55 UTC by email200202
Modified: 2024-01-08 17:14 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (build.log,318.13 KB, text/plain)
2019-12-05 02:56 UTC, email200202
Details
emerge -pqv '=app-text/gnome-doc-utils-0.20.10-r2::gentoo' (file_702016.txt,197 bytes, text/plain)
2019-12-05 02:57 UTC, email200202
Details
emerge --info '=app-text/gnome-doc-utils-0.20.10-r2::gentoo' (file_702016.txt,6.90 KB, text/plain)
2019-12-05 02:58 UTC, email200202
Details

Note You need to log in before you can comment on or make changes to this bug.
Description email200202 2019-12-05 02:55:22 UTC
Traceback (most recent call last):
  File "/var/tmp/portage/app-text/gnome-doc-utils-0.20.10-r2/work/gnome-doc-utils-0.20.10-python3_8/xml2po/xml2po/xml2po", line 191, in <module>
    main(sys.argv[1:])
  File "/var/tmp/portage/app-text/gnome-doc-utils-0.20.10-r2/work/gnome-doc-utils-0.20.10-python3_8/xml2po/xml2po/xml2po", line 88, in main
    from xml2po import Main
  File "/var/tmp/portage/app-text/gnome-doc-utils-0.20.10-r2/work/gnome-doc-utils-0.20.10/xml2po/xml2po/__init__.py", line 27, in <module>
    import libxml2
ModuleNotFoundError: No module named 'libxml2'
make[2]: *** [Makefile:684: de/gnome-doc-make.xml] Error 1
make[2]: Leaving directory '/var/tmp/portage/app-text/gnome-doc-utils-0.20.10-r2/work/gnome-doc-utils-0.20.10-python


Reproducible: Always

Steps to Reproduce:
1. emerge --sync
2. emerge -auvDN world

Actual Results:  
app-text/gnome-doc-utils-0.20.10-r2 failed to build

Expected Results:  
It should not fail.
Comment 1 email200202 2019-12-05 02:56:42 UTC
Created attachment 598504 [details]
build.log
Comment 2 email200202 2019-12-05 02:57:47 UTC
Created attachment 598506 [details]
emerge -pqv '=app-text/gnome-doc-utils-0.20.10-r2::gentoo'
Comment 3 email200202 2019-12-05 02:58:44 UTC
Created attachment 598508 [details]
emerge --info '=app-text/gnome-doc-utils-0.20.10-r2::gentoo'
Comment 4 Doppler 2019-12-05 13:51:46 UTC
The same thing happens here with both gnome-doc-utils and dev-util/itstool and I believe it boils down to dev-libs/libxml2 installing its Python 3.8 modules in a strange place.
Newer Pythons (3.7, 3.8) seemingly switched to only using /usr/lib/python${version} for module search paths, and while libxml2 correctly installs the 3.7 module files in /usr/lib/ it, for some reason, installs the Python 3.8 module files in /usr/lib64/, which won't be looked in by default.

I have a large amount of python 3.7 and 3.8 packages and almost everything is in /usr/lib/python3.{7,8}. This is what I get for `find /usr/lib64/python3.8`:

/usr/lib64/python3.8
/usr/lib64/python3.8/site-packages
/usr/lib64/python3.8/site-packages/snack.py
/usr/lib64/python3.8/site-packages/libxml2.py
/usr/lib64/python3.8/site-packages/libxml2mod.so
/usr/lib64/python3.8/site-packages/drv_libxml2.py


And for `find /usr/lib64/python3.7`:

/usr/lib64/python3.7
/usr/lib64/python3.7/site-packages
/usr/lib64/python3.7/site-packages/snack.py


(So, dev-libs/newt, a different non-multilib package appears to be misbehaving as well).
On a side note, this appears to have a side effect of causing the bytecode files to not get compiled as well?
Comment 5 Andreas Sturmlechner gentoo-dev 2019-12-06 21:43:00 UTC
Aaron, do you have an idea what might be happening there with these python-r1 packages?
Comment 6 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2019-12-07 16:20:29 UTC
I'm investigating this.  Updating the title to reflect broken packages correctly.
Comment 7 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2019-12-07 16:43:48 UTC
Well, it is as I've suspected.

1. dev-libs/newt is definitely broken and installs its Python modules to the incorrect directory.

2. dev-libs/libxml2 normally installs it fine but if /usr/lib64/python3.8/site-packages exists already, it uses that directory instead.
Comment 8 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2019-12-07 16:48:59 UTC
In case of newt, the issue is pretty clear -- the install path is hardcoded in Makefile.in:

  [ -n "$(PYTHONVERS)" ] && for ver in $(PYTHONVERS) ; do \
    [ -d $(instroot)/$(libdir)/$$ver/site-packages ] || install -m 755 -d $(instroot)/$(libdir)/$$ver/site-packages ;\
    install -m 755 $$ver/_snack.$(SOEXT) $(instroot)/$(libdir)/$$ver/site-packages ;\
    install -m 644 snack.py $(instroot)/$(libdir)/$$ver/site-packages ;\
  done || :
Comment 9 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2019-12-07 16:53:10 UTC
libxml2 also uses home-made code to detect Python, and it guesses site-packages directory based on directories that exist:

  if test "$with_python_install_dir" != ""
  then
    PYTHON_SITE_PACKAGES="$with_python_install_dir"
  fi
  if test "$PYTHON_VERSION" != "" -a "$PYTHON_SITE_PACKAGES" = ""
  then
    if test -d $libdir/python$PYTHON_VERSION/site-packages
    then
      PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
    else
      if test -d $with_python/lib/site-packages
      then
        PYTHON_SITE_PACKAGES=$with_python/lib/site-packages
      else
        PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_lib())"`
      fi
    fi
  fi

Apparently upstream decides to do the correct thing only if all else fails.  However, here it can be easily worked around via passing --with-python-install-dir, I think.
Comment 10 Larry the Git Cow gentoo-dev 2019-12-07 16:58:59 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cbadb28169dcfdf182f721fba55ac2d51dbc4f1b

commit cbadb28169dcfdf182f721fba55ac2d51dbc4f1b
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: 2019-12-07 16:45:37 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2019-12-07 16:58:53 +0000

    dev-libs/newt: Remove py3.7&3.8 as they're broken
    
    The module is installed into incorrect directory when using Python 3.7
    and 3.8, which in turn exposes breakage in other packages.
    
    Bug: https://bugs.gentoo.org/702016
    Signed-off-by: Michał Górny <mgorny@gentoo.org>

 dev-libs/newt/newt-0.52.21.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 11 Larry the Git Cow gentoo-dev 2019-12-07 20:31:37 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3ac390cc82d42c6d50dcff61b9884dbf19b03e7d

commit 3ac390cc82d42c6d50dcff61b9884dbf19b03e7d
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: 2019-12-07 19:52:39 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2019-12-07 20:31:29 +0000

    dev-libs/libxml2: Ensure using correct Python sitedir
    
    Closes: https://bugs.gentoo.org/702016
    Signed-off-by: Michał Górny <mgorny@gentoo.org>

 .../libxml2/{libxml2-2.9.9-r1.ebuild => libxml2-2.9.9-r2.ebuild}     | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
Comment 12 Larry the Git Cow gentoo-dev 2024-01-08 14:48:28 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6f05bc88c81a42943e5784736d2eb15f63c5ef40

commit 6f05bc88c81a42943e5784736d2eb15f63c5ef40
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: 2024-01-05 15:52:16 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2024-01-08 14:48:19 +0000

    install-qa-check.d/60python-site: Add check for wrong libdir
    
    Bug: https://bugs.gentoo.org/702016
    Bug: https://bugs.gentoo.org/770961
    Signed-off-by: Michał Górny <mgorny@gentoo.org>

 metadata/install-qa-check.d/60python-site | 12 ++++++++++++
 1 file changed, 12 insertions(+)