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
|
|
@ -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,15 +455,14 @@ 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)
|
||||
return Status.ok, _image_to_text(image)
|
||||
@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)
|
||||
|
||||
|
||||
@deps(deps={"golang-go"},
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue