From 6c4f4bddd064a5eea359659cbb9508a6e0acdb2c Mon Sep 17 00:00:00 2001
From: Martijn Vermaat <martijn@vermaat.name>
Date: Wed, 6 Apr 2011 08:47:17 +0000
Subject: [PATCH] Some reorganisation. Added post-install script.

git-svn-id: https://humgenprojects.lumc.nl/svn/mutalyzer/branches/refactor-mutalyzer-branch@252 eb6bd6ab-9ccd-42b9-aceb-e2899b4a52f1
---
 bin/{check.py => mutalyzer}                   | 11 +++----
 bin/run_tests                                 |  8 -----
 .../log-tools/find-crashes.py                 |  0
 extras/post-install.sh                        | 30 +++++++++++++++++++
 setup.py                                      |  2 +-
 5 files changed, 37 insertions(+), 14 deletions(-)
 rename bin/{check.py => mutalyzer} (97%)
 delete mode 100755 bin/run_tests
 rename bin/find_log_bugs => extras/log-tools/find-crashes.py (100%)
 create mode 100644 extras/post-install.sh

diff --git a/bin/check.py b/bin/mutalyzer
similarity index 97%
rename from bin/check.py
rename to bin/mutalyzer
index 0ffd2d00..c1af9032 100755
--- a/bin/check.py
+++ b/bin/mutalyzer
@@ -12,9 +12,10 @@ Usage:
 
 import sys
 import os
-import Mutalyzer
-from Modules import Output
-from Modules import Config
+
+import mutalyzer
+from mutalyzer.output import Output
+from mutalyzer.config import Config
 
 
 def main(cmd):
@@ -23,8 +24,8 @@ def main(cmd):
 
     @todo: documentation
     """
-    C = Config.Config()
-    O = Output.Output(__file__, C.Output)
+    C = Config()
+    O = Output(__file__, C.Output)
 
     O.addMessage(__file__, -1, "INFO", "Received variant " + cmd)
 
diff --git a/bin/run_tests b/bin/run_tests
deleted file mode 100755
index 33d4c486..00000000
--- a/bin/run_tests
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-
-# This is just an example of running the test suite and producing a HTML
-# coverage report.
-# Something like this should eventually be used on the test server as a
-# post-commit hook.
-
-nosetests --with-coverage --cover-package mutalyzer --cover-html --cover-html-dir=/tmp/nosecover -v
diff --git a/bin/find_log_bugs b/extras/log-tools/find-crashes.py
similarity index 100%
rename from bin/find_log_bugs
rename to extras/log-tools/find-crashes.py
diff --git a/extras/post-install.sh b/extras/post-install.sh
new file mode 100644
index 00000000..35ff4468
--- /dev/null
+++ b/extras/post-install.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+# Post-install script for Mutalyzer. Run after the setuptools installation
+# (python setup.py install).
+#
+# Usage (from the source root directory):
+#   sudo bash extras/post-install.sh
+
+# Todo:
+# - Database setup
+# - Copy doc to /usr/share/doc
+
+if [ ! -f /etc/mutalyzer/config ]; do
+    mkdir -p /etc/mutalyzer
+    cp extras/config.example /etc/mutalyzer/config
+    chmod -R u=rwX,go=rX /etc/mutalyzer
+fi
+
+touch /var/log/mutalyzer.log
+chown www-data:www-data /var/log/mutalyzer.log
+chmod u=rw,go=r /var/log/mutalyzer.log
+
+mkdir -p /var/cache/mutalyzer
+chown -R www-data:www-data /var/cache/mutalyzer
+chmod -R u=rwX,go=rX /var/cache/mutalyzer
+
+if [ ! -f /etc/init.d/mutalyzer-batchd ]; do
+    cp extras/init.d/mutalyzer-batchd /etc/init.d/mutalyzer-batchd
+    chmod u=rwx,go=rx /etc/init.d/mutalyzer-batchd
+fi
diff --git a/setup.py b/setup.py
index 4dcd083b..64219d5b 100644
--- a/setup.py
+++ b/setup.py
@@ -17,7 +17,7 @@ setup(
     platforms=['any'],
     packages=find_packages(exclude=['doc', 'extras', 'tests']),
     include_package_data=True,
-    scripts=['bin/mutalyzer-batchd'],
+    scripts=['bin/mutalyzer', 'bin/mutalyzer-batchd'],
     zip_safe=False
 )
 
-- 
GitLab