On 10/14/22 05:32 PM, Steven A. Falco wrote:
I've received a bug: https://bugzilla.redhat.com/show_bug.cgi?id=2134832

The basic issue is that Fedora uses both /usr/lib/python3.10 and 
/usr/lib64/python3.10; i.e. they separate the 32-bit and 64-bit files.  The 
KiCad build scripts currently put _pcbnew.so into /usr/lib/python3.10, but 
because that file is a 64-bit shared library, it should go into 
/usr/lib64/python3.10 on Fedora.

I tried manually running the command that CMakeLists.txt uses to find the path:

python3 -c "import 
distutils.sysconfig;print(\"%s\"%distutils.sysconfig.get_python_lib(plat_specific=0, 
standard_lib=0, prefix=''))"

and that indeed returns:

lib/python3.10/site-packages

Playing with it a bit more, if I change from "plat_specific=0" to 
"plat_specific=1", then I get the path Fedora wants:

$ python3 -c "import 
distutils.sysconfig;print(\"%s\"%distutils.sysconfig.get_python_lib(plat_specific=1, 
standard_lib=0, prefix=''))"
<string>:1: DeprecationWarning: The distutils package is deprecated and slated 
for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
<string>:1: DeprecationWarning: The distutils.sysconfig module is deprecated, 
use sysconfig instead
lib64/python3.10/site-packages

But that of course does nothing to fix the deprecation warning.

I could try overriding this by explicitly setting the PYTHON_SITE_PACKAGE_PATH 
variable, but I doubt that is the correct approach.  The above command returns 
a deprecation warning, suggesting using sysconfig instead of 
distutils.sysconfig.

Here is everything that python3 has for the sysconfig.get_paths() method:

python3 -c "from sysconfig import get_paths; print(get_paths())"
{'stdlib': '/usr/lib64/python3.10', 'platstdlib': 
'/usr/local/lib64/python3.10', 'purelib': 
'/usr/local/lib/python3.10/site-packages', 'platlib': 
'/usr/local/lib64/python3.10/site-packages', 'include': 
'/usr/include/python3.10', 'platinclude': '/usr/include/python3.10', 'scripts': 
'/usr/local/bin', 'data': '/usr/local'}

So stdlib looks like the correct base path, although we'd have to tack on the 
site-packages suffix.  Note that I don't think we should use platlib, because 
the bulk of KiCad is installed into /usr rather than /usr/local.

One issue with using sysconfig is that it produces an absolute path, which 
causes other problems.

$ python3 -c "from sysconfig import get_path; print(get_path(\"stdlib\"))"
/usr/lib64/python3.10

But it may be that I'm not using it correctly; perhaps there is a way to get it 
to provide a relative path, or perhaps other changes are needed on top of 
switching to sysconfig.

Please let me know what you think is the correct solution.

     Steve


--
You received this message because you are subscribed to the Google Groups "KiCad 
Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to devlist+unsubscr...@kicad.org.
To view this discussion on the web visit 
https://groups.google.com/a/kicad.org/d/msgid/devlist/e9371fa2-1575-a1ba-8d7b-d522e39dcda9%40gmail.com.

Reply via email to