Skip to content

Commit

Permalink
Merge pull request #119 from motom001/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
motom001 committed Sep 24, 2015
2 parents 5a1d13a + b746497 commit d7b345a
Show file tree
Hide file tree
Showing 10 changed files with 111 additions and 20 deletions.
23 changes: 17 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
sudo: false
sudo: true
language: python
python:
- '2.7'

matrix:
include:
- python: 2.7
env: START_MODE=application
- python: 2.7
env: START_MODE=daemon

before_install:
- .travis/before_install.sh

install:
- python setup.py install
- sudo -H python setup.py install

script:
- doorpi_cli --test --trace
- .travis/script.sh

deploy:
provider: pypi
user:
Expand All @@ -14,4 +25,4 @@ deploy:
secure: dFEcLae9ppOvAKDqowjMBnLV8fhcbe2I+97vDds3CiCxJXlOVORk4S5hoc1YD/HMUNjrRXE1GvLmQju0K3uSfiQdn6JIJCknF2XV5IIRzSDSL4X5HEUDgZDzZMDwRIcAt14YRWDpapFDfhEM+1fdrXO2TbKmIM4Xmb4ErpMuwZuZyDJ4A2xsfpqiwpaMDm91t/CLkIbbwUifSLFXwl4ZvoMH0WPjqQSYdKXl0rx+ndvlDPq3zaE7ZJOfIzku4xuuXJ2OwwBAFgg4D1F+fGq9wrFe0t7BQqb4tYmTLJ/dJyKsHxUVUObWSFxxps43F8fasSmz9YhyTaTdOh4ArCQfXi28bCbZsu5NTio2UcCI24LcekKudxolslyMJ04AfHFDuCGEWYSGT5AJzBnDs6ElSh1uaxCk7OHo2aG3xl9odF3GG8fnc8cFAqesUQGObasY91cTALyNIcGvl2UdOyTpRr/ryHleQu2mnJtX6cPcYSjql5bzpgwH25B04aHeFCDiUoE/XX5diSv6U3YSmJDAxJS4lKs76u69GhwoaRYnPFpbqHYkYZ0YVYerZe4VqShUCE1I+1CH+VETZjIFK+v1/ZlbFHBELDSAFwMs1kJuuJPsrP7AxjqwY7mL3npVofq1i7kX6MXHCiRCeIexDwcwT5BOq4da8+7olGh3w41VRsw=
distributions: sdist bdist bdist_egg bdist_wheel
on:
branch: master
branch: master
10 changes: 10 additions & 0 deletions .travis/before_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

set -e # Exit immediately if a command exits with a non-zero status.
set -x # Print commands and their arguments as they are executed.

pip install --upgrade pip
pip --version
pip uninstall -y setuptools
sudo rm -f /usr/local/lib/python2.7/dist-packages/setuptools*.egg
pip install --upgrade setuptools
5 changes: 5 additions & 0 deletions .travis/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

set -e # Exit immediately if a command exits with a non-zero status.
set -x # Print commands and their arguments as they are executed.

7 changes: 7 additions & 0 deletions .travis/prepare.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

set -e # Exit immediately if a command exits with a non-zero status.
set -x # Print commands and their arguments as they are executed.

#pip install --upgrade pip
#pip install --upgrade setuptools
36 changes: 36 additions & 0 deletions .travis/script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

#set -e # Exit immediately if a command exits with a non-zero status.
set -x # Print commands and their arguments as they are executed.

START_MODE=daemon

if [[ $START_MODE = "application" ]]; then
sudo doorpi_cli --trace --test
fi

if [[ $START_MODE = "daemon" ]]; then
sudo service doorpi status
if [ $? -ne 3 ]; then
exit 1
fi
sudo service doorpi start
if [ $? -ne 0 ]; then
exit 1
fi
sleep 5
sudo service doorpi status
if [ $? -ne 0 ]; then
exit 1
fi
sudo service doorpi stop
if [ $? -ne 0 ]; then
exit 1
fi
sleep 5
sudo service doorpi status
if [ $? -ne 3 ]; then
exit 1
fi
exit 0
fi
7 changes: 5 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
DoorPi: VoIP Door-Intercomstation with Raspberry Pi
****************************************************

|travis_status_master| |code_climate_badge|
|travis_status_master| |code_climate_badge| |scrutinizer_status_master|

:DoorPi @ `PyPi`_:
|pypi_latest_version| |pypi_License|
Expand Down Expand Up @@ -207,10 +207,13 @@ But you should change the `BASE_PATH <https://github.com/motom001/DoorPi/blob/ma
.. |travis_status_master| image:: https://travis-ci.org/motom001/DoorPi.svg?branch=master
:target: https://travis-ci.org/motom001/DoorPi

.. |code_climate_badge| image:: https://codeclimate.com/github/motom001/DoorPi/badges/gpa.svg
.. |scrutinizer_status_master| image:: https://codeclimate.com/github/motom001/DoorPi/badges/gpa.svg
:target: https://codeclimate.com/github/motom001/DoorPi
:alt: Code Climate

.. |code_climate_badge| image:: https://scrutinizer-ci.com/g/motom001/DoorPi/badges/quality-score.png?b=master
:target: https://scrutinizer-ci.com/g/motom001/DoorPi/

.. |pypi_License| image:: https://img.shields.io/pypi/l/DoorPi.svg
:target: https://creativecommons.org/licenses/by-nc/4.0/
:alt: CC BY-NC 4.0
Expand Down
16 changes: 16 additions & 0 deletions doorpi/docs/service/doorpi.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ do_start_cmd()
$DAEMON start $DAEMON_ARGS || return 2
}

do_test_cmd()
{
status_of_proc "$DAEMON" "$NAME" > /dev/null && return 1
$DAEMON start $DAEMON_ARGS --test || return 2
}


do_stop_cmd()
{
status_of_proc "$DAEMON" "$NAME" > /dev/null || return 1
Expand All @@ -56,6 +63,14 @@ case "$1" in
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_test_cmd
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop_cmd
Expand All @@ -67,6 +82,7 @@ case "$1" in
restart)
[ "$VERBOSE" != no ] && log_daemon_msg "Restarting $DESC" "$NAME"
do_stop_cmd
sleep 5
do_start_cmd
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
Expand Down
2 changes: 1 addition & 1 deletion doorpi/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
package = 'DoorPi'
project = "VoIP Door-Intercomstation with Raspberry Pi"
project_no_spaces = project.replace(' ', '')
version = '2.4.1.2'
version = '2.4.1.3'
description = 'provide intercomstation to the doorstation by VoIP'
keywords = ['intercom', 'VoIP', 'doorstation', 'home automation', 'IoT']
authors = ['Thomas Meissner']
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
pip >= 7.1.2
setuptools >= 18.3.2
requests >= 2.7.0
RPi.GPIO >= 0.5.11
pifacedigitalio >= 3.0.5
Expand Down
23 changes: 12 additions & 11 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
base_path = os.path.dirname(os.path.abspath(__file__))
metadata = imp.load_source('metadata', os.path.join(base_path, 'doorpi', 'metadata.py'))


def read(filename, parse_file_content=False, new_filename=None):
with open(os.path.join(base_path, filename)) as f:
file_content = f.read()
Expand Down Expand Up @@ -36,8 +35,9 @@ def return_parsed_filename(old_filename, new_filename, make_it_executeable=True)
import pip
import setuptools
import wheel
except ImportError:
print("install missing pip now")
pip.main(['install', '--upgrade', 'pip', 'setuptools', 'wheel'])
except ImportError as exp:
print("install missing pip now (%s)" % exp)
from get_pip import main as check_for_pip
old_args = sys.argv
sys.argv = [sys.argv[0]]
Expand Down Expand Up @@ -112,16 +112,17 @@ def return_parsed_filename(old_filename, new_filename, make_it_executeable=True)
# 'gui_scripts': [
# 'doorpi_gui = doorpi.gui:entry_point'
# ]
},
data_files=[
(
os.path.join(metadata.doorpi_path, 'docs', 'daemon'), [
}

)
if os.name == 'posix' and os.geteuid() == 0:
setup_dict.update(dict(
data_files=[(
metadata.daemon_folder, [
return_parsed_filename(metadata.daemon_name_template, metadata.daemon_name_template_parsed)
]
)
]
)

)]
))

def main():
setup(**setup_dict)
Expand Down

0 comments on commit d7b345a

Please sign in to comment.