| 782 | self.check(mod) |
| 783 | |
| 784 | def check(self, mod): |
| 785 | # jython registers java packages as modules but they either |
| 786 | # don't have a __file__ attribute or its value is None |
| 787 | if not (mod and hasattr(mod, "__file__") and mod.__file__): |
| 788 | return |
| 789 | |
| 790 | try: |
| 791 | mtime = os.stat(mod.__file__).st_mtime |
| 792 | except OSError: |
| 793 | return |
| 794 | if mod.__file__.endswith(self.__class__.SUFFIX) and os.path.exists( |
| 795 | mod.__file__[:-1] |
| 796 | ): |
| 797 | mtime = max(os.stat(mod.__file__[:-1]).st_mtime, mtime) |
| 798 | |
| 799 | if mod not in self.mtimes: |
| 800 | self.mtimes[mod] = mtime |
| 801 | elif self.mtimes[mod] < mtime: |
| 802 | try: |
| 803 | reload(mod) |
| 804 | self.mtimes[mod] = mtime |
| 805 | except ImportError: |
| 806 | pass |
| 807 | |
| 808 | |
| 809 | if __name__ == "__main__": |