Ver código fonte

Some updates

84582af
Dirk Alders 3 anos atrás
pai
commit
c91c0a184a
5 arquivos alterados com 152 adições e 35 exclusões
  1. 0
    32
      amplifier
  2. 7
    0
      apt-extend-mint
  3. 89
    0
      eachsubdir
  4. 1
    1
      init_homepath
  5. 55
    2
      mkunittest

+ 0
- 32
amplifier Ver arquivo

@@ -1,32 +0,0 @@
1
-#!/usr/bin/env python2
2
-import subprocess
3
-import time
4
-from requests.exceptions import ConnectionError
5
-from kodijson import Kodi	# sudo pip install kodi-json
6
-
7
-def monitor_state():
8
-    mon_state = subprocess.check_output(['/usr/bin/tvservice',  '-s'])
9
-    return mon_state.split(' ')[1] in ['0xa', '0x12000a', '0x40002']
10
-
11
-
12
-def kodi_state():
13
-        try:
14
-            kodi = Kodi("http://tv:8080/jsonrpc")
15
-            ap = kodi.Player.GetActivePlayers()
16
-            return len(ap['result']) > 0
17
-        except ConnectionError:             # This is a dirty trick, if kodi is not yet ready to answer requests
18
-            return False
19
-
20
-
21
-prev_state = None
22
-while True:
23
-    # second count
24
-    curr_state = kodi_state()
25
-    # check if there is a change in the screen state
26
-    if curr_state != prev_state:
27
-        if curr_state is True:
28
-            subprocess.check_output(['sispmctl', '-o', '1'])
29
-        else:
30
-            subprocess.check_output(['sispmctl', '-f', '1'])
31
-    prev_state = curr_state
32
-    time.sleep(1.)

+ 7
- 0
apt-extend-mint Ver arquivo

@@ -6,21 +6,25 @@
6 6
 COMMON="
7 7
 joe git tmux
8 8
 keepass2 xdotool
9
+brasero
9 10
 sshfs curlftpfs openssh-server
10 11
 fonts-powerline powerline python3-powerline python3-powerline-gitstatus
11 12
 lib32stdc++6
12 13
 "
13 14
 
14 15
 MULTIMEDIA="
16
+ffmpeg
15 17
 kodi kodi-pvr-hts
16 18
 spotify-client
17 19
 "
18 20
 
19 21
 TOOLS="
20 22
 evolution
23
+gnuplot
21 24
 gnome-boxes
22 25
 gvncviewer
23 26
 texlive-binaries texlive-latex-extra texlive-lang-german texlive-fonts-recommended texstudio
27
+gimp
24 28
 "
25 29
 
26 30
 PROGRAMMING="
@@ -28,7 +32,10 @@ pycodestyle
28 32
 virtualenv
29 33
 python-coverage python3-coverage python-jinja2 python3-jinja2
30 34
 python-wxtools python3-wxgtk4.0
35
+python3-evdev python3-serial
36
+python3-sphinx python3-sphinx-rtd-theme
31 37
 meld
38
+retext
32 39
 "
33 40
 
34 41
 ALL=$COMMON\ $MULTIMEDIA\ $TOOLS\ $PROGRAMMING

+ 89
- 0
eachsubdir Ver arquivo

@@ -0,0 +1,89 @@
1
+#!/bin/bash
2
+#
3
+
4
+BASEDIR=`pwd`
5
+
6
+usage="Execute a command in each subdirectory:\n\nUsage: $0 [-p | print subdir info] \"command\""
7
+
8
+# More safety, by turning some bugs into errors.
9
+# Without `errexit` you don’t need ! and can replace
10
+# PIPESTATUS with a simple $?, but I don’t do that.
11
+set -o errexit -o pipefail -o noclobber -o nounset
12
+
13
+# -allow a command to fail with !’s side effect on errexit
14
+# -use return value from ${PIPESTATUS[0]}, because ! hosed $?
15
+! getopt --test > /dev/null 
16
+if [[ ${PIPESTATUS[0]} -ne 4 ]]; then
17
+    echo 'I’m sorry, `getopt --test` failed in this environment.'
18
+    exit 1
19
+fi
20
+
21
+OPTIONS=phe:
22
+LONGOPTS=print-subdir,help,exclude:
23
+
24
+# -regarding ! and PIPESTATUS see above
25
+# -temporarily store output to be able to check for errors
26
+# -activate quoting/enhanced mode (e.g. by writing out “--options”)
27
+# -pass arguments only via   -- "$@"   to separate them correctly
28
+! PARSED=$(getopt --options=$OPTIONS --longoptions=$LONGOPTS --name "$0" -- "$@")
29
+if [[ ${PIPESTATUS[0]} -ne 0 ]]; then
30
+    # e.g. return value is 1
31
+    #  then getopt has complained about wrong arguments to stdout
32
+    exit 2
33
+fi
34
+# read getopt’s output this way to handle the quoting right:
35
+eval set -- "$PARSED"
36
+
37
+p=n 
38
+exc=""
39
+# now enjoy the options in order and nicely split until we see --
40
+while true; do
41
+    case "$1" in
42
+        -p|--print-subdir)
43
+            p=y
44
+            shift
45
+            ;;
46
+        -h|--help)
47
+            echo -e "Execute a command in each subdirectory:\n\nUsage: $0 [-p(--print-subdir) -e(--exclude) dir1, dir2,...,dirn)] \"command\""
48
+            exit 0
49
+            shift
50
+            ;;
51
+        -e|--exclude)
52
+            exc="$2"
53
+            shift 2
54
+            ;;
55
+        --)
56
+            shift
57
+            break
58
+            ;;
59
+        *)
60
+            echo "Programming error"
61
+            exit 3
62
+            ;;
63
+    esac
64
+done
65
+
66
+# handle non-option arguments
67
+if [[ $# -ne 1 ]]; then
68
+    echo "$0: A single command is required."
69
+    exit 4
70
+fi
71
+
72
+
73
+
74
+for subdir in `find $BASEDIR -maxdepth 1 -type d`
75
+do
76
+    bn=`basename $subdir`
77
+	if [[ $subdir != $BASEDIR ]] && [[ ",$exc," != *",$bn,"* ]]; then
78
+        cd $subdir
79
+        if [[ $p = "y" ]]; then
80
+            echo -en "\n\n\033[1;33m╔"
81
+            for ((i=1;i<=$((${#bn} + 2));i++)); do echo -n "═"; done ; echo "╗"
82
+            echo "║ $bn ║"
83
+            echo -n "╚"
84
+            for ((i=1;i<=$((${#bn} + 2));i++)); do echo -n "═"; done ; echo "╝"
85
+            echo -e "\033[00m"
86
+        fi
87
+        eval $1
88
+	fi
89
+done

+ 1
- 1
init_homepath Ver arquivo

@@ -1,7 +1,7 @@
1 1
 #!/bin/sh
2 2
 #
3 3
 
4
-REPLACE_FOLDERS="Audio Bilder data Dokumente Downloads eclipse Musik prj Schreibtisch Videos"
4
+REPLACE_FOLDERS="Audio Bilder data Dokumente Downloads eclipse Musik prj Schreibtisch Videos choords"
5 5
 
6 6
 
7 7
 echo The following folders will be deleted:

+ 55
- 2
mkunittest Ver arquivo

@@ -134,15 +134,68 @@ def testrun(tcl):
134 134
     #
135 135
     tcl.testCase('description', TCEL_FULL, test_.func, *args, **kwargs)
136 136
 """ % name
137
+
138
+main_makefile = """MODULE_NAME := $(shell basename `pwd`)
139
+
140
+view_unittest:
141
+	xdg-open pylibs/$(MODULE_NAME)/_testresults_/unittest.pdf
142
+
143
+view_requirements:
144
+	xdg-open pylibs/$(MODULE_NAME)/_requirements_/specification.pdf
145
+
146
+view_docs:
147
+	xdg-open pylibs/$(MODULE_NAME)/_docs_/index.html
148
+
149
+clean:
150
+	make -kC docs clean; make -kC requirements cleanall; make -kC unittest clean
151
+"""
152
+
153
+docs_makefile = """# Minimal makefile for Sphinx documentation
154
+#
155
+
156
+# You can set these variables from the command line.
157
+SPHINXOPTS    =
158
+SPHINXBUILD   = sphinx-build
159
+SPHINXPRJ     = state_machine
160
+SOURCEDIR     = .
161
+BUILDDIR      = _build
162
+
163
+# Put it first so that "make" without argument is like "make help".
164
+help:
165
+	@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
166
+
167
+.PHONY: help Makefile
168
+
169
+# Catch-all target: route all unknown targets to Sphinx using the new
170
+# "make mode" option.  $(O) is meant as a shortcut for $(SPHINXOPTS).
171
+%: $(SPHINXPRJ)
172
+	@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
173
+
174
+$(SPHINXPRJ): Makefile
175
+	make -C $@/_examples_ all
176
+
177
+release: html
178
+	rm -rf $(SPHINXPRJ)/_docs_
179
+	mv $(BUILDDIR)/html $(SPHINXPRJ)/_docs_
180
+
181
+view_html: html
182
+	xdg-open $(BUILDDIR)/html/index.html
183
+"""
184
+
137 185
 with open('.gitignore', 'w') as fh:
138 186
     fh.write(gitignore)
187
+with open('Makefile', 'w') as fh:
188
+    fh.write(main_makefile)
139 189
 os.mkdir('docs')
190
+with open('docs/Makefile', 'w') as fh:
191
+    fh.write(docs_makefile)
140 192
 os.symlink('../pylibs/%s' % name, 'docs/%s' % name)
141 193
 os.mkdir('pylibs')
142 194
 os.mkdir('requirements')
195
+os.symlink('../pylibs/reqif/scripts/Makefile', 'requirements/Makefile')
196
+os.symlink('../pylibs/reqif', 'requirements/reqif')
143 197
 os.mkdir('unittest')
144
-os.symlink('../pylibs/unittest/scripts/unittest.sh', 'unittest/unittest.sh')
145
-os.symlink('../pylibs/unittest/scripts/unittest.py', 'unittest/unittest.py')
198
+os.symlink('../pylibs/unittest/scripts/Makefile', 'unittest/Makefile')
146 199
 os.mkdir('unittest/input_data')
147 200
 os.mkdir('unittest/output_data')
148 201
 os.mkdir('unittest/src')

Carregando…
Cancelar
Salvar