Skip to content

Commit

Permalink
Fixes and prep for prerelease
Browse files Browse the repository at this point in the history
  • Loading branch information
deckerego committed Jan 24, 2017
1 parent d72517c commit e0832a4
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 28 deletions.
28 changes: 17 additions & 11 deletions BUILDING
Original file line number Diff line number Diff line change
@@ -1,23 +1,13 @@
Building Binary Distributions
=============================

stdeb generates the debian/ folder automatically & this is version controlled.
However, if it needs regeneration one can save python-hackclock.postinst to a
separate directory, delete the debian/ directory, then re-issue:

python ./setup.py --command-packages=stdeb.command debianize

To build the Debian package python-hackclock, first copy over the files to your Raspberry Pi:

rsync --exclude=.git --exclude=**/*.pyc --delete -ave ssh . pi@raspberrypi:/home/pi/build/hack-clock/

Distributions are generated using stdeb, execute it on the Raspberry Pi to build for the correct architecture:

./package.sh

To debug installation:

sudo dpkg -D113 -i deb_dist/python-hackclock_2.0-beta-1_all.deb
sudo dpkg -D113 -i ../python-hackclock_2.0-beta-1_all.deb

To completely uninstall:

Expand All @@ -28,6 +18,16 @@ To verify the files inside the package:
dpkg -c deb_dist/python-hackclock_2.0-beta-1_all.deb


Generating Debian Metadata
==========================

stdeb generates the debian/ folder automatically & this is version controlled.
However, if it needs regeneration one can save python-hackclock.postinst to a
separate directory, delete the debian/ directory, then re-issue:

python ./setup.py --command-packages=stdeb.command debianize


Running Locally
===============

Expand All @@ -36,3 +36,9 @@ To test locally:
export PYTHONPATH="$PYTHONPATH:$HOME/Projects/hack-clock/lib"
cd srv/hackclock
../../scripts/run_server.py --config "$HOME/Projects/hack-clock/tests/localsettings.conf"


Software License
================

Review the file LICENSE for details of this software's license and distribution terms.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ I'm assuming that you are starting with the Raspian Minimal Linux distribution.
1. Make sure your Raspberry Pi is up to date with the latest packages & firmware with `sudo apt-get update; sudo apt-get dist-upgrade`
2. Enable I2C by executing `sudo raspi-config` as described in Adafruit's tutorial: https://learn.adafruit.com/adafruits-raspberry-pi-lesson-4-gpio-setup/configuring-i2c
3. Add the necessary Python and GStreamer dependencies using `sudo apt-get install wiringpi python-bottle python-setuptools python-pip python-dev python-dateutil python-smbus gstreamer0.10-x gstreamer-tools gstreamer0.10-plugins-base gstreamer0.10-plugins-good gstreamer0.10-plugins-bad python-gst0.10`
4. Install hack-clock via `wget https://github.com/deckerego/hack-clock/releases/download/2.0-BETA/python-hackclock_2.0-beta-1_all.deb; sudo dpkg -i python-hackclock_2.0-beta-1_all.deb`
4. Install hack-clock via `wget https://github.com/deckerego/hack-clock/releases/download/2.0-BETA/python-hackclock_2.0-pre-1_all.deb; sudo dpkg -i python-hackclock_2.0-pre-1_all.deb`
5. Tweak `/etc/hack-clock.conf` and `/etc/default/hack-clock` to fit your needs (GPIO pins, correct weather station, etc.)
6. Reboot your Pi to re-load modules and start the IDE web server
6. Reboot your Pi to re-load modules and start the IDE web server


Usage
Expand Down
11 changes: 8 additions & 3 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
hackclock (2.0-beta-1) unstable; urgency=low
hackclock (2.0-pre-1) unstable; urgency=low

* source package automatically created by stdeb 0.8.5
* I2C audio
* Raspberry Pi Zero support
* Programming by blocks (using Blockly)
* Multiple simultaneous buttons (input pins)
* Support for switches (output pins)
* Debian packaging for ease of installation

-- DeckerEgo <[email protected]> Fri, 13 Jan 2017 13:16:04 -0500
-- DeckerEgo <[email protected]> Tue, 24 Jan 2017 22:00:00 -0500
2 changes: 1 addition & 1 deletion debian/python-hackclock.postinst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ chown -R pi:pi /home/pi/hack-clock

# Install those Python modules that only exist via pip
echo "Installing missing Python modules..."
pip install -r /usr/share/doc/hack-clock/requirements.txt
pip install --upgrade -r /usr/share/doc/hack-clock/requirements.txt

# Set the hifiberry-dac i2s module
echo "Installing I2S audio..."
Expand Down
2 changes: 1 addition & 1 deletion home/pi/hack-clock/lessons/3/blocks_clock.xml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<xml xmlns="http://www.w3.org/1999/xhtml"><block type="procedures_defnoreturn" id="haE`,9R6yF*2K+Okd.+j" x="83" y="59"><field name="NAME">showCurrentTime</field><comment pinned="false" h="80" w="160">Update the clock's display</comment><statement name="STACK"><block type="variables_set" id="}Dz6I=PjG2N:^g^0owfN"><field name="VAR">Is Evening</field><value name="VALUE"><block type="logic_compare" id="ht;`yjLCPO/3^4Hhqz/8"><field name="OP">GTE</field><value name="A"><block type="current_hour" id="hm.{lsgt7|*blap{/:T:"></block></value><value name="B"><block type="math_number" id="nxZLCW-^I[?4Y@a7O+bU"><field name="NUM">12</field></block></value></block></value><next><block type="variables_set" id="A59OsOkBG8nWL0Hoa4+R"><field name="VAR">Proper Hour</field><value name="VALUE"><block type="logic_ternary" id="3j2;.M#rY?5(3]+88]]P"><value name="IF"><block type="variables_get" id="k99|i~X+On)JhX[kAxBo"><field name="VAR">Is Evening</field></block></value><value name="THEN"><block type="math_arithmetic" id="nh=thLn1p%G;r*2mJ+|P"><field name="OP">MINUS</field><value name="A"><block type="current_hour" id="pK[g:j@I2|Vfi:Qr.;tb"></block></value><value name="B"><block type="math_number" id="Uy6?!]RwqKp:H23-hYAB"><field name="NUM">12</field></block></value></block></value><value name="ELSE"><block type="current_hour" id="KUb{_H$mm;Cd+`V[ec2s"></block></value></block></value><next><block type="set_display_hours" id="k/.!e2@D+,o(!=ha+dAe"><value name="display"><block type="led_display" id="0wa1:ywQw~[Ig~z7}O`:"></block></value><value name="hours"><block type="variables_get" id="dbm?rd(8fjS+[SLP#jQ9"><field name="VAR">Proper Hour</field></block></value><next><block type="set_colon" id="IYJzTRiTKUri2EJ{u8+5"><value name="display"><block type="led_display" id="8x~2|Vi,@C*Nrut^U/uc"></block></value><value name="enabled"><block type="variables_get" id="PoFtwEB6h$Lu#3-RR|Q0"><field name="VAR">Is Evening</field></block></value><next><block type="set_display_minutes" id="ajX],6mf/mK^cha_g.-?"><value name="display"><block type="led_display" id="Lw/m]zgCxQw5l4s66ij^"></block></value><value name="minutes"><block type="current_minute" id="C^OJ/4KnvL~$cceC^.2."></block></value></block></next></block></next></block></next></block></next></block></statement></block><block type="clock_tick" id="@s7-@nkTU+,G|3#Jc{#b" x="580" y="53"><value name="clock"><block type="clock" id="o]`*!LS-=;3kj5hWi.;n"></block></value><statement name="on_tick_function"><block type="procedures_callnoreturn" id="}ihd7(H0;35n`2kzzeIl"><mutation name="showCurrentTime"></mutation></block></statement><next><block type="set_display_brightness" id="T`1#w_b8g,fzvtO2c:Mq"><field name="brightness">11</field><value name="display"><block type="led_display" id="8E`0%R=sQr/r3?_*~n%T"></block></value></block></next></block></xml>
<xml xmlns="http://www.w3.org/1999/xhtml"><block type="procedures_defnoreturn" id="haE`,9R6yF*2K+Okd.+j" x="83" y="59"><field name="NAME">showCurrentTime</field><comment pinned="false" h="80" w="160">Update the clock's display</comment><statement name="STACK"><block type="variables_set" id="}Dz6I=PjG2N:^g^0owfN"><field name="VAR">Is Evening</field><value name="VALUE"><block type="logic_compare" id="ht;`yjLCPO/3^4Hhqz/8"><field name="OP">GTE</field><value name="A"><block type="current_hour" id="hm.{lsgt7|*blap{/:T:"></block></value><value name="B"><block type="math_number" id="nxZLCW-^I[?4Y@a7O+bU"><field name="NUM">12</field></block></value></block></value><next><block type="variables_set" id="A59OsOkBG8nWL0Hoa4+R"><field name="VAR">Proper Hour</field><value name="VALUE"><block type="logic_ternary" id="3j2;.M#rY?5(3]+88]]P"><value name="IF"><block type="variables_get" id="k99|i~X+On)JhX[kAxBo"><field name="VAR">Is Evening</field></block></value><value name="THEN"><block type="math_arithmetic" id="nh=thLn1p%G;r*2mJ+|P"><field name="OP">MINUS</field><value name="A"><block type="current_hour" id="pK[g:j@I2|Vfi:Qr.;tb"></block></value><value name="B"><block type="math_number" id="Uy6?!]RwqKp:H23-hYAB"><field name="NUM">12</field></block></value></block></value><value name="ELSE"><block type="current_hour" id="KUb{_H$mm;Cd+`V[ec2s"></block></value></block></value><next><block type="set_display_hours" id="k/.!e2@D+,o(!=ha+dAe"><value name="display"><block type="led_display" id="0wa1:ywQw~[Ig~z7}O`:"></block></value><value name="hours"><block type="variables_get" id="dbm?rd(8fjS+[SLP#jQ9"><field name="VAR">Proper Hour</field></block></value><next><block type="set_display_minutes" id="ajX],6mf/mK^cha_g.-?"><value name="display"><block type="led_display" id="Lw/m]zgCxQw5l4s66ij^"></block></value><value name="minutes"><block type="current_minute" id="C^OJ/4KnvL~$cceC^.2."></block></value><next><block type="set_colon" id="IYJzTRiTKUri2EJ{u8+5"><value name="display"><block type="led_display" id="8x~2|Vi,@C*Nrut^U/uc"></block></value><value name="enabled"><block type="logic_boolean" id="h_p3YrZs9Em2kNFQV]3Z"><field name="BOOL">TRUE</field></block></value><next><block type="is_evening" id="^ZN%$mR(*?OtQRScEOs+"><value name="display"><block type="led_display" id="-+H=*wrk-?V%efBy{igT"></block></value><value name="enabled"><block type="variables_get" id="PoFtwEB6h$Lu#3-RR|Q0"><field name="VAR">Is Evening</field></block></value></block></next></block></next></block></next></block></next></block></next></block></statement></block><block type="clock_tick" id="@s7-@nkTU+,G|3#Jc{#b" x="580" y="53"><value name="clock"><block type="clock" id="o]`*!LS-=;3kj5hWi.;n"></block></value><statement name="on_tick_function"><block type="procedures_callnoreturn" id="}ihd7(H0;35n`2kzzeIl"><mutation name="showCurrentTime"></mutation></block></statement><next><block type="set_display_brightness" id="T`1#w_b8g,fzvtO2c:Mq"><field name="brightness">11</field><value name="display"><block type="led_display" id="8E`0%R=sQr/r3?_*~n%T"></block></value></block></next></block></xml>
14 changes: 7 additions & 7 deletions lib/hackclock/webapp/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,18 +304,18 @@ def audio_upload():
uploaded.save(audio_dir)
redirect("/audio")

def audio_files():
audio_dir = configuration.get('audio_files')
filename_filter = configuration.get('file_filter')
return filter(lambda e: e not in filename_filter, listdir(audio_dir))

@application.get('/audio')
def audio_view():
audio_dir = configuration.get('audio_files')
files = listdir(audio_dir)
return template('audio', files=files)
return template('audio', files=audio_files())

@application.get('/audio/list')
def audio_list():
audio_dir = configuration.get('audio_files')
filename_filter = configuration.get('file_filter')
dir_list = filter(lambda e: e not in filename_filter, listdir(audio_dir))
return json.dumps(dir_list)
return json.dumps(audio_files())

# GPIO pin list
@application.get('/gpio/button/list')
Expand Down
2 changes: 1 addition & 1 deletion package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

cd ..
echo "Compressing file..."
tar Jcf hackclock_2.0-beta.orig.tar.xz hack-clock/
tar Jcf hackclock_2.0-pre.orig.tar.xz hack-clock/

cd hack-clock
dpkg-buildpackage -rfakeroot -uc -us
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
bitstring>=3.1.3
wiringpi2>=1.0.10
wiringpi2>=2.23.1
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def all_files(newroot, oldroot):

setup(
name='HackClock',
version='2.0-BETA',
version='2.0-PRE',
description='A hackable alarm clock for the Raspberry Pi',
author='DeckerEgo',
author_email='[email protected]',
Expand Down

0 comments on commit e0832a4

Please sign in to comment.