diff --git a/install-tools b/install-tools index faea23f..f522627 100755 --- a/install-tools +++ b/install-tools @@ -5,12 +5,12 @@ import subprocess -import tools +import vigil.tools -dist_id = tools.get_distro_id() +dist_id = vigil.tools.get_distro_id() pip_deps, pip3_deps, dist_deps = set(), set(), set() -for dependency in tools.dependencies(dist_id): +for dependency in vigil.tools.dependencies(dist_id): if "/" in dependency: pip_version, pip_dependency = dependency.split("/") (pip_deps if pip_version == "pip" else pip3_deps).add(pip_dependency) diff --git a/make-readme.py b/make-readme.py index b36be05..fbf37af 100755 --- a/make-readme.py +++ b/make-readme.py @@ -5,7 +5,7 @@ # Licensed under the Artistic License 2.0. -import tools +import vigil.tools as tools def tool_markup(tool): diff --git a/setup.py b/setup.py new file mode 100755 index 0000000..7b89a2f --- /dev/null +++ b/setup.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 + +# Copyright (C) 2017 Andrew Hamilton. All rights reserved. +# Licensed under the Artistic License 2.0. + + +try: + from setuptools import setup +except ImportError: + from distutils.core import setup + + +setup(name="vigil", + version="17.06", + description=("Vigil maintains an up-to-date set of reports for every" + " file in a codebase."), + url="https://github.com/ahamilton/vigil", + author="Andrew Hamilton", + license="Artistic 2.0", + packages=["vigil"], + entry_points={"console_scripts": + ["vigil=vigil.__main__:entry_point", + "vigil-worker=vigil.worker:main"]}) diff --git a/test-all b/test-all index 2f2d29c..453f2a0 100755 --- a/test-all +++ b/test-all @@ -5,10 +5,10 @@ FAILURE=0 -CODEBASE_PATH=$(dirname $0) -for test in ${CODEBASE_PATH}/*_test.py; do +CODEBASE_PATH=$(realpath $(dirname $0)) +for test in ${CODEBASE_PATH}/tests/*_test.py; do echo "Testing $test ..." - ${test} 2>&1 + python3 -m unittest ${test} 2>&1 FAILURE=$(($FAILURE | $?)) echo done diff --git a/vigil_test.py b/tests/__main___test.py similarity index 89% rename from vigil_test.py rename to tests/__main___test.py index 88fb5e3..5d743a6 100755 --- a/vigil_test.py +++ b/tests/__main___test.py @@ -13,9 +13,9 @@ import unittest os.environ["TERM"] = "xterm-256color" -import fill3 -import golden -import vigil +import vigil.fill3 as fill3 +import vigil.golden as golden +import vigil.__main__ as __main__ _DIMENSIONS = (100, 60) @@ -51,10 +51,10 @@ class ScreenWidgetTestCase(unittest.TestCase): _touch(foo_path) jobs_added_event = asyncio.Event() appearance_changed_event = asyncio.Event() - summary = vigil.Summary(self.temp_dir, jobs_added_event) - log = vigil.Log(appearance_changed_event) - self.main_widget = vigil.Screen(summary, log, appearance_changed_event, - _MockMainLoop()) + summary = __main__.Summary(self.temp_dir, jobs_added_event) + log = __main__.Log(appearance_changed_event) + self.main_widget = __main__.Screen(summary, log, appearance_changed_event, + _MockMainLoop()) def tearDown(self): shutil.rmtree(self.temp_dir) @@ -85,13 +85,13 @@ class ScreenWidgetTestCase(unittest.TestCase): class SummaryCursorTest(unittest.TestCase): def setUp(self): - self.original_method = vigil.Summary.sync_with_filesystem - vigil.Summary.sync_with_filesystem = lambda foo: None - self.summary = vigil.Summary(None, None) + self.original_method = __main__.Summary.sync_with_filesystem + __main__.Summary.sync_with_filesystem = lambda foo: None + self.summary = __main__.Summary(None, None) self.summary._column = [[1, 1, 1], [1, 1], [1, 1, 1]] def tearDown(self): - vigil.Summary.sync_with_filesystem = self.original_method + __main__.Summary.sync_with_filesystem = self.original_method def _assert_movements(self, movements): for movement, expected_position in movements: @@ -128,7 +128,7 @@ class SummarySyncWithFilesystem(unittest.TestCase): _touch(self.bar_path) self.jobs_added_event = asyncio.Event() self.appearance_changed_event = asyncio.Event() - self.summary = vigil.Summary(self.temp_dir, self.jobs_added_event) + self.summary = __main__.Summary(self.temp_dir, self.jobs_added_event) self.jobs_added_event.clear() def tearDown(self): @@ -190,7 +190,7 @@ class SummarySyncWithFilesystem(unittest.TestCase): # def test_log(self): # appearance_changed_event = asyncio.Event() -# log = vigil.Log(appearance_changed_event) +# log = __main__.Log(appearance_changed_event) # _assert_widget_appearance(log, "golden-files/log-initial", None) # timestamp = "11:11:11" # self.assertFalse(appearance_changed_event.is_set()) @@ -219,11 +219,11 @@ class MainTestCase(unittest.TestCase): # tmp_total = _tmp_total() foo_path = os.path.join(root_path, "foo") open(foo_path, "w").close() - vigil.manage_cache(root_path) - with vigil.chdir(root_path): + __main__.manage_cache(root_path) + with __main__.chdir(root_path): with contextlib.redirect_stdout(io.StringIO()): - vigil.main(root_path, loop, worker_count=2, - is_being_tested=True) + __main__.main(root_path, loop, worker_count=2, + is_being_tested=True) for file_name in ["summary.pickle", "creation_time", "log", "foo-metadata", "foo-contents"]: self.assertTrue(os.path.exists(".vigil/" + file_name)) diff --git a/fill3_test.py b/tests/fill3_test.py similarity index 99% rename from fill3_test.py rename to tests/fill3_test.py index 7c1ea55..9aa8314 100755 --- a/fill3_test.py +++ b/tests/fill3_test.py @@ -6,7 +6,7 @@ import unittest -import fill3 +import vigil.fill3 as fill3 class WidgetTests(unittest.TestCase): diff --git a/golden-files/help b/tests/golden-files/help similarity index 100% rename from golden-files/help rename to tests/golden-files/help diff --git a/golden-files/initial b/tests/golden-files/initial similarity index 100% rename from golden-files/initial rename to tests/golden-files/initial diff --git a/golden-files/input/Mcrt1.o b/tests/golden-files/input/Mcrt1.o similarity index 100% rename from golden-files/input/Mcrt1.o rename to tests/golden-files/input/Mcrt1.o diff --git a/golden-files/input/circle.bmp b/tests/golden-files/input/circle.bmp similarity index 100% rename from golden-files/input/circle.bmp rename to tests/golden-files/input/circle.bmp diff --git a/golden-files/input/circle.gif b/tests/golden-files/input/circle.gif similarity index 100% rename from golden-files/input/circle.gif rename to tests/golden-files/input/circle.gif diff --git a/golden-files/input/circle.jpg b/tests/golden-files/input/circle.jpg similarity index 100% rename from golden-files/input/circle.jpg rename to tests/golden-files/input/circle.jpg diff --git a/golden-files/input/circle.png b/tests/golden-files/input/circle.png similarity index 100% rename from golden-files/input/circle.png rename to tests/golden-files/input/circle.png diff --git a/golden-files/input/circle.ppm b/tests/golden-files/input/circle.ppm similarity index 100% rename from golden-files/input/circle.ppm rename to tests/golden-files/input/circle.ppm diff --git a/golden-files/input/circle.tga b/tests/golden-files/input/circle.tga similarity index 100% rename from golden-files/input/circle.tga rename to tests/golden-files/input/circle.tga diff --git a/golden-files/input/circle.tiff b/tests/golden-files/input/circle.tiff similarity index 100% rename from golden-files/input/circle.tiff rename to tests/golden-files/input/circle.tiff diff --git a/golden-files/input/clojure-util.java b/tests/golden-files/input/clojure-util.java similarity index 100% rename from golden-files/input/clojure-util.java rename to tests/golden-files/input/clojure-util.java diff --git a/golden-files/input/contents.pod b/tests/golden-files/input/contents.pod similarity index 100% rename from golden-files/input/contents.pod rename to tests/golden-files/input/contents.pod diff --git a/golden-files/input/hello.c b/tests/golden-files/input/hello.c similarity index 100% rename from golden-files/input/hello.c rename to tests/golden-files/input/hello.c diff --git a/golden-files/input/hello.cpp b/tests/golden-files/input/hello.cpp similarity index 100% rename from golden-files/input/hello.cpp rename to tests/golden-files/input/hello.cpp diff --git a/golden-files/input/hello.h b/tests/golden-files/input/hello.h similarity index 100% rename from golden-files/input/hello.h rename to tests/golden-files/input/hello.h diff --git a/golden-files/input/hi.html b/tests/golden-files/input/hi.html similarity index 100% rename from golden-files/input/hi.html rename to tests/golden-files/input/hi.html diff --git a/golden-files/input/hi.py b/tests/golden-files/input/hi.py similarity index 100% rename from golden-files/input/hi.py rename to tests/golden-files/input/hi.py diff --git a/golden-files/input/hi.tar.bz2 b/tests/golden-files/input/hi.tar.bz2 similarity index 100% rename from golden-files/input/hi.tar.bz2 rename to tests/golden-files/input/hi.tar.bz2 diff --git a/golden-files/input/hi.tar.gz b/tests/golden-files/input/hi.tar.gz similarity index 100% rename from golden-files/input/hi.tar.gz rename to tests/golden-files/input/hi.tar.gz diff --git a/golden-files/input/hi.tgz b/tests/golden-files/input/hi.tgz similarity index 100% rename from golden-files/input/hi.tgz rename to tests/golden-files/input/hi.tgz diff --git a/golden-files/input/hi.zip b/tests/golden-files/input/hi.zip similarity index 100% rename from golden-files/input/hi.zip rename to tests/golden-files/input/hi.zip diff --git a/golden-files/input/hi3.cpython-34.pyc b/tests/golden-files/input/hi3.cpython-34.pyc similarity index 100% rename from golden-files/input/hi3.cpython-34.pyc rename to tests/golden-files/input/hi3.cpython-34.pyc diff --git a/golden-files/input/hi3.py b/tests/golden-files/input/hi3.py similarity index 100% rename from golden-files/input/hi3.py rename to tests/golden-files/input/hi3.py diff --git a/golden-files/input/hi3_test.py b/tests/golden-files/input/hi3_test.py similarity index 100% rename from golden-files/input/hi3_test.py rename to tests/golden-files/input/hi3_test.py diff --git a/golden-files/input/hi_test.py b/tests/golden-files/input/hi_test.py similarity index 100% rename from golden-files/input/hi_test.py rename to tests/golden-files/input/hi_test.py diff --git a/golden-files/input/libieee.a b/tests/golden-files/input/libieee.a similarity index 100% rename from golden-files/input/libieee.a rename to tests/golden-files/input/libieee.a diff --git a/golden-files/input/libpcprofile.so b/tests/golden-files/input/libpcprofile.so similarity index 100% rename from golden-files/input/libpcprofile.so rename to tests/golden-files/input/libpcprofile.so diff --git a/golden-files/input/perl.pl b/tests/golden-files/input/perl.pl similarity index 100% rename from golden-files/input/perl.pl rename to tests/golden-files/input/perl.pl diff --git a/golden-files/input/perl6.p6 b/tests/golden-files/input/perl6.p6 similarity index 100% rename from golden-files/input/perl6.p6 rename to tests/golden-files/input/perl6.p6 diff --git a/golden-files/input/perl6.pl b/tests/golden-files/input/perl6.pl similarity index 100% rename from golden-files/input/perl6.pl rename to tests/golden-files/input/perl6.pl diff --git a/golden-files/input/root.php b/tests/golden-files/input/root.php similarity index 100% rename from golden-files/input/root.php rename to tests/golden-files/input/root.php diff --git a/golden-files/input/standard.pdf b/tests/golden-files/input/standard.pdf similarity index 100% rename from golden-files/input/standard.pdf rename to tests/golden-files/input/standard.pdf diff --git a/golden-files/input/test_foo.py b/tests/golden-files/input/test_foo.py similarity index 100% rename from golden-files/input/test_foo.py rename to tests/golden-files/input/test_foo.py diff --git a/golden-files/log-appearance b/tests/golden-files/log-appearance similarity index 100% rename from golden-files/log-appearance rename to tests/golden-files/log-appearance diff --git a/golden-files/log-initial b/tests/golden-files/log-initial similarity index 100% rename from golden-files/log-initial rename to tests/golden-files/log-initial diff --git a/golden-files/log-one-message b/tests/golden-files/log-one-message similarity index 100% rename from golden-files/log-one-message rename to tests/golden-files/log-one-message diff --git a/golden-files/log-two-messages b/tests/golden-files/log-two-messages similarity index 100% rename from golden-files/log-two-messages rename to tests/golden-files/log-two-messages diff --git a/golden-files/results/antic-closure-util_java b/tests/golden-files/results/antic-closure-util_java similarity index 100% rename from golden-files/results/antic-closure-util_java rename to tests/golden-files/results/antic-closure-util_java diff --git a/golden-files/results/bandit-hi3_py b/tests/golden-files/results/bandit-hi3_py similarity index 100% rename from golden-files/results/bandit-hi3_py rename to tests/golden-files/results/bandit-hi3_py diff --git a/golden-files/results/bandit-hi_py b/tests/golden-files/results/bandit-hi_py similarity index 100% rename from golden-files/results/bandit-hi_py rename to tests/golden-files/results/bandit-hi_py diff --git a/golden-files/results/bcpp-hello_cpp b/tests/golden-files/results/bcpp-hello_cpp similarity index 100% rename from golden-files/results/bcpp-hello_cpp rename to tests/golden-files/results/bcpp-hello_cpp diff --git a/golden-files/results/c_syntax_clang-hello_c b/tests/golden-files/results/c_syntax_clang-hello_c similarity index 100% rename from golden-files/results/c_syntax_clang-hello_c rename to tests/golden-files/results/c_syntax_clang-hello_c diff --git a/golden-files/results/c_syntax_gcc-hello_c b/tests/golden-files/results/c_syntax_gcc-hello_c similarity index 100% rename from golden-files/results/c_syntax_gcc-hello_c rename to tests/golden-files/results/c_syntax_gcc-hello_c diff --git a/golden-files/results/contents-hi3_py b/tests/golden-files/results/contents-hi3_py similarity index 100% rename from golden-files/results/contents-hi3_py rename to tests/golden-files/results/contents-hi3_py diff --git a/golden-files/results/cpp_syntax_clang-hello_cpp b/tests/golden-files/results/cpp_syntax_clang-hello_cpp similarity index 100% rename from golden-files/results/cpp_syntax_clang-hello_cpp rename to tests/golden-files/results/cpp_syntax_clang-hello_cpp diff --git a/golden-files/results/cpp_syntax_gcc-hello_cpp b/tests/golden-files/results/cpp_syntax_gcc-hello_cpp similarity index 100% rename from golden-files/results/cpp_syntax_gcc-hello_cpp rename to tests/golden-files/results/cpp_syntax_gcc-hello_cpp diff --git a/golden-files/results/disassemble_pyc-hi3_cpython-34_pyc b/tests/golden-files/results/disassemble_pyc-hi3_cpython-34_pyc similarity index 100% rename from golden-files/results/disassemble_pyc-hi3_cpython-34_pyc rename to tests/golden-files/results/disassemble_pyc-hi3_cpython-34_pyc diff --git a/golden-files/results/html2text-hi_html b/tests/golden-files/results/html2text-hi_html similarity index 100% rename from golden-files/results/html2text-hi_html rename to tests/golden-files/results/html2text-hi_html diff --git a/golden-files/results/html_syntax-hi_html b/tests/golden-files/results/html_syntax-hi_html similarity index 100% rename from golden-files/results/html_syntax-hi_html rename to tests/golden-files/results/html_syntax-hi_html diff --git a/golden-files/results/jlint-javaversion_class b/tests/golden-files/results/jlint-javaversion_class similarity index 100% rename from golden-files/results/jlint-javaversion_class rename to tests/golden-files/results/jlint-javaversion_class diff --git a/golden-files/results/metadata-hi3_py b/tests/golden-files/results/metadata-hi3_py similarity index 100% rename from golden-files/results/metadata-hi3_py rename to tests/golden-files/results/metadata-hi3_py diff --git a/golden-files/results/mypy-hi3_py b/tests/golden-files/results/mypy-hi3_py similarity index 100% rename from golden-files/results/mypy-hi3_py rename to tests/golden-files/results/mypy-hi3_py diff --git a/golden-files/results/mypy-hi_py b/tests/golden-files/results/mypy-hi_py similarity index 100% rename from golden-files/results/mypy-hi_py rename to tests/golden-files/results/mypy-hi_py diff --git a/golden-files/results/nm-libieee_a b/tests/golden-files/results/nm-libieee_a similarity index 100% rename from golden-files/results/nm-libieee_a rename to tests/golden-files/results/nm-libieee_a diff --git a/golden-files/results/nm-libpcprofile_so b/tests/golden-files/results/nm-libpcprofile_so similarity index 100% rename from golden-files/results/nm-libpcprofile_so rename to tests/golden-files/results/nm-libpcprofile_so diff --git a/golden-files/results/objdump_disassemble-Mcrt1_o b/tests/golden-files/results/objdump_disassemble-Mcrt1_o similarity index 100% rename from golden-files/results/objdump_disassemble-Mcrt1_o rename to tests/golden-files/results/objdump_disassemble-Mcrt1_o diff --git a/golden-files/results/objdump_headers-Mcrt1_o b/tests/golden-files/results/objdump_headers-Mcrt1_o similarity index 100% rename from golden-files/results/objdump_headers-Mcrt1_o rename to tests/golden-files/results/objdump_headers-Mcrt1_o diff --git a/golden-files/results/pdf2txt-standard_pdf b/tests/golden-files/results/pdf2txt-standard_pdf similarity index 100% rename from golden-files/results/pdf2txt-standard_pdf rename to tests/golden-files/results/pdf2txt-standard_pdf diff --git a/golden-files/results/perl6_syntax-perl6_p6 b/tests/golden-files/results/perl6_syntax-perl6_p6 similarity index 100% rename from golden-files/results/perl6_syntax-perl6_p6 rename to tests/golden-files/results/perl6_syntax-perl6_p6 diff --git a/golden-files/results/perl_syntax-perl6_pl b/tests/golden-files/results/perl_syntax-perl6_pl similarity index 100% rename from golden-files/results/perl_syntax-perl6_pl rename to tests/golden-files/results/perl_syntax-perl6_pl diff --git a/golden-files/results/perl_syntax-perl_pl b/tests/golden-files/results/perl_syntax-perl_pl similarity index 100% rename from golden-files/results/perl_syntax-perl_pl rename to tests/golden-files/results/perl_syntax-perl_pl diff --git a/golden-files/results/perldoc-contents_pod b/tests/golden-files/results/perldoc-contents_pod similarity index 100% rename from golden-files/results/perldoc-contents_pod rename to tests/golden-files/results/perldoc-contents_pod diff --git a/golden-files/results/perldoc-perl_pl b/tests/golden-files/results/perldoc-perl_pl similarity index 100% rename from golden-files/results/perldoc-perl_pl rename to tests/golden-files/results/perldoc-perl_pl diff --git a/golden-files/results/perltidy-perl_pl b/tests/golden-files/results/perltidy-perl_pl similarity index 100% rename from golden-files/results/perltidy-perl_pl rename to tests/golden-files/results/perltidy-perl_pl diff --git a/golden-files/results/php5_syntax-root_php b/tests/golden-files/results/php5_syntax-root_php similarity index 100% rename from golden-files/results/php5_syntax-root_php rename to tests/golden-files/results/php5_syntax-root_php diff --git a/golden-files/results/pil-circle_bmp b/tests/golden-files/results/pil-circle_bmp similarity index 100% rename from golden-files/results/pil-circle_bmp rename to tests/golden-files/results/pil-circle_bmp diff --git a/golden-files/results/pil-circle_gif b/tests/golden-files/results/pil-circle_gif similarity index 100% rename from golden-files/results/pil-circle_gif rename to tests/golden-files/results/pil-circle_gif diff --git a/golden-files/results/pil-circle_jpg b/tests/golden-files/results/pil-circle_jpg similarity index 100% rename from golden-files/results/pil-circle_jpg rename to tests/golden-files/results/pil-circle_jpg diff --git a/golden-files/results/pil-circle_png b/tests/golden-files/results/pil-circle_png similarity index 100% rename from golden-files/results/pil-circle_png rename to tests/golden-files/results/pil-circle_png diff --git a/golden-files/results/pil-circle_ppm b/tests/golden-files/results/pil-circle_ppm similarity index 100% rename from golden-files/results/pil-circle_ppm rename to tests/golden-files/results/pil-circle_ppm diff --git a/golden-files/results/pil-circle_tga b/tests/golden-files/results/pil-circle_tga similarity index 100% rename from golden-files/results/pil-circle_tga rename to tests/golden-files/results/pil-circle_tga diff --git a/golden-files/results/pil-circle_tiff b/tests/golden-files/results/pil-circle_tiff similarity index 100% rename from golden-files/results/pil-circle_tiff rename to tests/golden-files/results/pil-circle_tiff diff --git a/golden-files/results/pil_half-circle_png b/tests/golden-files/results/pil_half-circle_png similarity index 100% rename from golden-files/results/pil_half-circle_png rename to tests/golden-files/results/pil_half-circle_png diff --git a/golden-files/results/pycodestyle-hi3_py b/tests/golden-files/results/pycodestyle-hi3_py similarity index 100% rename from golden-files/results/pycodestyle-hi3_py rename to tests/golden-files/results/pycodestyle-hi3_py diff --git a/golden-files/results/pycodestyle-hi_py b/tests/golden-files/results/pycodestyle-hi_py similarity index 100% rename from golden-files/results/pycodestyle-hi_py rename to tests/golden-files/results/pycodestyle-hi_py diff --git a/golden-files/results/pydoc-hi3_py b/tests/golden-files/results/pydoc-hi3_py similarity index 100% rename from golden-files/results/pydoc-hi3_py rename to tests/golden-files/results/pydoc-hi3_py diff --git a/golden-files/results/pydoc-hi_py b/tests/golden-files/results/pydoc-hi_py similarity index 100% rename from golden-files/results/pydoc-hi_py rename to tests/golden-files/results/pydoc-hi_py diff --git a/golden-files/results/pyflakes-hi3_py b/tests/golden-files/results/pyflakes-hi3_py similarity index 100% rename from golden-files/results/pyflakes-hi3_py rename to tests/golden-files/results/pyflakes-hi3_py diff --git a/golden-files/results/pyflakes-hi_py b/tests/golden-files/results/pyflakes-hi_py similarity index 100% rename from golden-files/results/pyflakes-hi_py rename to tests/golden-files/results/pyflakes-hi_py diff --git a/golden-files/results/pylint-hi3_py b/tests/golden-files/results/pylint-hi3_py similarity index 100% rename from golden-files/results/pylint-hi3_py rename to tests/golden-files/results/pylint-hi3_py diff --git a/golden-files/results/pylint-hi_py b/tests/golden-files/results/pylint-hi_py similarity index 100% rename from golden-files/results/pylint-hi_py rename to tests/golden-files/results/pylint-hi_py diff --git a/golden-files/results/python_coverage-hi3_py b/tests/golden-files/results/python_coverage-hi3_py similarity index 100% rename from golden-files/results/python_coverage-hi3_py rename to tests/golden-files/results/python_coverage-hi3_py diff --git a/golden-files/results/python_coverage-hi_py b/tests/golden-files/results/python_coverage-hi_py similarity index 100% rename from golden-files/results/python_coverage-hi_py rename to tests/golden-files/results/python_coverage-hi_py diff --git a/golden-files/results/python_gut-hi3_py b/tests/golden-files/results/python_gut-hi3_py similarity index 100% rename from golden-files/results/python_gut-hi3_py rename to tests/golden-files/results/python_gut-hi3_py diff --git a/golden-files/results/python_gut-hi_py b/tests/golden-files/results/python_gut-hi_py similarity index 100% rename from golden-files/results/python_gut-hi_py rename to tests/golden-files/results/python_gut-hi_py diff --git a/golden-files/results/python_mccabe-hi3_py b/tests/golden-files/results/python_mccabe-hi3_py similarity index 100% rename from golden-files/results/python_mccabe-hi3_py rename to tests/golden-files/results/python_mccabe-hi3_py diff --git a/golden-files/results/python_mccabe-hi_py b/tests/golden-files/results/python_mccabe-hi_py similarity index 100% rename from golden-files/results/python_mccabe-hi_py rename to tests/golden-files/results/python_mccabe-hi_py diff --git a/golden-files/results/python_modulefinder-hi3_py b/tests/golden-files/results/python_modulefinder-hi3_py similarity index 100% rename from golden-files/results/python_modulefinder-hi3_py rename to tests/golden-files/results/python_modulefinder-hi3_py diff --git a/golden-files/results/python_modulefinder-hi_py b/tests/golden-files/results/python_modulefinder-hi_py similarity index 100% rename from golden-files/results/python_modulefinder-hi_py rename to tests/golden-files/results/python_modulefinder-hi_py diff --git a/golden-files/results/python_syntax-hi3_py b/tests/golden-files/results/python_syntax-hi3_py similarity index 100% rename from golden-files/results/python_syntax-hi3_py rename to tests/golden-files/results/python_syntax-hi3_py diff --git a/golden-files/results/python_syntax-hi_py b/tests/golden-files/results/python_syntax-hi_py similarity index 100% rename from golden-files/results/python_syntax-hi_py rename to tests/golden-files/results/python_syntax-hi_py diff --git a/golden-files/results/python_unittests-hi3_py b/tests/golden-files/results/python_unittests-hi3_py similarity index 100% rename from golden-files/results/python_unittests-hi3_py rename to tests/golden-files/results/python_unittests-hi3_py diff --git a/golden-files/results/python_unittests-hi3_test_py b/tests/golden-files/results/python_unittests-hi3_test_py similarity index 100% rename from golden-files/results/python_unittests-hi3_test_py rename to tests/golden-files/results/python_unittests-hi3_test_py diff --git a/golden-files/results/python_unittests-hi_py b/tests/golden-files/results/python_unittests-hi_py similarity index 100% rename from golden-files/results/python_unittests-hi_py rename to tests/golden-files/results/python_unittests-hi_py diff --git a/golden-files/results/python_unittests-test_foo_py b/tests/golden-files/results/python_unittests-test_foo_py similarity index 100% rename from golden-files/results/python_unittests-test_foo_py rename to tests/golden-files/results/python_unittests-test_foo_py diff --git a/golden-files/results/readelf-Mcrt1_o b/tests/golden-files/results/readelf-Mcrt1_o similarity index 100% rename from golden-files/results/readelf-Mcrt1_o rename to tests/golden-files/results/readelf-Mcrt1_o diff --git a/golden-files/results/splint-hello_c b/tests/golden-files/results/splint-hello_c similarity index 100% rename from golden-files/results/splint-hello_c rename to tests/golden-files/results/splint-hello_c diff --git a/golden-files/results/splint-hello_h b/tests/golden-files/results/splint-hello_h similarity index 100% rename from golden-files/results/splint-hello_h rename to tests/golden-files/results/splint-hello_h diff --git a/golden-files/results/tar_bz2-hi_tar_bz2 b/tests/golden-files/results/tar_bz2-hi_tar_bz2 similarity index 100% rename from golden-files/results/tar_bz2-hi_tar_bz2 rename to tests/golden-files/results/tar_bz2-hi_tar_bz2 diff --git a/golden-files/results/tar_gz-hi_tar_gz b/tests/golden-files/results/tar_gz-hi_tar_gz similarity index 100% rename from golden-files/results/tar_gz-hi_tar_gz rename to tests/golden-files/results/tar_gz-hi_tar_gz diff --git a/golden-files/results/tar_gz-hi_tgz b/tests/golden-files/results/tar_gz-hi_tgz similarity index 100% rename from golden-files/results/tar_gz-hi_tgz rename to tests/golden-files/results/tar_gz-hi_tgz diff --git a/golden-files/results/tidy-hi_html b/tests/golden-files/results/tidy-hi_html similarity index 100% rename from golden-files/results/tidy-hi_html rename to tests/golden-files/results/tidy-hi_html diff --git a/golden-files/results/uncrustify-closure-util_java b/tests/golden-files/results/uncrustify-closure-util_java similarity index 100% rename from golden-files/results/uncrustify-closure-util_java rename to tests/golden-files/results/uncrustify-closure-util_java diff --git a/golden-files/results/uncrustify-hello_c b/tests/golden-files/results/uncrustify-hello_c similarity index 100% rename from golden-files/results/uncrustify-hello_c rename to tests/golden-files/results/uncrustify-hello_c diff --git a/golden-files/results/uncrustify-hello_cpp b/tests/golden-files/results/uncrustify-hello_cpp similarity index 100% rename from golden-files/results/uncrustify-hello_cpp rename to tests/golden-files/results/uncrustify-hello_cpp diff --git a/golden-files/results/uncrustify-hello_h b/tests/golden-files/results/uncrustify-hello_h similarity index 100% rename from golden-files/results/uncrustify-hello_h rename to tests/golden-files/results/uncrustify-hello_h diff --git a/golden-files/results/unzip-hi_zip b/tests/golden-files/results/unzip-hi_zip similarity index 100% rename from golden-files/results/unzip-hi_zip rename to tests/golden-files/results/unzip-hi_zip diff --git a/golden-files/summary-initial b/tests/golden-files/summary-initial similarity index 100% rename from golden-files/summary-initial rename to tests/golden-files/summary-initial diff --git a/golden-files/summary-one-element b/tests/golden-files/summary-one-element similarity index 100% rename from golden-files/summary-one-element rename to tests/golden-files/summary-one-element diff --git a/golden-files/summary-two-element b/tests/golden-files/summary-two-element similarity index 100% rename from golden-files/summary-two-element rename to tests/golden-files/summary-two-element diff --git a/golden-files/window-orientation b/tests/golden-files/window-orientation similarity index 100% rename from golden-files/window-orientation rename to tests/golden-files/window-orientation diff --git a/gut_test.py b/tests/gut_test.py similarity index 99% rename from gut_test.py rename to tests/gut_test.py index 7d87804..82155f3 100755 --- a/gut_test.py +++ b/tests/gut_test.py @@ -6,7 +6,7 @@ import textwrap import unittest -import gut +import vigil.gut as gut class GutTestCase(unittest.TestCase): diff --git a/lscolors_test.py b/tests/lscolors_test.py similarity index 99% rename from lscolors_test.py rename to tests/lscolors_test.py index e806e15..d4bce42 100755 --- a/lscolors_test.py +++ b/tests/lscolors_test.py @@ -11,7 +11,7 @@ import subprocess import tempfile import unittest -import lscolors +import vigil.lscolors as lscolors class TempDirTestCase(unittest.TestCase): diff --git a/termstr_test.py b/tests/termstr_test.py similarity index 98% rename from termstr_test.py rename to tests/termstr_test.py index e1d7a9b..662e4f5 100755 --- a/termstr_test.py +++ b/tests/termstr_test.py @@ -9,8 +9,8 @@ import unittest os.environ["TERM"] = "xterm-256color" -from termstr import TermStr, CharStyle -import termstr +from vigil.termstr import TermStr, CharStyle +import vigil.termstr as termstr class CacheFirstResultTestCase(unittest.TestCase): diff --git a/tools_test.py b/tests/tools_test.py similarity index 99% rename from tools_test.py rename to tests/tools_test.py index 0832319..02f77d9 100755 --- a/tools_test.py +++ b/tests/tools_test.py @@ -11,9 +11,9 @@ import unittest.mock os.environ["TERM"] = "xterm-256color" -import fill3 -import golden -import tools +import vigil.fill3 as fill3 +import vigil.golden as golden +import vigil.tools as tools os.environ["TZ"] = "GMT" diff --git a/worker_test.py b/tests/worker_test.py similarity index 94% rename from worker_test.py rename to tests/worker_test.py index 8ec7638..3a3e9cd 100755 --- a/worker_test.py +++ b/tests/worker_test.py @@ -10,8 +10,8 @@ import shutil import tempfile import unittest -import tools -import worker +import vigil.tools as tools +import vigil.worker as worker class WorkerTestCase(unittest.TestCase): diff --git a/vigil.py b/vigil.py deleted file mode 120000 index 6d8824c..0000000 --- a/vigil.py +++ /dev/null @@ -1 +0,0 @@ -vigil \ No newline at end of file diff --git a/vigil b/vigil/__main__.py similarity index 99% rename from vigil rename to vigil/__main__.py index c8b613a..fefa692 100755 --- a/vigil +++ b/vigil/__main__.py @@ -34,11 +34,11 @@ import docopt import pygments.styles import pyinotify -import fill3 -import terminal -import termstr -import tools -import worker +from vigil import fill3 +from vigil import terminal +from vigil import termstr +from vigil import tools +from vigil import worker USAGE = """ @@ -1046,7 +1046,7 @@ def check_arguments(): return root_path, worker_count, editor_command, arguments["--theme"] -if __name__ == "__main__": +def entry_point(): root_path, worker_count, editor_command, theme = check_arguments() with terminal.console_title("vigil: " + os.path.basename(root_path)): manage_cache(root_path) @@ -1054,3 +1054,7 @@ if __name__ == "__main__": loop = asyncio.get_event_loop() main(root_path, loop, worker_count, editor_command, theme) os._exit(0) + + +if __name__ == "__main__": + entry_point() diff --git a/fill3.py b/vigil/fill3.py similarity index 99% rename from fill3.py rename to vigil/fill3.py index 374572e..a646921 100644 --- a/fill3.py +++ b/vigil/fill3.py @@ -15,8 +15,8 @@ import sys import urwid import urwid.raw_display -import terminal -import termstr +import vigil.terminal as terminal +import vigil.termstr as termstr def appearance_is_valid(appearance): diff --git a/golden.py b/vigil/golden.py similarity index 100% rename from golden.py rename to vigil/golden.py diff --git a/gut.py b/vigil/gut.py similarity index 100% rename from gut.py rename to vigil/gut.py diff --git a/lscolors.py b/vigil/lscolors.py similarity index 100% rename from lscolors.py rename to vigil/lscolors.py diff --git a/terminal.py b/vigil/terminal.py similarity index 100% rename from terminal.py rename to vigil/terminal.py diff --git a/termstr.py b/vigil/termstr.py similarity index 99% rename from termstr.py rename to vigil/termstr.py index b724300..572a445 100644 --- a/termstr.py +++ b/vigil/termstr.py @@ -9,7 +9,7 @@ import weakref import pygments.formatters.terminal256 -import terminal +import vigil.terminal as terminal def _cache_first_result(user_function): diff --git a/tools.py b/vigil/tools.py similarity index 99% rename from tools.py rename to vigil/tools.py index 6f954ee..9074af8 100644 --- a/tools.py +++ b/vigil/tools.py @@ -28,10 +28,10 @@ import pygments import pygments.lexers import pygments.styles -import fill3 -import gut -import lscolors -import termstr +import vigil.fill3 as fill3 +import vigil.gut as gut +import vigil.lscolors as lscolors +import vigil.termstr as termstr CACHE_PATH = ".vigil" diff --git a/urwid/__init__.py b/vigil/urwid/__init__.py similarity index 100% rename from urwid/__init__.py rename to vigil/urwid/__init__.py diff --git a/urwid/escape.py b/vigil/urwid/escape.py similarity index 100% rename from urwid/escape.py rename to vigil/urwid/escape.py diff --git a/urwid/raw_display.py b/vigil/urwid/raw_display.py similarity index 100% rename from urwid/raw_display.py rename to vigil/urwid/raw_display.py diff --git a/worker.py b/vigil/worker.py similarity index 97% rename from worker.py rename to vigil/worker.py index 3af2f16..6f5a1c2 100755 --- a/worker.py +++ b/vigil/worker.py @@ -7,7 +7,7 @@ import asyncio import os import signal -import tools +import vigil.tools as tools class Worker: @@ -22,7 +22,7 @@ class Worker: @asyncio.coroutine def create_process(self): create = asyncio.create_subprocess_exec( - *[__file__], stdin=asyncio.subprocess.PIPE, + "vigil-worker", stdin=asyncio.subprocess.PIPE, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE, preexec_fn=os.setsid) self.process = yield from create