Skip to content

Commit 21b1f73

Browse files
authored
Merge pull request winpython#1159 from stonebig/master
remove osp from make.py
2 parents 04613d4 + 106cfc3 commit 21b1f73

File tree

1 file changed

+26
-16
lines changed

1 file changed

+26
-16
lines changed

make.py

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from __future__ import print_function
1414

1515
import os
16-
import os.path as osp
16+
# import os.path as osp
1717
from pathlib import Path
1818
import re
1919
import subprocess
@@ -385,51 +385,61 @@ def package_index_wiki(self):
385385
"""Return Package Index page in Wiki format"""
386386
installed_tools = []
387387

388-
def get_tool_path(relpath, checkfunc):
388+
def get_tool_path_file(relpath):
389389
if self.simulation:
390390
for dirname in self.toolsdirs:
391391
path = dirname + relpath.replace(
392392
r'\t', ''
393393
)
394-
if checkfunc(path):
394+
if Path(path).is_file():
395395
return path
396396
else:
397397
path = self.winpydir + relpath
398-
if checkfunc(path):
398+
if Path(path).is_file():
399399
return path
400400

401-
if get_tool_path(r'\t\SciTE.exe', osp.isfile):
401+
def get_tool_path_dir(relpath):
402+
if self.simulation:
403+
for dirname in self.toolsdirs:
404+
path = dirname + relpath.replace(
405+
r'\t', ''
406+
)
407+
if Path(path).is_dir():
408+
return path
409+
else:
410+
path = self.winpydir + relpath
411+
if Path(path).is_dir():
412+
return path
413+
414+
if get_tool_path_file(r'\t\SciTE.exe'):
402415
installed_tools += [('SciTE', '3.3.7')]
403-
rpath = get_tool_path(self.R_PATH, osp.isdir)
416+
417+
rpath = get_tool_path_dir(self.R_PATH)
404418
if rpath is not None:
405419
rver = utils.get_r_version(rpath)
406420
installed_tools += [('R', rver)]
407-
juliapath = get_tool_path(
408-
self.JULIA_PATH, osp.isdir
409-
)
421+
422+
juliapath = get_tool_path_dir(self.JULIA_PATH)
410423
if juliapath is not None:
411424
juliaver = utils.get_julia_version(juliapath)
412425
installed_tools += [('Julia', juliaver)]
413-
nodepath = get_tool_path(
414-
self.NODEJS_PATH, osp.isdir
415-
)
426+
427+
nodepath = get_tool_path_dir(self.NODEJS_PATH)
416428
if nodepath is not None:
417429
nodever = utils.get_nodejs_version(nodepath)
418430
installed_tools += [('Nodejs', nodever)]
419431
npmver = utils.get_npmjs_version(nodepath)
420432
installed_tools += [('npmjs', npmver)]
421433

422-
pandocexe = get_tool_path(
423-
r'\t\pandoc.exe', osp.isfile
424-
)
434+
pandocexe = get_tool_path_file(r'\t\pandoc.exe')
425435
if pandocexe is not None:
426436
pandocver = utils.get_pandoc_version(
427437
#osp.dirname(pandocexe)
428438
str(Path(pandocexe).parent)
429439
)
430440
installed_tools += [('Pandoc', pandocver)]
431441

432-
vscodeexe = get_tool_path(r'\t\VSCode\Code.exe', osp.isfile)
442+
vscodeexe = get_tool_path_file(r'\t\VSCode\Code.exe')
433443
if vscodeexe is not None:
434444
installed_tools += [('VSCode',
435445
utils.getFileProperties(vscodeexe)['FileVersion'])]

0 commit comments

Comments
 (0)