Skip to content

Commit

Permalink
Use Python-version agnostic helpers
Browse files Browse the repository at this point in the history
As it may not be the default `python` on an OS any more, we should make
it possible to run against Python 2 and Python 3.
  • Loading branch information
jamietanna committed Nov 9, 2021
1 parent eefe845 commit 69af780
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/modules/setup/pages/usage.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ digraph G {
Here we are using a Python one-liner to encode our diagram using deflate + base64:

[source,cli]
cat hello.dot | python -c "import sys; import base64; import zlib; print(base64.urlsafe_b64encode(zlib.compress(sys.stdin.read(), 9)))"
cat hello.dot | python -c "import sys; import base64; import zlib; print(base64.urlsafe_b64encode(zlib.compress(sys.stdin.read().encode('utf-8'), 9)).decode('ascii'))"

The above command will return `eNpLyUwvSizIUHBXqPZIzcnJ17ULzy_KSanlAgB1EAjQ`.
We can then copy this value in the URL:
Expand Down
2 changes: 1 addition & 1 deletion server/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ For example:
$ mkdir example-lib
$ printf "@startuml\nBob->Alice\n@enduml\n" > example-lib/bob.puml
$ sudo docker run --publish=8000:8000 -v $(pwd)/example-lib:/example-lib -e KROKI_SAFE_MODE=SAFE -e KROKI_PLANTUML_INCLUDE_PATH=/example-lib yuzutech/kroki:latest
$ curl http://localhost:8000/plantuml/svg/$(printf '@startuml\n!include bob.puml\nAlice -> Bob\n@enduml' | python -c "import sys; import base64; import zlib; print(base64.urlsafe_b64encode(zlib.compress(sys.stdin.read(), 9)))")
$ curl https://kroki.io/plantuml/svg/$(printf '@startuml\n!include bob.puml\nAlice -> Bob\n@enduml' | python -c "import sys; import base64; import zlib; print(base64.urlsafe_b64encode(zlib.compress(sys.stdin.read().encode('utf-8'), 9)).decode('ascii'))")
----

== Manual install
Expand Down

0 comments on commit 69af780

Please sign in to comment.