Mercurial > repos > rliterman > csp2
comparison CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/lib/python3.8/config-3.8-x86_64-linux-gnu/python-config.py @ 68:5028fdace37b
planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author | jpayne |
---|---|
date | Tue, 18 Mar 2025 16:23:26 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
67:0e9998148a16 | 68:5028fdace37b |
---|---|
1 #!/usr/bin/env python3.8 | |
2 # -*- python -*- | |
3 | |
4 # Keep this script in sync with python-config.sh.in | |
5 | |
6 import getopt | |
7 import os | |
8 import sys | |
9 import sysconfig | |
10 | |
11 valid_opts = ['prefix', 'exec-prefix', 'includes', 'libs', 'cflags', | |
12 'ldflags', 'extension-suffix', 'help', 'abiflags', 'configdir', | |
13 'embed'] | |
14 | |
15 def exit_with_usage(code=1): | |
16 print("Usage: {0} [{1}]".format( | |
17 sys.argv[0], '|'.join('--'+opt for opt in valid_opts)), file=sys.stderr) | |
18 sys.exit(code) | |
19 | |
20 try: | |
21 opts, args = getopt.getopt(sys.argv[1:], '', valid_opts) | |
22 except getopt.error: | |
23 exit_with_usage() | |
24 | |
25 if not opts: | |
26 exit_with_usage() | |
27 | |
28 pyver = sysconfig.get_config_var('VERSION') | |
29 getvar = sysconfig.get_config_var | |
30 | |
31 opt_flags = [flag for (flag, val) in opts] | |
32 | |
33 if '--help' in opt_flags: | |
34 exit_with_usage(code=0) | |
35 | |
36 for opt in opt_flags: | |
37 if opt == '--prefix': | |
38 print(sysconfig.get_config_var('prefix')) | |
39 | |
40 elif opt == '--exec-prefix': | |
41 print(sysconfig.get_config_var('exec_prefix')) | |
42 | |
43 elif opt in ('--includes', '--cflags'): | |
44 flags = ['-I' + sysconfig.get_path('include'), | |
45 '-I' + sysconfig.get_path('platinclude')] | |
46 if opt == '--cflags': | |
47 flags.extend(getvar('CFLAGS').split()) | |
48 print(' '.join(flags)) | |
49 | |
50 elif opt in ('--libs', '--ldflags'): | |
51 libs = [] | |
52 if '--embed' in opt_flags: | |
53 libs.append('-lpython' + pyver + sys.abiflags) | |
54 else: | |
55 libpython = getvar('LIBPYTHON') | |
56 if libpython: | |
57 libs.append(libpython) | |
58 libs.extend(getvar('LIBS').split() + getvar('SYSLIBS').split()) | |
59 | |
60 # add the prefix/lib/pythonX.Y/config dir, but only if there is no | |
61 # shared library in prefix/lib/. | |
62 if opt == '--ldflags': | |
63 if not getvar('Py_ENABLE_SHARED'): | |
64 libs.insert(0, '-L' + getvar('LIBPL')) | |
65 print(' '.join(libs)) | |
66 | |
67 elif opt == '--extension-suffix': | |
68 print(sysconfig.get_config_var('EXT_SUFFIX')) | |
69 | |
70 elif opt == '--abiflags': | |
71 print(sys.abiflags) | |
72 | |
73 elif opt == '--configdir': | |
74 print(sysconfig.get_config_var('LIBPL')) |