Commit 3cd21aa6 authored by Joannah Nanjekye's avatar Joannah Nanjekye Committed by GitHub

bpo-38468 : Refactor python-config (#16749)

* refactor python-config

* 📜🤖 Added by blurb_it.

* Update Misc/NEWS.d/next/Build/2019-10-13-16-18-24.bpo-38468.buCO84.rst
Co-Authored-By: default avatarPablo Galindo <Pablogsal@gmail.com>

* Use getvar for pyver

* Update news entry with affected file.

* Update Misc/NEWS.d/next/Build/2019-10-13-16-18-24.bpo-38468.buCO84.rst
Co-Authored-By: default avatarVictor Stinner <vstinner@python.org>

* Update 2019-10-13-16-18-24.bpo-38468.buCO84.rst
parent 8d59eb1b
Misc/python-config.in now uses `getvar()` for all still existing `sysconfig.get_config_var()` calls.
Patch by Joannah Nanjekye.
...@@ -25,8 +25,8 @@ except getopt.error: ...@@ -25,8 +25,8 @@ except getopt.error:
if not opts: if not opts:
exit_with_usage() exit_with_usage()
pyver = sysconfig.get_config_var('VERSION')
getvar = sysconfig.get_config_var getvar = sysconfig.get_config_var
pyver = getvar('VERSION')
opt_flags = [flag for (flag, val) in opts] opt_flags = [flag for (flag, val) in opts]
...@@ -35,10 +35,10 @@ if '--help' in opt_flags: ...@@ -35,10 +35,10 @@ if '--help' in opt_flags:
for opt in opt_flags: for opt in opt_flags:
if opt == '--prefix': if opt == '--prefix':
print(sysconfig.get_config_var('prefix')) print(getvar('prefix'))
elif opt == '--exec-prefix': elif opt == '--exec-prefix':
print(sysconfig.get_config_var('exec_prefix')) print(getvar('exec_prefix'))
elif opt in ('--includes', '--cflags'): elif opt in ('--includes', '--cflags'):
flags = ['-I' + sysconfig.get_path('include'), flags = ['-I' + sysconfig.get_path('include'),
...@@ -65,10 +65,10 @@ for opt in opt_flags: ...@@ -65,10 +65,10 @@ for opt in opt_flags:
print(' '.join(libs)) print(' '.join(libs))
elif opt == '--extension-suffix': elif opt == '--extension-suffix':
print(sysconfig.get_config_var('EXT_SUFFIX')) print(getvar('EXT_SUFFIX'))
elif opt == '--abiflags': elif opt == '--abiflags':
print(sys.abiflags) print(sys.abiflags)
elif opt == '--configdir': elif opt == '--configdir':
print(sysconfig.get_config_var('LIBPL')) print(getvar('LIBPL'))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment