Skip to content

Always process modules/packages given with -m/-p #2786

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 1, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion mypy/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -1114,6 +1114,7 @@ def __init__(self,
caller_state: 'State' = None,
caller_line: int = 0,
ancestor_for: 'State' = None,
root_source: bool = False,
) -> None:
assert id or path or source is not None, "Neither id, path nor source given"
self.manager = manager
Expand Down Expand Up @@ -1148,6 +1149,7 @@ def __init__(self,
# - skip -> don't analyze, make the type Any
follow_imports = self.options.follow_imports
if (follow_imports != 'normal'
and not root_source # Honor top-level modules
and path.endswith('.py') # Stubs are always normal
and id != 'builtins' # Builtins is always normal
and not (caller_state and
Expand Down Expand Up @@ -1519,6 +1521,9 @@ def write_cache(self) -> None:
def dispatch(sources: List[BuildSource], manager: BuildManager) -> None:
manager.log("Mypy version %s" % __version__)
graph = load_graph(sources, manager)
if not graph:
print("Nothing to do?!")
return
manager.log("Loaded graph with %d nodes" % len(graph))
if manager.options.dump_graph:
dump_graph(graph)
Expand Down Expand Up @@ -1596,7 +1601,8 @@ def load_graph(sources: List[BuildSource], manager: BuildManager) -> Graph:
# Seed the graph with the initial root sources.
for bs in sources:
try:
st = State(id=bs.module, path=bs.path, source=bs.text, manager=manager)
st = State(id=bs.module, path=bs.path, source=bs.text, manager=manager,
root_source=True)
except ModuleNotFound:
continue
if st.id in graph:
Expand Down