Bug#1007927: brltty: FTBFS with Python 3.10 as default

Stefano Rivera stefanor at debian.org
Fri Mar 18 16:39:40 GMT 2022


Patch attached.

SR

-- 
Stefano Rivera
  http://tumbleweed.org.za/
  +1 415 683 3272
-------------- next part --------------
Description: Handle Debian's default posix_prefix sysconfig layout
 Debian adds a custom sysconfig scheme to system python installs,
 "posix_local". This is the default scheme, and it redirects local users'
 Python module installs to /usr/local even though Python is installed with a
 /usr prefix. Both are on Debian's python's sys.path module search path.
 .
 Previously this custom sysconfig scheme was specified in distutils.sysconfig,
 but not sysconfig itself. As distutils is being deprecated, the custom scheme
 is now specified in sysconfig, since Debian's Python 3.10 (3.10.2-4).
 .
 As far as I can see, pythoncmd is only used in detecting the installed system
 python, not determining where the built module will be installed, so this
 patch is sufficient. To control where the module is installed, the approach
 would be to pass the selected prefix to sysconfig, when querying the install
 path.
Bug-Debian: https://bugs.debian.org/1007927
Forwarded: https://github.com/brltty/brltty/pull/362

--- a/Tools/pythoncmd
+++ b/Tools/pythoncmd
@@ -46,15 +46,22 @@
 try:
   import sysconfig
 # putProgramMessage("sysconfig")
+  if hasattr(sysconfig, 'get_default_scheme'):
+    scheme = sysconfig.get_default_scheme()
+  else:
+    scheme = sysconfig._get_default_scheme()
+  if scheme == 'posix_local':
+    # Debian's default scheme installs to /usr/local/ but we want to find headers in /usr/
+    scheme = 'posix_prefix'
 
   def getIncludeDirectory():
-    return sysconfig.get_path("include")
+    return sysconfig.get_path("include", scheme)
 
   def getLibraryDirectory():
-    return sysconfig.get_path("stdlib")
+    return sysconfig.get_path("stdlib", scheme)
 
   def getPackageDirectory():
-    return sysconfig.get_path("platlib")
+    return sysconfig.get_path("platlib", scheme)
 
   def getConfigurationVariable(name):
     return sysconfig.get_config_var(name)


More information about the Pkg-a11y-devel mailing list