File: fix_extension.patch

package info (click to toggle)
boost1.90 1.90.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 593,156 kB
  • sloc: cpp: 4,190,642; xml: 196,648; python: 34,618; ansic: 23,145; asm: 5,468; sh: 3,776; makefile: 1,161; perl: 1,020; sql: 728; ruby: 676; yacc: 478; java: 77; lisp: 24; csh: 6
file content (43 lines) | stat: -rw-r--r-- 1,828 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Description: fix python extensions
Author: Anton Gladky <gladk@debian.org>
Last-Update: 2023-01-14

Index: boost/tools/build/src/tools/python.jam
===================================================================
--- boost.orig/tools/build/src/tools/python.jam
+++ boost/tools/build/src/tools/python.jam
@@ -967,8 +967,32 @@ local rule configure ( version ? : cmd-o
     toolset.add-requirements
         "$(target-requirements:J=,):<python.interpreter>$(interpreter-cmd)" ;
 
-    # Register the right suffix for extensions.
-    register-extension-suffix $(extension-suffix) : $(target-requirements) ;
+    #
+    # Discover and set extension suffix
+    #
+    debug-message "Checking for extension suffix..." ;
+    local full-cmd = "from __future__ import print_function; import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'))" ;
+    local full-cmd = $(interpreter-cmd)" -c \"$(full-cmd)\"" ;
+    debug-message "running command '$(full-cmd)'" ;
+    local result = [ SHELL $(full-cmd) : strip-eol : exit-status ] ;
+    if $(result[2]) = 0
+    {
+        debug-message "Python extenssion suffix is $(result[1])" ;
+        type.set-generated-target-suffix PYTHON_EXTENSION : $(target-requirements) : <$(result[1])> ;
+    }
+    else
+    {
+        debug-message "Failed to determine python extension suffix" ;
+        debug-message "Falling back to old behaviour" ;
+        if $(target-os) = windows && <python-debugging>on in $(condition)
+        {
+            extension-suffix ?= _d ;
+        }
+        extension-suffix ?= "" ;
+
+        # Register the right suffix for extensions.
+        register-extension-suffix $(extension-suffix) : $(target-requirements) ;
+    }
 
     # Make sure that the python feature is always considered
     # relevant for any targets that depend on python.  Without