From 3cd21aa6a1467723ccc85e6411a6cbe7fa81ef76 Mon Sep 17 00:00:00 2001 From: Joannah Nanjekye <33177550+nanjekyejoannah@users.noreply.github.com> Date: Tue, 15 Oct 2019 11:18:47 -0300 Subject: [PATCH] bpo-38468 : Refactor python-config (#16749) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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: Pablo Galindo * 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: Victor Stinner * Update 2019-10-13-16-18-24.bpo-38468.buCO84.rst --- .../Build/2019-10-13-16-18-24.bpo-38468.buCO84.rst | 2 ++ Misc/python-config.in | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 Misc/NEWS.d/next/Build/2019-10-13-16-18-24.bpo-38468.buCO84.rst diff --git a/Misc/NEWS.d/next/Build/2019-10-13-16-18-24.bpo-38468.buCO84.rst b/Misc/NEWS.d/next/Build/2019-10-13-16-18-24.bpo-38468.buCO84.rst new file mode 100644 index 00000000000..4fe4c2b25a1 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2019-10-13-16-18-24.bpo-38468.buCO84.rst @@ -0,0 +1,2 @@ +Misc/python-config.in now uses `getvar()` for all still existing `sysconfig.get_config_var()` calls. +Patch by Joannah Nanjekye. diff --git a/Misc/python-config.in b/Misc/python-config.in index 727c4a86822..ebd99daa0c2 100644 --- a/Misc/python-config.in +++ b/Misc/python-config.in @@ -25,8 +25,8 @@ except getopt.error: if not opts: exit_with_usage() -pyver = sysconfig.get_config_var('VERSION') getvar = sysconfig.get_config_var +pyver = getvar('VERSION') opt_flags = [flag for (flag, val) in opts] @@ -35,10 +35,10 @@ if '--help' in opt_flags: for opt in opt_flags: if opt == '--prefix': - print(sysconfig.get_config_var('prefix')) + print(getvar('prefix')) elif opt == '--exec-prefix': - print(sysconfig.get_config_var('exec_prefix')) + print(getvar('exec_prefix')) elif opt in ('--includes', '--cflags'): flags = ['-I' + sysconfig.get_path('include'), @@ -65,10 +65,10 @@ for opt in opt_flags: print(' '.join(libs)) elif opt == '--extension-suffix': - print(sysconfig.get_config_var('EXT_SUFFIX')) + print(getvar('EXT_SUFFIX')) elif opt == '--abiflags': print(sys.abiflags) elif opt == '--configdir': - print(sysconfig.get_config_var('LIBPL')) + print(getvar('LIBPL'))