From 880486c92dd6ee0fe4c80c8a8dfc1ef79206744c Mon Sep 17 00:00:00 2001 From: Joshua Rodriguez Date: Wed, 7 Sep 2016 14:48:33 -0700 Subject: [PATCH 1/4] Use setuptools to install smartmirror This will install all the needed pip packages and the software packages. Also allows for versions to trigger updates if ran with tools like Ansible, Puppet, ect. --- README.md | 9 +++++++++ requirements.txt | 3 --- setup.py | 25 +++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 3 deletions(-) delete mode 100644 requirements.txt create mode 100644 setup.py diff --git a/README.md b/README.md index 14251540..34e1f0eb 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,13 @@ # Smart-Mirror Raspberry powered mirror which can display the news, weather, and time. +## Installation and Updating +Installation is simple as running the following command. + +> sudo pip install git+https://github.com/HackerHouseYT/Smart-Mirror.git + +## Running +To run the application run the following command +> python -m smartmirror + [![Link to youtube how-to video](http://i.imgur.com/cMyaSHT.png)](https://youtu.be/fkVBAcvbrjU) diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index f8f2fef5..00000000 --- a/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -requests -feedparser -Pillow diff --git a/setup.py b/setup.py new file mode 100644 index 00000000..96159919 --- /dev/null +++ b/setup.py @@ -0,0 +1,25 @@ +#!/usr/bin/python + +import os +import sys +from setuptools import setup, find_packages + +# Must be ran as root or as sudo +if os.getuid() != 0: + print('ERROR: Need to run as root') + sys.exit(1) + +# Install the requirements if the system does not have it installed +print('INFO: Checking and installing requirements') +os.system('! dpkg -S python-imaging-tk && apt-get -y install python-imaging-tk') + +# Run setuptools for pip +setup( + name='smartmirror', + version='1.0.0', + description='Raspberry powered mirror which can display news, weather, calendar events', + author='HackerHouse', + url='https://github.com/HackerHouseYT/Smart-Mirror', + install_requires=['requests', 'feedparser', 'Pillow'], + packages = find_packages(), +) From f1d542d9d1738dcde2d4c30295eb50d21ad028fa Mon Sep 17 00:00:00 2001 From: Joshua Rodriguez Date: Wed, 7 Sep 2016 14:51:07 -0700 Subject: [PATCH 2/4] Add header for image to describe it --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 34e1f0eb..b5cdae8a 100644 --- a/README.md +++ b/README.md @@ -10,4 +10,5 @@ Installation is simple as running the following command. To run the application run the following command > python -m smartmirror +## Demo and Build Instructions [![Link to youtube how-to video](http://i.imgur.com/cMyaSHT.png)](https://youtu.be/fkVBAcvbrjU) From 88eca9a6fa1c005bb45b937744631f6e7dc61f45 Mon Sep 17 00:00:00 2001 From: Joshua Rodriguez Date: Wed, 7 Sep 2016 15:01:41 -0700 Subject: [PATCH 3/4] State the command should be ran in the folder --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b5cdae8a..e521b445 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,8 @@ Installation is simple as running the following command. > sudo pip install git+https://github.com/HackerHouseYT/Smart-Mirror.git ## Running -To run the application run the following command -> python -m smartmirror +To run the application run the following command in this folder +> python smartmirror.py ## Demo and Build Instructions [![Link to youtube how-to video](http://i.imgur.com/cMyaSHT.png)](https://youtu.be/fkVBAcvbrjU) From 59508765f9e334c21aacf198bc7a7c6688f894b2 Mon Sep 17 00:00:00 2001 From: Joshua Rodriguez Date: Thu, 8 Sep 2016 08:48:05 -0700 Subject: [PATCH 4/4] Generate the requirements from the file --- requirements.txt | 3 +++ setup.py | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..f8f2fef5 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +requests +feedparser +Pillow diff --git a/setup.py b/setup.py index 96159919..89937fb2 100644 --- a/setup.py +++ b/setup.py @@ -13,6 +13,13 @@ print('INFO: Checking and installing requirements') os.system('! dpkg -S python-imaging-tk && apt-get -y install python-imaging-tk') +# Generate the requirements from the file for old instructions +print('INFO: Generating the requirements from requirements.txt') +packages = [] +for line in open('requirements.txt', 'r'): + if not line.startswith('#'): + packages.append(line.strip()) + # Run setuptools for pip setup( name='smartmirror', @@ -20,6 +27,6 @@ description='Raspberry powered mirror which can display news, weather, calendar events', author='HackerHouse', url='https://github.com/HackerHouseYT/Smart-Mirror', - install_requires=['requests', 'feedparser', 'Pillow'], - packages = find_packages(), + install_requires=packages, + packages=find_packages(), )