Helper function for break/clear parsing -- may be overridden. lookupmodule() translates (possibly incomplete) file or module name into an absolute file name.
(self, filename)
| 1513 | # other helper functions |
| 1514 | |
| 1515 | def lookupmodule(self, filename): |
| 1516 | """Helper function for break/clear parsing -- may be overridden. |
| 1517 | |
| 1518 | lookupmodule() translates (possibly incomplete) file or module name |
| 1519 | into an absolute file name. |
| 1520 | """ |
| 1521 | if os.path.isabs(filename) and os.path.exists(filename): |
| 1522 | return filename |
| 1523 | f = os.path.join(sys.path[0], filename) |
| 1524 | if os.path.exists(f) and self.canonic(f) == self.mainpyfile: |
| 1525 | return f |
| 1526 | root, ext = os.path.splitext(filename) |
| 1527 | if ext == '': |
| 1528 | filename = filename + '.py' |
| 1529 | if os.path.isabs(filename): |
| 1530 | return filename |
| 1531 | for dirname in sys.path: |
| 1532 | while os.path.islink(dirname): |
| 1533 | dirname = os.readlink(dirname) |
| 1534 | fullname = os.path.join(dirname, filename) |
| 1535 | if os.path.exists(fullname): |
| 1536 | return fullname |
| 1537 | return None |
| 1538 | |
| 1539 | def _runmodule(self, module_name): |
| 1540 | self._wait_for_mainpyfile = True |