|
26 | 26 | pass |
27 | 27 | out = open(sys.argv[1], 'w') |
28 | 28 |
|
29 | | -from sysconfig import get_config_var |
30 | | -try: |
31 | | - # NB, sysconfig.get_python_inc doesn't exist, but distutils.sysconfig.get_python_inc does for Python <= 3.11 |
32 | | - from distutils.sysconfig import get_python_inc |
33 | | -except ImportError: |
34 | | - def get_python_inc(): |
35 | | - return get_config_var('INCLUDEPY') or '' |
| 29 | +from sysconfig import get_config_var, get_path, get_python_version |
36 | 30 |
|
37 | | -incdirs = [get_python_inc()] |
38 | | -libdirs = [ |
39 | | - # distutils.sysconfig.get_python_lib does not appear to work correctly on Ubuntu with Python versions < 3.10 |
40 | | - get_config_var('LIBDIR') or get_config_var('LIBDEST') or '', |
41 | | - get_config_var('BINDIR') or '', |
42 | | -] |
| 31 | +incdirs = [get_path("include")] |
| 32 | +libdir = get_config_var('LIBDIR') or get_config_var('LIBDEST') or '' |
43 | 33 |
|
44 | 34 | have_np='NO' |
45 | 35 | try: |
46 | | - from numpy.distutils.misc_util import get_numpy_include_dirs |
47 | | - incdirs = get_numpy_include_dirs()+incdirs |
| 36 | + from numpy import get_include |
| 37 | + numpy_dir = [get_include()] |
| 38 | + incdirs = numpy_dir+incdirs |
48 | 39 | have_np='YES' |
49 | 40 | except ImportError: |
50 | 41 | pass |
51 | 42 |
|
52 | 43 | print('TARGET_CFLAGS +=',get_config_var('BASECFLAGS') or '', file=out) |
53 | 44 | print('TARGET_CXXFLAGS +=',get_config_var('BASECFLAGS') or '', file=out) |
54 | 45 |
|
55 | | -print('PY_VER :=',get_config_var('VERSION'), file=out) |
| 46 | +print('PY_VER :=',get_python_version(), file=out) |
56 | 47 | ldver = get_config_var('LDVERSION') |
57 | 48 | if ldver is None: |
58 | 49 | ldver = get_config_var('VERSION') |
59 | 50 | if get_config_var('Py_DEBUG'): |
60 | 51 | ldver = ldver+'_d' |
61 | 52 | print('PY_LD_VER :=',ldver, file=out) |
62 | 53 | print('PY_INCDIRS :=',' '.join(incdirs), file=out) |
63 | | -print('PY_LIBDIRS :=',' '.join(libdirs), file=out) |
| 54 | +print('PY_LIBDIRS :=',libdir, file=out) |
64 | 55 | if sys.platform == 'win32': |
65 | 56 | print('PY_LDLIBS :=', '/LIBPATH:' + os.path.join(sys.prefix, 'libs'), file=out) |
66 | | -else: |
67 | | - print('PY_LDLIBS :=', get_config_var('BLDLIBRARY') or '', file=out) |
68 | 57 | print('HAVE_NUMPY :=',have_np, file=out) |
69 | 58 |
|
70 | 59 | try: |
|
0 commit comments