diff --git a/sphinx/environment.py b/sphinx/environment.py index 86fb1b80c..c28eae940 100644 --- a/sphinx/environment.py +++ b/sphinx/environment.py @@ -494,7 +494,7 @@ class BuildEnvironment: config.exclude_trees + [d + config.source_suffix for d in config.unused_docs] + ['**/' + d for d in config.exclude_dirnames] + - ['**/_sources'] + ['**/_sources', '.#*'] ) self.found_docs = set(get_matching_docs( self.srcdir, config.source_suffix, exclude_matchers=matchers)) diff --git a/sphinx/util/__init__.py b/sphinx/util/__init__.py index b1a3a0d7d..0721118e7 100644 --- a/sphinx/util/__init__.py +++ b/sphinx/util/__init__.py @@ -209,6 +209,8 @@ def get_module_source(modname): lfilename = filename.lower() if lfilename.endswith('.pyo') or lfilename.endswith('.pyc'): filename = filename[:-1] + if not path.isfile(filename) and path.isfile(filename + 'w'): + filename += 'w' elif not (lfilename.endswith('.py') or lfilename.endswith('.pyw')): raise PycodeError('source is not a .py file: %r' % filename) if not path.isfile(filename):