|
13 | 13 | from __future__ import print_function
|
14 | 14 |
|
15 | 15 | import os
|
16 |
| -import os.path as osp |
| 16 | +# import os.path as osp |
17 | 17 | from pathlib import Path
|
18 | 18 | import re
|
19 | 19 | import subprocess
|
@@ -385,51 +385,61 @@ def package_index_wiki(self):
|
385 | 385 | """Return Package Index page in Wiki format"""
|
386 | 386 | installed_tools = []
|
387 | 387 |
|
388 |
| - def get_tool_path(relpath, checkfunc): |
| 388 | + def get_tool_path_file(relpath): |
389 | 389 | if self.simulation:
|
390 | 390 | for dirname in self.toolsdirs:
|
391 | 391 | path = dirname + relpath.replace(
|
392 | 392 | r'\t', ''
|
393 | 393 | )
|
394 |
| - if checkfunc(path): |
| 394 | + if Path(path).is_file(): |
395 | 395 | return path
|
396 | 396 | else:
|
397 | 397 | path = self.winpydir + relpath
|
398 |
| - if checkfunc(path): |
| 398 | + if Path(path).is_file(): |
399 | 399 | return path
|
400 | 400 |
|
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'): |
402 | 415 | 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) |
404 | 418 | if rpath is not None:
|
405 | 419 | rver = utils.get_r_version(rpath)
|
406 | 420 | 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) |
410 | 423 | if juliapath is not None:
|
411 | 424 | juliaver = utils.get_julia_version(juliapath)
|
412 | 425 | 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) |
416 | 428 | if nodepath is not None:
|
417 | 429 | nodever = utils.get_nodejs_version(nodepath)
|
418 | 430 | installed_tools += [('Nodejs', nodever)]
|
419 | 431 | npmver = utils.get_npmjs_version(nodepath)
|
420 | 432 | installed_tools += [('npmjs', npmver)]
|
421 | 433 |
|
422 |
| - pandocexe = get_tool_path( |
423 |
| - r'\t\pandoc.exe', osp.isfile |
424 |
| - ) |
| 434 | + pandocexe = get_tool_path_file(r'\t\pandoc.exe') |
425 | 435 | if pandocexe is not None:
|
426 | 436 | pandocver = utils.get_pandoc_version(
|
427 | 437 | #osp.dirname(pandocexe)
|
428 | 438 | str(Path(pandocexe).parent)
|
429 | 439 | )
|
430 | 440 | installed_tools += [('Pandoc', pandocver)]
|
431 | 441 |
|
432 |
| - vscodeexe = get_tool_path(r'\t\VSCode\Code.exe', osp.isfile) |
| 442 | + vscodeexe = get_tool_path_file(r'\t\VSCode\Code.exe') |
433 | 443 | if vscodeexe is not None:
|
434 | 444 | installed_tools += [('VSCode',
|
435 | 445 | utils.getFileProperties(vscodeexe)['FileVersion'])]
|
|
0 commit comments