Made vigil into a package with a setup.py file.

This commit is contained in:
Andrew Hamilton 2017-06-27 14:03:32 +01:00
parent 49f8d87659
commit 5728e5cff3
135 changed files with 76 additions and 50 deletions

View file

@ -5,12 +5,12 @@
import subprocess 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() 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: if "/" in dependency:
pip_version, pip_dependency = dependency.split("/") pip_version, pip_dependency = dependency.split("/")
(pip_deps if pip_version == "pip" else pip3_deps).add(pip_dependency) (pip_deps if pip_version == "pip" else pip3_deps).add(pip_dependency)

View file

@ -5,7 +5,7 @@
# Licensed under the Artistic License 2.0. # Licensed under the Artistic License 2.0.
import tools import vigil.tools as tools
def tool_markup(tool): def tool_markup(tool):

23
setup.py Executable file
View file

@ -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"]})

View file

@ -5,10 +5,10 @@
FAILURE=0 FAILURE=0
CODEBASE_PATH=$(dirname $0) CODEBASE_PATH=$(realpath $(dirname $0))
for test in ${CODEBASE_PATH}/*_test.py; do for test in ${CODEBASE_PATH}/tests/*_test.py; do
echo "Testing $test ..." echo "Testing $test ..."
${test} 2>&1 python3 -m unittest ${test} 2>&1
FAILURE=$(($FAILURE | $?)) FAILURE=$(($FAILURE | $?))
echo echo
done done

View file

@ -13,9 +13,9 @@ import unittest
os.environ["TERM"] = "xterm-256color" os.environ["TERM"] = "xterm-256color"
import fill3 import vigil.fill3 as fill3
import golden import vigil.golden as golden
import vigil import vigil.__main__ as __main__
_DIMENSIONS = (100, 60) _DIMENSIONS = (100, 60)
@ -51,10 +51,10 @@ class ScreenWidgetTestCase(unittest.TestCase):
_touch(foo_path) _touch(foo_path)
jobs_added_event = asyncio.Event() jobs_added_event = asyncio.Event()
appearance_changed_event = asyncio.Event() appearance_changed_event = asyncio.Event()
summary = vigil.Summary(self.temp_dir, jobs_added_event) summary = __main__.Summary(self.temp_dir, jobs_added_event)
log = vigil.Log(appearance_changed_event) log = __main__.Log(appearance_changed_event)
self.main_widget = vigil.Screen(summary, log, appearance_changed_event, self.main_widget = __main__.Screen(summary, log, appearance_changed_event,
_MockMainLoop()) _MockMainLoop())
def tearDown(self): def tearDown(self):
shutil.rmtree(self.temp_dir) shutil.rmtree(self.temp_dir)
@ -85,13 +85,13 @@ class ScreenWidgetTestCase(unittest.TestCase):
class SummaryCursorTest(unittest.TestCase): class SummaryCursorTest(unittest.TestCase):
def setUp(self): def setUp(self):
self.original_method = vigil.Summary.sync_with_filesystem self.original_method = __main__.Summary.sync_with_filesystem
vigil.Summary.sync_with_filesystem = lambda foo: None __main__.Summary.sync_with_filesystem = lambda foo: None
self.summary = vigil.Summary(None, None) self.summary = __main__.Summary(None, None)
self.summary._column = [[1, 1, 1], [1, 1], [1, 1, 1]] self.summary._column = [[1, 1, 1], [1, 1], [1, 1, 1]]
def tearDown(self): def tearDown(self):
vigil.Summary.sync_with_filesystem = self.original_method __main__.Summary.sync_with_filesystem = self.original_method
def _assert_movements(self, movements): def _assert_movements(self, movements):
for movement, expected_position in movements: for movement, expected_position in movements:
@ -128,7 +128,7 @@ class SummarySyncWithFilesystem(unittest.TestCase):
_touch(self.bar_path) _touch(self.bar_path)
self.jobs_added_event = asyncio.Event() self.jobs_added_event = asyncio.Event()
self.appearance_changed_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() self.jobs_added_event.clear()
def tearDown(self): def tearDown(self):
@ -190,7 +190,7 @@ class SummarySyncWithFilesystem(unittest.TestCase):
# def test_log(self): # def test_log(self):
# appearance_changed_event = asyncio.Event() # 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) # _assert_widget_appearance(log, "golden-files/log-initial", None)
# timestamp = "11:11:11" # timestamp = "11:11:11"
# self.assertFalse(appearance_changed_event.is_set()) # self.assertFalse(appearance_changed_event.is_set())
@ -219,11 +219,11 @@ class MainTestCase(unittest.TestCase):
# tmp_total = _tmp_total() # tmp_total = _tmp_total()
foo_path = os.path.join(root_path, "foo") foo_path = os.path.join(root_path, "foo")
open(foo_path, "w").close() open(foo_path, "w").close()
vigil.manage_cache(root_path) __main__.manage_cache(root_path)
with vigil.chdir(root_path): with __main__.chdir(root_path):
with contextlib.redirect_stdout(io.StringIO()): with contextlib.redirect_stdout(io.StringIO()):
vigil.main(root_path, loop, worker_count=2, __main__.main(root_path, loop, worker_count=2,
is_being_tested=True) is_being_tested=True)
for file_name in ["summary.pickle", "creation_time", "log", for file_name in ["summary.pickle", "creation_time", "log",
"foo-metadata", "foo-contents"]: "foo-metadata", "foo-contents"]:
self.assertTrue(os.path.exists(".vigil/" + file_name)) self.assertTrue(os.path.exists(".vigil/" + file_name))

View file

@ -6,7 +6,7 @@
import unittest import unittest
import fill3 import vigil.fill3 as fill3
class WidgetTests(unittest.TestCase): class WidgetTests(unittest.TestCase):

View file

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 108 B

After

Width:  |  Height:  |  Size: 108 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 381 B

After

Width:  |  Height:  |  Size: 381 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 320 B

After

Width:  |  Height:  |  Size: 320 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 1 KiB

Before After
Before After

Some files were not shown because too many files have changed in this diff Show more