Skip to content
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

Update vendored pydot (1.4.2.dev0) #970

Merged
merged 1 commit into from
Nov 16, 2020
Merged
Show file tree
Hide file tree
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
11 changes: 7 additions & 4 deletions src/rez/vendor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,15 @@ Note that the latest versions column is just to give us an idea of how far back
<tr><td>
pydot
</td><td>
1.4.1 (Dec 12, 2018)
1.4.2.dev0 (Oct 28, 2020)
</td><td>
1.4.1 (Dec 12, 2018)
1.4.2.dev0 (Oct 28, 2020)
</td><td>
Updated (July 2019) in order to update pyparsing lib which in turn is
required by the packaging library. Updated (Aug 2019) for py3.

* Updated (July 2019) in order to update pyparsing lib which in turn is
required by the packaging library. Updated (Aug 2019) for py3.

* Updated (Nov 2020) for finding right dot executable on Windows + Anaconda, see [pydot/pydot#205](https://github.com/pydot/pydot/issues/205) for detail. Also, pydot has not bumping version for a long time, log down commit change here: a10ced4 -> 03533f3
</td></tr>

<!-- ######################################################### -->
Expand Down
7 changes: 3 additions & 4 deletions src/rez/vendor/pydot/dot_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,8 +548,7 @@ def parse_dot_data(s):
tokens = graphparser.parseString(s)
return list(tokens)
except ParseException as err:
print(
err.line +
" "*(err.column-1) + "^" +
err)
print(err.line)
print(" " * (err.column - 1) + "^")
print(err)
return None
31 changes: 19 additions & 12 deletions src/rez/vendor/pydot/pydot.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,16 @@ def is_windows():
return os.name == 'nt'


def is_anacoda():
def is_anaconda():
# type: () -> bool
return os.path.exists(os.path.join(sys.prefix, 'conda-meta'))
import glob
return glob.glob(os.path.join(sys.prefix, 'conda-meta\\graphviz*.json')) != []


def get_executable_extension():
# type: () -> str
if is_windows():
return '.bat' if is_anacoda() else '.exe'
return '.bat' if is_anaconda() else '.exe'
else:
return ''

Expand Down Expand Up @@ -237,7 +238,7 @@ def needs_quotes( s ):


def quote_if_necessary(s):
"""Enclode attribute value in quotes, if needed."""
"""Enclose attribute value in quotes, if needed."""
if isinstance(s, bool):
if s is True:
return 'True'
Expand Down Expand Up @@ -547,7 +548,7 @@ def __str__(self):


class InvocationException(Exception):
"""Indicate ploblem while running any GraphViz executable.
"""Indicate problem while running any GraphViz executable.
"""
def __init__(self, value):
self.value = value
Expand Down Expand Up @@ -687,11 +688,11 @@ class Edge(Common):

edge(src, dst, attribute=value, ...)

src: source node
dst: destination node
src: source node, subgraph or cluster
dst: destination node, subgraph or cluster

`src` and `dst` can be specified as a `Node` object,
or as the node's name string.
`src` and `dst` can be specified as a `Node`, `Subgraph` or
`Cluster` object, or as the name string of such a component.

All the attributes defined in the Graphviz dot language should
be supported.
Expand All @@ -711,9 +712,9 @@ class Edge(Common):

def __init__(self, src='', dst='', obj_dict=None, **attrs):
self.obj_dict = dict()
if isinstance(src, Node):
if isinstance(src, (Node, Subgraph, Cluster)):
src = src.get_name()
if isinstance(dst, Node):
if isinstance(dst, (Node, Subgraph, Cluster)):
dst = dst.get_name()
points = (quote_if_necessary(src),
quote_if_necessary(dst))
Expand Down Expand Up @@ -1935,6 +1936,12 @@ def create(self, prog=None, format='ps', encoding=None):
)
print(message)

assert process.returncode == 0, process.returncode
assert process.returncode == 0, (
'"{prog}" with args {arguments} returned code: {code}'.format(
prog=prog,
arguments=arguments,
code=process.returncode,
)
)

return stdout_data