diff --git a/appimage/make-appimage b/appimage/make-appimage new file mode 100755 index 0000000..f21475f --- /dev/null +++ b/appimage/make-appimage @@ -0,0 +1,29 @@ +#!/bin/bash + +# Copyright (C) 2017 Andrew Hamilton. All rights reserved. +# Licensed under the Artistic License 2.0. + + +set -e + + +VIGIL_PATH=$(realpath $(dirname $0)/..) +export VIGIL_PATH + + +function get_patched_recipe { + wget -c "https://github.com/AppImage/AppImages/raw/94d39b68d8d7ab56f31fde6f59bc8d2813d13599/recipes/meta/Recipe" + cp Recipe Recipe-patched + sed -i -e 's|delete_blacklisted|# delete_blacklisted|g' Recipe-patched + chmod +x Recipe-patched +} + + +[ $# -eq 0 ] && WORK_PATH=$(mktemp -d --suffix=-appimage) || WORK_PATH="$1" +cd "$WORK_PATH" +$VIGIL_PATH/appimage/make-appimage-yml.py > vigil.yml +get_patched_recipe +./Recipe-patched --no-di vigil.yml +mv out/Vigil* . +echo +echo "AppImage path: $(realpath Vigil*)" diff --git a/appimage/make-appimage-yml.py b/appimage/make-appimage-yml.py new file mode 100755 index 0000000..044b08d --- /dev/null +++ b/appimage/make-appimage-yml.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python3 + +# Copyright (C) 2017 Andrew Hamilton. All rights reserved. +# Licensed under the Artistic License 2.0. + + +import vigil.tools as tools + + +dist_deps = set() +for dependency in tools.dependencies("ubuntu"): + if "/" in dependency: + raise ValueError + else: + dist_deps.add(dependency) +dist_deps.update({"python3-pygments", "python3-pyinotify", "python3-docopt", + "util-linux", "python3-pil", "python3-pip", + "python3-setuptools"}) +dep_list = "\n - ".join(sorted(dist_deps)) +print("""app: vigil-code-monitor + +ingredients: + packages: + - %s + dist: zesty + sources: + - deb http://archive.ubuntu.com/ubuntu/ zesty main universe + +script: + - ./usr/bin/python3 -m pip install $VIGIL_PATH + - cp $VIGIL_PATH/appimage/vigil-icon.png . + - cp -a $VIGIL_PATH/tests . + - cp $VIGIL_PATH/test-all tests + - cat > vigil.desktop <<\EOF + - [Desktop Entry] + - Type=Application + - Name=Vigil Code Monitor + - Comment=Vigil maintains an up-to-date set of reports for every file in a codebase. + - Exec=./bin/python3 -m vigil + - Terminal=true + - Icon=vigil-icon.png + - Categories=Application; + - EOF +""" % dep_list) diff --git a/appimage/vigil-icon.png b/appimage/vigil-icon.png new file mode 100644 index 0000000..7994ed4 Binary files /dev/null and b/appimage/vigil-icon.png differ diff --git a/vigil/__main__.py b/vigil/__main__.py index fefa692..9a3f0d0 100755 --- a/vigil/__main__.py +++ b/vigil/__main__.py @@ -41,12 +41,17 @@ from vigil import tools from vigil import worker +if "APPDIR" in os.environ: + test_usage_line = " vigil --self_test\n" + test_option_line = (" --self_test " + "Test that vigil is working properly.\n") +else: + test_usage_line, test_option_line = "", "" USAGE = """ Usage: vigil [options] vigil -h | --help - vigil --self_test - +%s Example: # vigil my_project @@ -58,8 +63,7 @@ Options: the *edit command. It may contain options. -t THEME, --theme=THEME The pygment theme used for syntax highlighting. Defaults to "native". - --self_test Test that vigil is working properly. -""" +%s""" % (test_usage_line, test_option_line) KEYS_DOC = """Keys: @@ -1016,9 +1020,10 @@ def check_arguments(): if arguments["--help"]: print(cmdline_help) sys.exit(0) - if arguments["--self_test"]: - test_path = os.path.join(os.path.dirname(__file__), "test-all") - sys.exit(subprocess.call([test_path])) + if "APPDIR" in os.environ and arguments["--self_test"]: + test_dir = os.path.join(os.environ["APPDIR"], "tests") + sys.exit(subprocess.call([os.path.join(test_dir, "test-all")], + cwd=test_dir)) worker_count = None try: if arguments["--workers"] is not None: diff --git a/vigil/tools.py b/vigil/tools.py index 6cc9550..5b8f2e1 100644 --- a/vigil/tools.py +++ b/vigil/tools.py @@ -400,7 +400,8 @@ def pycodestyle(path): return _run_command([_python_version(path), "-m", "pycodestyle", path]) -@deps(deps={"pyflakes"}, arch_deps={"python2-pyflakes", "python-pyflakes"}, +@deps(deps={"python-pyflakes", "python3-pyflakes"}, + arch_deps={"python2-pyflakes", "python-pyflakes"}, opensuse_deps={"python2-pyflakes", "python3-pyflakes"}, url="pyflakes", missing_in={"gentoo"}) def pyflakes(path): @@ -611,7 +612,7 @@ def html2text(path): return _run_command(["html2text", path], Status.normal) -@deps(deps={"gcc"}, url="https://gcc.gnu.org/", executables={"gcc"}) +@deps(deps={"gcc", "g++-6"}, url="https://gcc.gnu.org/", executables={"gcc"}) def cpp_syntax_gcc(path): return _run_command(["gcc", "-fsyntax-only", path])