bpo-28167: Remove platform._dist_try_harder() (GH-10787) · python/cpython@7cc1fa4

@@ -227,54 +227,6 @@ def libc_ver(executable=sys.executable, lib='', version='', chunksize=16384):

227227

pos = m.end()

228228

return lib, version

229229230-

def _dist_try_harder(distname, version, id):

231-232-

""" Tries some special tricks to get the distribution

233-

information in case the default method fails.

234-235-

Currently supports older SuSE Linux, Caldera OpenLinux and

236-

Slackware Linux distributions.

237-238-

"""

239-

if os.path.exists('/var/adm/inst-log/info'):

240-

# SuSE Linux stores distribution information in that file

241-

distname = 'SuSE'

242-

for line in open('/var/adm/inst-log/info'):

243-

tv = line.split()

244-

if len(tv) == 2:

245-

tag, value = tv

246-

else:

247-

continue

248-

if tag == 'MIN_DIST_VERSION':

249-

version = value.strip()

250-

elif tag == 'DIST_IDENT':

251-

values = value.split('-')

252-

id = values[2]

253-

return distname, version, id

254-255-

if os.path.exists('/etc/.installed'):

256-

# Caldera OpenLinux has some infos in that file (thanks to Colin Kong)

257-

for line in open('/etc/.installed'):

258-

pkg = line.split('-')

259-

if len(pkg) >= 2 and pkg[0] == 'OpenLinux':

260-

# XXX does Caldera support non Intel platforms ? If yes,

261-

# where can we find the needed id ?

262-

return 'OpenLinux', pkg[1], id

263-264-

if os.path.isdir('/usr/lib/setup'):

265-

# Check for slackware version tag file (thanks to Greg Andruk)

266-

verfiles = os.listdir('/usr/lib/setup')

267-

for n in range(len(verfiles)-1, -1, -1):

268-

if verfiles[n][:14] != 'slack-version-':

269-

del verfiles[n]

270-

if verfiles:

271-

verfiles.sort()

272-

distname = 'slackware'

273-

version = verfiles[-1][14:]

274-

return distname, version, id

275-276-

return distname, version, id

277-278230

def popen(cmd, mode='r', bufsize=-1):

279231280232

""" Portable popen() interface.