◐ Shell
clean mode source ↗

gh-100176: Mac/build-installer: Remove redundant compat code for Python 3.5 and older by hugovk · Pull Request #100297 · python/cpython

Might as well modernise this 12-year-old code while we're here, since we're touching these lines anyway?

fp = open(os.path.join(buildDir, 'Makefile'), 'r')
for ln in fp:
if ln.startswith('VERSION='):
VERSION=ln.split()[1]
if ln.startswith('ABIFLAGS='):
ABIFLAGS=ln.split()
ABIFLAGS=ABIFLAGS[1] if len(ABIFLAGS) > 1 else ''
if ln.startswith('LDVERSION='):
LDVERSION=ln.split()[1]
fp.close()
with open(os.path.join(buildDir, 'Makefile'), 'r') as fp:
for ln in fp:
if ln.startswith('VERSION='):
VERSION=ln.split()[1]
if ln.startswith('ABIFLAGS='):
ABIFLAGS=ln.split()
ABIFLAGS=ABIFLAGS[1] if len(ABIFLAGS) > 1 else ''
if ln.startswith('LDVERSION='):
LDVERSION=ln.split()[1]

(This might actually result in a smaller PR diff as well, as a bonus.)