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)
|
||||
.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/)
|
||||
.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)
|
||||
.iso | [isoinfo](https://manpages.debian.org/jessie/genisoimage/isoinfo.1.en.html)
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import functools
|
|||
import importlib
|
||||
import importlib.util
|
||||
import importlib.resources
|
||||
import io
|
||||
import math
|
||||
import os
|
||||
import os.path
|
||||
|
|
@ -234,7 +235,7 @@ def metadata(path):
|
|||
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):
|
||||
with open(path) as file_:
|
||||
try:
|
||||
|
|
@ -272,8 +273,8 @@ def python_unittests(path):
|
|||
return Status.not_applicable, "No tests."
|
||||
|
||||
|
||||
@deps(deps={"pip/pytest", "pip/pytest-cov"},
|
||||
url="https://docs.pytest.org/en/latest/", executables={"pytest"})
|
||||
@deps(deps={"python3-pytest", "python3-pytest-cov"},
|
||||
url="https://docs.pytest.org/en/latest/", executables={"pytest-3"})
|
||||
def pytest(path):
|
||||
command = [PYTHON_EXECUTABLE, "-m", "pytest", "--cov=.",
|
||||
"--doctest-modules", "--color=yes", path]
|
||||
|
|
@ -293,7 +294,7 @@ def pytest(path):
|
|||
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):
|
||||
stdout, stderr, returncode = _do_command(
|
||||
[PYTHON_EXECUTABLE, "-m", "mypy", "--ignore-missing-imports", path],
|
||||
|
|
@ -309,7 +310,7 @@ def _colorize_coverage_report(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):
|
||||
coverage_path = ".coverage"
|
||||
if not os.path.exists(coverage_path):
|
||||
|
|
@ -374,7 +375,7 @@ def _colorize_mccabe(text):
|
|||
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):
|
||||
stdout, *rest = _do_command([PYTHON_EXECUTABLE, "-m", "mccabe", path])
|
||||
max_score = 0
|
||||
|
|
@ -386,7 +387,7 @@ def python_mccabe(path):
|
|||
|
||||
|
||||
# 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")
|
||||
# def pydisasm(path):
|
||||
# return _run_command(["pydisasm", path], Status.ok,
|
||||
|
|
@ -444,7 +445,7 @@ def _image_to_text(image):
|
|||
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):
|
||||
import PIL.Image
|
||||
with open(path, "rb") as image_file:
|
||||
|
|
@ -454,14 +455,13 @@ def pil(path):
|
|||
return Status.ok, _image_to_text(image)
|
||||
|
||||
|
||||
@deps(deps={"pip/svglib"}, url="https://github.com/deeplook/svglib")
|
||||
def svglib(path):
|
||||
import svglib.svglib
|
||||
import reportlab.graphics.renderPM
|
||||
drawing = svglib.svglib.svg2rlg(path)
|
||||
image = reportlab.graphics.renderPM.drawToPIL(drawing)
|
||||
if image.width > MAX_IMAGE_SIZE:
|
||||
image = _resize_image(image, MAX_IMAGE_SIZE)
|
||||
@deps(deps={"python3-cairosvg"}, url="https://cairosvg.org/")
|
||||
def cairosvg(path):
|
||||
import cairosvg
|
||||
import PIL.Image
|
||||
png_bytes = cairosvg.svg2png(url=path, output_width=MAX_IMAGE_SIZE)
|
||||
with io.BytesIO(png_bytes) as png_file:
|
||||
with PIL.Image.open(png_file).convert("RGB") as image:
|
||||
return Status.ok, _image_to_text(image)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ tools_for_extensions = [
|
|||
[["deb"], ["dpkg_contents", "dpkg_info"]],
|
||||
[["rpm"], ["rpm"]],
|
||||
[["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",
|
||||
"mp4", "mpgv", "mpv", "m1v", "m2v", "mp2", "mp3", "asf", "wma", "wmv",
|
||||
"qt", "mov", "rm", "rmvb", "ra", "ifo", "ac3", "dts", "aac", "flac",
|
||||
|
|
@ -58,22 +58,22 @@ tools_for_extensions = [
|
|||
timeout = 60
|
||||
|
||||
[pycodestyle]
|
||||
dependencies = ["pip/pycodestyle"]
|
||||
dependencies = ["python3-pycodestyle"]
|
||||
url = "http://pycodestyle.pycqa.org/en/latest/"
|
||||
command = "python3.9 -m pycodestyle"
|
||||
|
||||
[pydocstyle]
|
||||
dependencies = ["pip/pydocstyle"]
|
||||
dependencies = ["python3-pydocstyle"]
|
||||
url = "http://www.pydocstyle.org/en/2.1.1/usage.html"
|
||||
command = "python3.9 -m pydocstyle --ignore=D1,D213"
|
||||
|
||||
[pyflakes]
|
||||
dependencies = ["pip/pyflakes"]
|
||||
dependencies = ["python3-pyflakes"]
|
||||
url = "https://pypi.org/project/pyflakes/"
|
||||
command = "python3.9 -m pyflakes"
|
||||
|
||||
[pylint]
|
||||
dependencies = ["pip/pylint"]
|
||||
dependencies = ["pylint"]
|
||||
url = "https://www.pylint.org/"
|
||||
command = "python3.9 -m pylint -f colorized --errors-only"
|
||||
has_color = true
|
||||
|
|
@ -84,7 +84,7 @@ tools_for_extensions = [
|
|||
command = "python3.9 -m modulefinder"
|
||||
|
||||
[bandit]
|
||||
dependencies = ["pip/bandit"]
|
||||
dependencies = ["python3-bandit"]
|
||||
url = "https://pypi.org/project/bandit/"
|
||||
command = "python3.9 -m bandit.cli.main -f screen"
|
||||
has_color = true
|
||||
|
|
@ -197,9 +197,9 @@ tools_for_extensions = [
|
|||
command = "nm --demangle"
|
||||
|
||||
[pdf2txt]
|
||||
dependencies = ["pip/pdfminer.six"]
|
||||
dependencies = ["python3-pdfminer"]
|
||||
url = "https://github.com/pdfminer/pdfminer.six"
|
||||
command = "pdf2txt.py"
|
||||
command = "pdf2txt"
|
||||
|
||||
[html2text]
|
||||
dependencies = ["html2text"]
|
||||
|
|
@ -256,7 +256,7 @@ tools_for_extensions = [
|
|||
command = "node --check"
|
||||
|
||||
[lua_check]
|
||||
dependencies = ["luarocks/luacheck"]
|
||||
dependencies = ["lua-check"]
|
||||
url = "https://github.com/mpeterv/luacheck"
|
||||
command = "luacheck"
|
||||
has_color = true
|
||||
|
|
@ -277,7 +277,7 @@ tools_for_extensions = [
|
|||
command = "wasm-objdump --disassemble"
|
||||
|
||||
[yamllint]
|
||||
dependencies = ["pip/yamllint"]
|
||||
dependencies = ["yamllint"]
|
||||
url = "https://github.com/adrienverge/yamllint"
|
||||
command = "python3.9 -m yamllint -f colored"
|
||||
has_color = true
|
||||
|
|
|
|||
|
|
@ -2,33 +2,9 @@
|
|||
|
||||
|
||||
import subprocess
|
||||
|
||||
import eris.tools
|
||||
|
||||
|
||||
pip_deps, go_deps, luarocks_deps, dist_deps, git_deps = set(), set(), set(), \
|
||||
set(), set()
|
||||
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)
|
||||
subprocess.run(["sudo", "apt-get", "-y", "install"] +
|
||||
list(eris.tools.dependencies()), check=True)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue