OSDN Git Service

cleanup scripts
authorIvailo Monev <xakepa10@gmail.com>
Wed, 6 Jul 2016 12:48:12 +0000 (12:48 +0000)
committerIvailo Monev <xakepa10@gmail.com>
Wed, 6 Jul 2016 12:48:12 +0000 (12:48 +0000)
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
scripts/checkresources.sh [deleted file]
scripts/gendocs.py [new file with mode: 0755]
scripts/gendocs.sh [deleted file]
scripts/genman.py [new file with mode: 0755]
scripts/genman.sh [deleted file]
scripts/getresources.sh [deleted file]

diff --git a/scripts/checkresources.sh b/scripts/checkresources.sh
deleted file mode 100755 (executable)
index d56ce0b..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/bin/bash
-
-set -e
-
-modify="no"
-for i in $@;do
-    case "$i" in
-        --modify|-m) modify="yes"
-    esac
-done
-
-builddir="$(dirname "$0")/../build"
-autoinc="-I$(pwd)"
-for d in $(find $(pwd) $builddir/include $builddir/privateinclude -type d);do
-    autoinc+=" -I$d"
-done
-
-allfiles="$(find -iname '*.cpp' -printf '%P\n')"
-allfiles+=" $(find -iname '*.h' -printf '%P\n')"
-for i in $allfiles;do
-    if [ -n "$(moc -nw $i $autoinc)" ];then
-        found="no"
-        for f in $i ${i//_p_p.h/.cpp} ${i//_p.h/.cpp} ${i/.h/.cpp} ${i//.cpp/.h};do
-            # echo " >> Checking: $f"
-            if [ -e "$f" ];then
-                if grep -q "moc_$(basename $i)" $f ;then
-                    found="yes"
-                    break
-                fi
-            fi
-        done
-        norm="${i//_p_p.h/.cpp}"
-        norm="${norm//_p.h/.cpp}"
-        norm="${norm//.h/.cpp}"
-        if [ "$found" = "no" ] && [ "$modify" = "no" ];then
-            echo "moc_$(basename $i) in $norm"
-        elif [ "$found" = "no" ] && [ "$modify" = "yes" ];then
-            echo "#include \"moc_$(basename $i)\"" >> "$norm"
-        fi
-    fi
-done
diff --git a/scripts/gendocs.py b/scripts/gendocs.py
new file mode 100755 (executable)
index 0000000..7844265
--- /dev/null
@@ -0,0 +1,23 @@
+#!/usr/bin/python
+
+import sys, os, shutil, subprocess
+
+cwd = os.path.dirname(__file__)
+
+doxygen = None
+for path in os.environ.get('PATH', '/bin:/usr/bin').split(':'):
+    sfile = '%s/doxygen' % path
+    if os.access(sfile, os.X_OK):
+        doxygen = sfile
+        break
+
+if not doxygen:
+    sys.stderr.write('Doxygen is not installed\n')
+    sys.exit(1)
+
+sys.stdout.write('Generating API docs for Katie...\n')
+apidir = '%s/apidocs' % cwd
+if os.path.isdir(apidir):
+    shutil.rmtree(apidir)
+subprocess.check_call((doxygen, '%s/../doxygen.conf' % cwd))
+
diff --git a/scripts/gendocs.sh b/scripts/gendocs.sh
deleted file mode 100755 (executable)
index bf74cb7..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/bash
-
-set -e
-
-cwd="$(dirname $0)"
-
-if ! type -p doxygen;then
-    echo "Doxygen is not installed"
-    exit 1
-fi
-
-rm -rf apidocs/*
-echo "Generating API docs for Katie..."
-doxygen ${cwd}/../doxygen.conf
\ No newline at end of file
diff --git a/scripts/genman.py b/scripts/genman.py
new file mode 100755 (executable)
index 0000000..1670348
--- /dev/null
@@ -0,0 +1,32 @@
+#!/usr/bin/python
+
+import sys, os, subprocess
+
+cwd = os.path.dirname(__file__)
+
+pod2man = None
+for path in os.environ.get('PATH', '/bin:/usr/bin').split(':'):
+    sfile = '%s/pod2man' % path
+    if os.access(sfile, os.X_OK):
+        pod2man = sfile
+        break
+
+if not pod2man:
+    sys.stderr.write('Perl is not installed\n')
+    sys.exit(1)
+
+sys.stdout.write('Generating man pages for Katie...\n')
+for root, sdir, lfiles in os.walk('%s/../src/tools' % cwd):
+    for sfile in lfiles:
+        if sfile.endswith('.pod'):
+            ffile = '%s/%s' % (root, sfile)
+            ofile = ffile.replace('.pod', '.1')
+            subprocess.check_call(
+                (pod2man,
+                '--release=Katie 4.9.0',
+                '--center=Katie Manual',
+                '--section=1',
+                '--utf8',
+                ffile,
+                ofile)
+            )
diff --git a/scripts/genman.sh b/scripts/genman.sh
deleted file mode 100755 (executable)
index 788d7a7..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-
-set -e
-
-cwd="$(dirname $0)"
-
-if ! type -p pod2man;then
-    echo "Perl is not installed"
-    exit 1
-fi
-
-echo "Generating man pages for Katie..."
-for pfile in $(find $cwd/../src/tools -name '*.pod');do
-    ofile="${pfile//.pod/.1}"
-    pod2man --release="Katie 4.9.0" \
-            --center="Katie Manual" \
-            --section='1' --utf8 $pfile > $ofile
-done
\ No newline at end of file
diff --git a/scripts/getresources.sh b/scripts/getresources.sh
deleted file mode 100755 (executable)
index 91fad64..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/bash
-
-set -e
-
-builddir="$(dirname "$0")/../build"
-autoinc="-I$(pwd)"
-for d in $(find $(pwd) $builddir/include $builddir/privateinclude -type d);do
-    autoinc+=" -I$d"
-done
-
-allfiles="$(find -iname '*.cpp' -printf '%P\n')"
-allfiles+=" $(find -iname '*.h' -printf '%P\n')"
-for i in $allfiles;do
-    if [ -n "$(moc -nw $i $autoinc)" ];then
-        echo '    ${CMAKE_CURRENT_SOURCE_DIR}/'$i
-    fi
-done