Use ubuntu dependencies for tools.
- No longer sourcing deps for flatpak's sake. - Switching from svglib to cairosvg since svglib not in ubuntu.
This commit is contained in:
parent
96b148d450
commit
3b8a6cffcb
4 changed files with 31 additions and 55 deletions
|
|
@ -63,6 +63,6 @@ File types(100) | Tools(60)
|
||||||
.deb | [dpkg_contents](https://wiki.debian.org/Teams/Dpkg) • [dpkg_info](https://wiki.debian.org/Teams/Dpkg)
|
.deb | [dpkg_contents](https://wiki.debian.org/Teams/Dpkg) • [dpkg_info](https://wiki.debian.org/Teams/Dpkg)
|
||||||
.rpm | [rpm](http://rpm.org/)
|
.rpm | [rpm](http://rpm.org/)
|
||||||
.png .jpg .gif .bmp .tif .tiff .tga .ico .xpm | [mediainfo](https://mediaarea.net/MediaInfo) • [pil](http://python-pillow.github.io/)
|
.png .jpg .gif .bmp .tif .tiff .tga .ico .xpm | [mediainfo](https://mediaarea.net/MediaInfo) • [pil](http://python-pillow.github.io/)
|
||||||
.svg .svgz | [svglib](https://github.com/deeplook/svglib)
|
.svg .svgz | [cairosvg](https://cairosvg.org/)
|
||||||
.mkv .mka .mks .ogg .ogm .avi .wav .mpeg .mpg .vob .mp4 .mpgv .mpv .m1v .m2v .mp2 .mp3 .asf .wma .wmv .qt .mov .rm .rmvb .ra .ifo .ac3 .dts .aac .flac .aiff .aifc .au .iff .flv .srt .ssa .ass .sami | [mediainfo](https://mediaarea.net/MediaInfo)
|
.mkv .mka .mks .ogg .ogm .avi .wav .mpeg .mpg .vob .mp4 .mpgv .mpv .m1v .m2v .mp2 .mp3 .asf .wma .wmv .qt .mov .rm .rmvb .ra .ifo .ac3 .dts .aac .flac .aiff .aifc .au .iff .flv .srt .ssa .ass .sami | [mediainfo](https://mediaarea.net/MediaInfo)
|
||||||
.iso | [isoinfo](https://manpages.debian.org/jessie/genisoimage/isoinfo.1.en.html)
|
.iso | [isoinfo](https://manpages.debian.org/jessie/genisoimage/isoinfo.1.en.html)
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import functools
|
||||||
import importlib
|
import importlib
|
||||||
import importlib.util
|
import importlib.util
|
||||||
import importlib.resources
|
import importlib.resources
|
||||||
|
import io
|
||||||
import math
|
import math
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
|
|
@ -234,7 +235,7 @@ def metadata(path):
|
||||||
return (Status.ok, fill3.join("", text))
|
return (Status.ok, fill3.join("", text))
|
||||||
|
|
||||||
|
|
||||||
@deps(deps={"pip/pygments"}, url="http://pygments.org/")
|
@deps(deps={"python3-pygments"}, url="http://pygments.org/")
|
||||||
def contents(path):
|
def contents(path):
|
||||||
with open(path) as file_:
|
with open(path) as file_:
|
||||||
try:
|
try:
|
||||||
|
|
@ -272,8 +273,8 @@ def python_unittests(path):
|
||||||
return Status.not_applicable, "No tests."
|
return Status.not_applicable, "No tests."
|
||||||
|
|
||||||
|
|
||||||
@deps(deps={"pip/pytest", "pip/pytest-cov"},
|
@deps(deps={"python3-pytest", "python3-pytest-cov"},
|
||||||
url="https://docs.pytest.org/en/latest/", executables={"pytest"})
|
url="https://docs.pytest.org/en/latest/", executables={"pytest-3"})
|
||||||
def pytest(path):
|
def pytest(path):
|
||||||
command = [PYTHON_EXECUTABLE, "-m", "pytest", "--cov=.",
|
command = [PYTHON_EXECUTABLE, "-m", "pytest", "--cov=.",
|
||||||
"--doctest-modules", "--color=yes", path]
|
"--doctest-modules", "--color=yes", path]
|
||||||
|
|
@ -293,7 +294,7 @@ def pytest(path):
|
||||||
return status, (stdout + stderr)
|
return status, (stdout + stderr)
|
||||||
|
|
||||||
|
|
||||||
@deps(deps={"pip/mypy"}, url="http://mypy-lang.org/", executables={"mypy"})
|
@deps(deps={"python3-mypy"}, url="http://mypy-lang.org/")
|
||||||
def mypy(path):
|
def mypy(path):
|
||||||
stdout, stderr, returncode = _do_command(
|
stdout, stderr, returncode = _do_command(
|
||||||
[PYTHON_EXECUTABLE, "-m", "mypy", "--ignore-missing-imports", path],
|
[PYTHON_EXECUTABLE, "-m", "mypy", "--ignore-missing-imports", path],
|
||||||
|
|
@ -309,7 +310,7 @@ def _colorize_coverage_report(lines):
|
||||||
for line in lines])
|
for line in lines])
|
||||||
|
|
||||||
|
|
||||||
@deps(deps={"pip/coverage"}, url="https://coverage.readthedocs.io/")
|
@deps(deps={"python3-coverage"}, url="https://coverage.readthedocs.io/")
|
||||||
def python_coverage(path):
|
def python_coverage(path):
|
||||||
coverage_path = ".coverage"
|
coverage_path = ".coverage"
|
||||||
if not os.path.exists(coverage_path):
|
if not os.path.exists(coverage_path):
|
||||||
|
|
@ -374,7 +375,7 @@ def _colorize_mccabe(text):
|
||||||
for line in text.splitlines(keepends=True)])
|
for line in text.splitlines(keepends=True)])
|
||||||
|
|
||||||
|
|
||||||
@deps(deps={"pip/mccabe"}, url="https://pypi.org/project/mccabe/")
|
@deps(deps={"python3-mccabe"}, url="https://pypi.org/project/mccabe/")
|
||||||
def python_mccabe(path):
|
def python_mccabe(path):
|
||||||
stdout, *rest = _do_command([PYTHON_EXECUTABLE, "-m", "mccabe", path])
|
stdout, *rest = _do_command([PYTHON_EXECUTABLE, "-m", "mccabe", path])
|
||||||
max_score = 0
|
max_score = 0
|
||||||
|
|
@ -386,7 +387,7 @@ def python_mccabe(path):
|
||||||
|
|
||||||
|
|
||||||
# FIX: Reenable when pydisasm is not causing problems
|
# FIX: Reenable when pydisasm is not causing problems
|
||||||
# @deps(deps={"pip/xdis"}, executables={"pydisasm"},
|
# @deps(deps={"python3-xdis"}, executables={"pydisasm"},
|
||||||
# url="https://pypi.python.org/pypi/xdis")
|
# url="https://pypi.python.org/pypi/xdis")
|
||||||
# def pydisasm(path):
|
# def pydisasm(path):
|
||||||
# return _run_command(["pydisasm", path], Status.ok,
|
# return _run_command(["pydisasm", path], Status.ok,
|
||||||
|
|
@ -444,7 +445,7 @@ def _image_to_text(image):
|
||||||
for index in range(0, image.height, 2)])
|
for index in range(0, image.height, 2)])
|
||||||
|
|
||||||
|
|
||||||
@deps(deps={"pip/pillow"}, url="http://python-pillow.github.io/")
|
@deps(deps={"python3-pillow"}, url="http://python-pillow.github.io/")
|
||||||
def pil(path):
|
def pil(path):
|
||||||
import PIL.Image
|
import PIL.Image
|
||||||
with open(path, "rb") as image_file:
|
with open(path, "rb") as image_file:
|
||||||
|
|
@ -454,15 +455,14 @@ def pil(path):
|
||||||
return Status.ok, _image_to_text(image)
|
return Status.ok, _image_to_text(image)
|
||||||
|
|
||||||
|
|
||||||
@deps(deps={"pip/svglib"}, url="https://github.com/deeplook/svglib")
|
@deps(deps={"python3-cairosvg"}, url="https://cairosvg.org/")
|
||||||
def svglib(path):
|
def cairosvg(path):
|
||||||
import svglib.svglib
|
import cairosvg
|
||||||
import reportlab.graphics.renderPM
|
import PIL.Image
|
||||||
drawing = svglib.svglib.svg2rlg(path)
|
png_bytes = cairosvg.svg2png(url=path, output_width=MAX_IMAGE_SIZE)
|
||||||
image = reportlab.graphics.renderPM.drawToPIL(drawing)
|
with io.BytesIO(png_bytes) as png_file:
|
||||||
if image.width > MAX_IMAGE_SIZE:
|
with PIL.Image.open(png_file).convert("RGB") as image:
|
||||||
image = _resize_image(image, MAX_IMAGE_SIZE)
|
return Status.ok, _image_to_text(image)
|
||||||
return Status.ok, _image_to_text(image)
|
|
||||||
|
|
||||||
|
|
||||||
@deps(deps={"golang-go"},
|
@deps(deps={"golang-go"},
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ tools_for_extensions = [
|
||||||
[["deb"], ["dpkg_contents", "dpkg_info"]],
|
[["deb"], ["dpkg_contents", "dpkg_info"]],
|
||||||
[["rpm"], ["rpm"]],
|
[["rpm"], ["rpm"]],
|
||||||
[["png", "jpg", "gif", "bmp", "tif", "tiff", "tga", "ico", "xpm"], ["mediainfo", "pil"]],
|
[["png", "jpg", "gif", "bmp", "tif", "tiff", "tga", "ico", "xpm"], ["mediainfo", "pil"]],
|
||||||
[["svg", "svgz"], ["svglib"]],
|
[["svg", "svgz"], ["cairosvg"]],
|
||||||
[["mkv", "mka", "mks", "ogg", "ogm", "avi", "wav", "mpeg", "mpg", "vob",
|
[["mkv", "mka", "mks", "ogg", "ogm", "avi", "wav", "mpeg", "mpg", "vob",
|
||||||
"mp4", "mpgv", "mpv", "m1v", "m2v", "mp2", "mp3", "asf", "wma", "wmv",
|
"mp4", "mpgv", "mpv", "m1v", "m2v", "mp2", "mp3", "asf", "wma", "wmv",
|
||||||
"qt", "mov", "rm", "rmvb", "ra", "ifo", "ac3", "dts", "aac", "flac",
|
"qt", "mov", "rm", "rmvb", "ra", "ifo", "ac3", "dts", "aac", "flac",
|
||||||
|
|
@ -58,22 +58,22 @@ tools_for_extensions = [
|
||||||
timeout = 60
|
timeout = 60
|
||||||
|
|
||||||
[pycodestyle]
|
[pycodestyle]
|
||||||
dependencies = ["pip/pycodestyle"]
|
dependencies = ["python3-pycodestyle"]
|
||||||
url = "http://pycodestyle.pycqa.org/en/latest/"
|
url = "http://pycodestyle.pycqa.org/en/latest/"
|
||||||
command = "python3.9 -m pycodestyle"
|
command = "python3.9 -m pycodestyle"
|
||||||
|
|
||||||
[pydocstyle]
|
[pydocstyle]
|
||||||
dependencies = ["pip/pydocstyle"]
|
dependencies = ["python3-pydocstyle"]
|
||||||
url = "http://www.pydocstyle.org/en/2.1.1/usage.html"
|
url = "http://www.pydocstyle.org/en/2.1.1/usage.html"
|
||||||
command = "python3.9 -m pydocstyle --ignore=D1,D213"
|
command = "python3.9 -m pydocstyle --ignore=D1,D213"
|
||||||
|
|
||||||
[pyflakes]
|
[pyflakes]
|
||||||
dependencies = ["pip/pyflakes"]
|
dependencies = ["python3-pyflakes"]
|
||||||
url = "https://pypi.org/project/pyflakes/"
|
url = "https://pypi.org/project/pyflakes/"
|
||||||
command = "python3.9 -m pyflakes"
|
command = "python3.9 -m pyflakes"
|
||||||
|
|
||||||
[pylint]
|
[pylint]
|
||||||
dependencies = ["pip/pylint"]
|
dependencies = ["pylint"]
|
||||||
url = "https://www.pylint.org/"
|
url = "https://www.pylint.org/"
|
||||||
command = "python3.9 -m pylint -f colorized --errors-only"
|
command = "python3.9 -m pylint -f colorized --errors-only"
|
||||||
has_color = true
|
has_color = true
|
||||||
|
|
@ -84,7 +84,7 @@ tools_for_extensions = [
|
||||||
command = "python3.9 -m modulefinder"
|
command = "python3.9 -m modulefinder"
|
||||||
|
|
||||||
[bandit]
|
[bandit]
|
||||||
dependencies = ["pip/bandit"]
|
dependencies = ["python3-bandit"]
|
||||||
url = "https://pypi.org/project/bandit/"
|
url = "https://pypi.org/project/bandit/"
|
||||||
command = "python3.9 -m bandit.cli.main -f screen"
|
command = "python3.9 -m bandit.cli.main -f screen"
|
||||||
has_color = true
|
has_color = true
|
||||||
|
|
@ -197,9 +197,9 @@ tools_for_extensions = [
|
||||||
command = "nm --demangle"
|
command = "nm --demangle"
|
||||||
|
|
||||||
[pdf2txt]
|
[pdf2txt]
|
||||||
dependencies = ["pip/pdfminer.six"]
|
dependencies = ["python3-pdfminer"]
|
||||||
url = "https://github.com/pdfminer/pdfminer.six"
|
url = "https://github.com/pdfminer/pdfminer.six"
|
||||||
command = "pdf2txt.py"
|
command = "pdf2txt"
|
||||||
|
|
||||||
[html2text]
|
[html2text]
|
||||||
dependencies = ["html2text"]
|
dependencies = ["html2text"]
|
||||||
|
|
@ -256,7 +256,7 @@ tools_for_extensions = [
|
||||||
command = "node --check"
|
command = "node --check"
|
||||||
|
|
||||||
[lua_check]
|
[lua_check]
|
||||||
dependencies = ["luarocks/luacheck"]
|
dependencies = ["lua-check"]
|
||||||
url = "https://github.com/mpeterv/luacheck"
|
url = "https://github.com/mpeterv/luacheck"
|
||||||
command = "luacheck"
|
command = "luacheck"
|
||||||
has_color = true
|
has_color = true
|
||||||
|
|
@ -277,7 +277,7 @@ tools_for_extensions = [
|
||||||
command = "wasm-objdump --disassemble"
|
command = "wasm-objdump --disassemble"
|
||||||
|
|
||||||
[yamllint]
|
[yamllint]
|
||||||
dependencies = ["pip/yamllint"]
|
dependencies = ["yamllint"]
|
||||||
url = "https://github.com/adrienverge/yamllint"
|
url = "https://github.com/adrienverge/yamllint"
|
||||||
command = "python3.9 -m yamllint -f colored"
|
command = "python3.9 -m yamllint -f colored"
|
||||||
has_color = true
|
has_color = true
|
||||||
|
|
|
||||||
|
|
@ -2,33 +2,9 @@
|
||||||
|
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
import eris.tools
|
import eris.tools
|
||||||
|
|
||||||
|
|
||||||
pip_deps, go_deps, luarocks_deps, dist_deps, git_deps = set(), set(), set(), \
|
subprocess.run(["sudo", "apt-get", "-y", "install"] +
|
||||||
set(), set()
|
list(eris.tools.dependencies()), check=True)
|
||||||
dep_types = {"pip": pip_deps, "go": go_deps, "luarocks": luarocks_deps,
|
|
||||||
"git": git_deps}
|
|
||||||
for dependency in eris.tools.dependencies():
|
|
||||||
if "/" in dependency:
|
|
||||||
dep_type, dep = dependency.split("/", maxsplit=1)
|
|
||||||
dep_types[dep_type].add(dep)
|
|
||||||
else:
|
|
||||||
dist_deps.add(dependency)
|
|
||||||
if dist_deps:
|
|
||||||
subprocess.run(["sudo", "apt-get", "-y", "install"] + list(dist_deps),
|
|
||||||
check=True)
|
|
||||||
if pip_deps:
|
|
||||||
subprocess.run(["python" + eris.tools.PYTHON_VERSION, "-m", "pip",
|
|
||||||
"install", "--force-reinstall"] + list(pip_deps),
|
|
||||||
check=True)
|
|
||||||
if go_deps:
|
|
||||||
subprocess.run(["sudo", "apt-get", "-y", "install", "golang-go"],
|
|
||||||
check=True)
|
|
||||||
subprocess.run(["go", "get"] + list(go_deps), check=True)
|
|
||||||
|
|
||||||
if luarocks_deps:
|
|
||||||
subprocess.run(["sudo", "apt-get", "-y", "install", "luarocks",
|
|
||||||
"liblua5.3-dev"], check=True)
|
|
||||||
subprocess.run(["sudo", "luarocks", "install"] + list(luarocks_deps),
|
|
||||||
check=True)
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue