Helper function for break/clear parsing -- may be overridden. lookupmodule() translates (possibly incomplete) file or module name into an absolute file name.
(self, filename)
| 1599 | # other helper functions |
| 1600 | |
| 1601 | def lookupmodule(self, filename): |
| 1602 | """Helper function for break/clear parsing -- may be overridden. |
| 1603 | |
| 1604 | lookupmodule() translates (possibly incomplete) file or module name |
| 1605 | into an absolute file name. |
| 1606 | """ |
| 1607 | if os.path.isabs(filename) and os.path.exists(filename): |
| 1608 | return filename |
| 1609 | f = os.path.join(sys.path[0], filename) |
| 1610 | if os.path.exists(f) and self.canonic(f) == self.mainpyfile: |
| 1611 | return f |
| 1612 | root, ext = os.path.splitext(filename) |
| 1613 | if ext == '': |
| 1614 | filename = filename + '.py' |
| 1615 | if os.path.isabs(filename): |
| 1616 | return filename |
| 1617 | for dirname in sys.path: |
| 1618 | while os.path.islink(dirname): |
| 1619 | dirname = os.readlink(dirname) |
| 1620 | fullname = os.path.join(dirname, filename) |
| 1621 | if os.path.exists(fullname): |
| 1622 | return fullname |
| 1623 | return None |
| 1624 | |
| 1625 | def _run(self, target: Union[_ModuleTarget, _ScriptTarget]): |
| 1626 | # When bdb sets tracing, a number of call and line events happen |