Skip to content

Commit

Permalink
Fixup graph to be generated for selected interpreter.
Browse files Browse the repository at this point in the history
  • Loading branch information
jsirois committed Dec 14, 2020
1 parent 66d12e8 commit b83a8f9
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions pex/tools/commands/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,16 @@ class Graph(OutputMixin, Command):

@staticmethod
def _create_dependency_graph(pex):
graph = DiGraph(pex.path(), fontsize="14")
marker_environment = PythonInterpreter.get().identity.env_markers.copy()
# type: (PEX) -> DiGraph
graph = DiGraph(
pex.path(),
fontsize="14",
labelloc="t",
label="Dependency graph of {} for interpreter {} ({})".format(
pex.path(), pex.interpreter.binary, pex.interpreter.identity.requirement
),
)
marker_environment = pex.interpreter.identity.env_markers.copy()
marker_environment["extra"] = []
present_dists = frozenset(dist.project_name for dist in pex.activate())
for dist in pex.activate():
Expand All @@ -41,6 +49,7 @@ def _create_dependency_graph(pex):
URL="https://pypi.org/project/{name}/{version}".format(
name=dist.project_name, version=dist.version
),
target="_blank",
)
for req in requires_dists(dist):
if (
Expand All @@ -54,6 +63,7 @@ def _create_dependency_graph(pex):
style="filled",
tooltip="inactive requirement",
URL="https://pypi.org/project/{name}".format(name=req.project_name),
target="_blank",
)
graph.add_edge(
start=dist.project_name,
Expand Down

0 comments on commit b83a8f9

Please sign in to comment.