sphinx-contrib / plantuml

BSD 2-Clause "Simplified" License
115 stars 42 forks source link

dot hard coded to /opt/local/bin? #69

Closed guideloom closed 1 year ago

guideloom commented 1 year ago

I have the following simple uml file that is generated correctly at https://www.plantuml.com/plantuml/png/SoWkIImgAStDuL8ioKZDJLKeoQ_aqYX9BIunr5JGrRLJ0BEDDBaSKlDIWCe0

@startuml
!theme toy
(test1) --> (test2)
@enduml

The file is also saved as test.puml

This is my plantuml file, as per your suggestion in /usr/local/bin

#!/bin/bash                                                                                                                                                 

java -jar /usr/local/bin/plantuml.jar "$@"

plantuml version information:

# plantuml -version 
PlantUML version 1.2022.13 (Sat Nov 19 06:22:17 MST 2022)
(GPL source distribution)
Java Runtime: OpenJDK Runtime Environment
JVM: OpenJDK 64-Bit Server VM
Default Encoding: ANSI_X3.4-1968
Language: en
Country: US

PLANTUML_LIMIT_SIZE: 4096

Dot version: dot - graphviz version 2.43.0 (0)
Installation seems OK. File generation OK

plantuml -testdot shows it runs correctly.

# plantuml -testdot
Dot version: dot - graphviz version 2.43.0 (0)
Installation seems OK. File generation OK

Running plantuml test.puml on it's own, generates the correct png image, same as the output from the above link. So I know the plantuml file works and generates the correct output.

The problem is when I use this in sphinx using your plantuml extension. All other regular uml diagrams work, it's just "dot/class" that does not.

the rst section looks like this:

.. uml:: /objs/uml/test.puml
   :align: center

I don't get the expected image as per the previous two tests, I get the following instead: image

Why is your extension looking for dot hardcoded at /opt/local/bin/dot?

guideloom commented 1 year ago

I have also tried this

dot is located at /usr/bin/dot

# which dot
/usr/bin/dot

updated the plantuml file accordingly:

#!/bin/bash

export GRAPHVIZ_DOT=/usr/bin/dot
java -jar /usr/local/bin/plantuml.jar -graphvizdot /usr/bin/dot "$@"

it yields the same result at above. dot is being looked for at /opt/local/bin/dot.

guideloom commented 1 year ago

Fixed. The above "-graphvizdot" add to the file did fix this. The next issue was the cache in my web browser. Once I forced a reload, all is good.

trustin commented 1 year ago

I added the following two lines (or three including import os) to make it use the dot command in my PATH:

os.environ['GRAPHVIZ_DOT'] = shutil.which('dot')
plantuml = 'java -jar plantuml-1.2023.1.jar' 

Note that I didn't have to specify -graphvizdot.

electric-coder commented 8 months ago

I added the following two lines (or three including import os) to make it use the dot command in my PATH:

os.environ['GRAPHVIZ_DOT'] = shutil.which('dot')
plantuml = 'java -jar plantuml-1.2023.1.jar' 

Note that I didn't have to specify -graphvizdot.

On Windows this was the only solution that worked.