tools: Changed to toml instead of yaml.

- toml is simpler than yaml and popular enough.
This commit is contained in:
Andrew Hamilton 2018-05-17 16:16:21 +10:00
parent 10fbc33759
commit 915eac35ba
5 changed files with 109 additions and 109 deletions

View file

@ -14,7 +14,7 @@ if [ $DIST_ID != "ubuntu" ]; then
fi
echo "Installing the dependencies of the vigil script..."
sudo apt --yes install python3-pyinotify python3-pygments python3-docopt \
python3-pillow util-linux python3-yaml
python3-pillow util-linux python3-toml
echo
echo "Installing all the tools vigil may need..."
./install-tools

View file

@ -18,7 +18,7 @@ setup(name="vigil",
author="Andrew Hamilton",
license="Artistic 2.0",
packages=["vigil", "vigil.urwid"],
package_data={"vigil": ["LS_COLORS.sh", "tools.yaml"]},
package_data={"vigil": ["LS_COLORS.sh", "tools.toml"]},
entry_points={"console_scripts":
["vigil=vigil.__main__:entry_point",
"vigil-worker=vigil.worker:main",

View file

@ -25,7 +25,7 @@ import PIL.Image
import pygments
import pygments.lexers
import pygments.styles
import yaml
import toml
import vigil.fill3 as fill3
import vigil.gut as gut
@ -645,11 +645,11 @@ def make_tool_function(dependencies, url, command, success_status=None,
return func
tools_yaml_path = os.path.join(os.path.dirname(__file__), "tools.yaml")
with open(tools_yaml_path) as tools_yaml_file:
tools_yaml = yaml.load(tools_yaml_file.read())
for tool_name, tool_yaml in tools_yaml.items():
tool_func = make_tool_function(**tool_yaml)
tools_toml_path = os.path.join(os.path.dirname(__file__), "tools.toml")
with open(tools_toml_path) as tools_toml_file:
tools_toml = toml.load(tools_toml_file)
for tool_name, tool_toml in tools_toml.items():
tool_func = make_tool_function(**tool_toml)
tool_func.__name__ = tool_func.__qualname__ = tool_name
globals()[tool_name] = tool_func

101
vigil/tools.toml Normal file
View file

@ -0,0 +1,101 @@
# Template:
# []
# dependencies = [""]
# url = ""
# command = ""
# success_status = ""
# error_status = ""
[objdump_headers]
dependencies = ["binutils"]
url = "https://en.wikipedia.org/wiki/Objdump"
command = "objdump --all-headers"
success_status = "normal"
[objdump_disassemble]
dependencies = ["binutils"]
url = "https://en.wikipedia.org/wiki/Objdump"
command = "objdump --disassemble --reloc --dynamic-reloc"
success_status = "normal"
[readelf]
dependencies = ["binutils"]
url = "https://en.wikipedia.org/wiki/Objdump"
command = "readelf --all"
success_status = "normal"
[unzip]
dependencies = ["unzip"]
url = "unzip"
command = "unzip -l"
success_status = "normal"
[tar_gz]
dependencies = ["tar"]
url = "http://www.gnu.org/software/tar/manual/tar.html"
command = "tar ztvf"
success_status = "normal"
[tar_bz2]
dependencies = ["tar"]
url = "http://www.gnu.org/software/tar/manual/tar.html"
command = "tar jtvf"
success_status = "normal"
[nm]
dependencies = ["binutils"]
url = "https://linux.die.net/man/1/nm"
command = "nm --demangle"
success_status = "normal"
[pdf2txt]
dependencies = ["python-pdfminer"]
url = "python-pdfminer"
command = "pdf2txt"
success_status = "normal"
[html2text]
dependencies = ["html2text"]
url = "html2text"
command = "html2text"
success_status = "normal"
[c_syntax_gcc]
dependencies = ["gcc", "g++-6"]
url = "https://gcc.gnu.org/"
command = "gcc -fsyntax-only"
[cpp_syntax_gcc]
dependencies = ["gcc", "g++-6"]
url = "https://gcc.gnu.org/"
command = "gcc -fsyntax-only"
[php7_syntax]
dependencies = ["php7.2-cli"]
url = "https://en.wikipedia.org/wiki/PHP"
command = "php7.2 --syntax-check"
[shellcheck]
dependencies = ["shellcheck"]
url = "shellcheck"
command = "shellcheck"
[cppcheck]
dependencies = ["cppcheck"]
url = "cppcheck"
command = "cppcheck"
[gofmt]
dependencies = ["golang-go"]
url = "golang-go"
command = "gofmt"
success_status = "normal"
[go_vet]
dependencies = ["golang-go"]
url = "golang-go"
command = "go vet"
error_status = "normal"

View file

@ -1,101 +0,0 @@
# Template:
# :
# dependencies: []
# url:
# command:
# success_status:
# error_status:
objdump_headers:
dependencies: [binutils]
url: https://en.wikipedia.org/wiki/Objdump
command: objdump --all-headers
success_status: normal
objdump_disassemble:
dependencies: [binutils]
url: https://en.wikipedia.org/wiki/Objdump
command: objdump --disassemble --reloc --dynamic-reloc
success_status: normal
readelf:
dependencies: [binutils]
url: https://en.wikipedia.org/wiki/Objdump
command: readelf --all
success_status: normal
unzip:
dependencies: [unzip]
url: unzip
command: unzip -l
success_status: normal
tar_gz:
dependencies: [tar]
url: http://www.gnu.org/software/tar/manual/tar.html
command: tar ztvf
success_status: normal
tar_bz2:
dependencies: [tar]
url: http://www.gnu.org/software/tar/manual/tar.html
command: tar jtvf
success_status: normal
nm:
dependencies: [binutils]
url: https://linux.die.net/man/1/nm
command: nm --demangle
success_status: normal
pdf2txt:
dependencies: [python-pdfminer]
url: python-pdfminer
command: pdf2txt
success_status: normal
html2text:
dependencies: [html2text]
url: html2text
command: html2text
success_status: normal
c_syntax_gcc:
dependencies: [gcc, g++-6]
url: https://gcc.gnu.org/
command: gcc -fsyntax-only
cpp_syntax_gcc:
dependencies: [gcc, g++-6]
url: https://gcc.gnu.org/
command: gcc -fsyntax-only
php7_syntax:
dependencies: [php7.2-cli]
url: https://en.wikipedia.org/wiki/PHP
command: php7.2 --syntax-check
shellcheck:
dependencies: [shellcheck]
url: shellcheck
command: shellcheck
cppcheck:
dependencies: [cppcheck]
url: cppcheck
command: cppcheck
gofmt:
dependencies: [golang-go]
url: golang-go
command: gofmt
success_status: normal
go_vet:
dependencies: [golang-go]
url: golang-go
command: go vet
error_status: normal