-
Notifications
You must be signed in to change notification settings - Fork 31
Description
By trial and error (lots of both 🤯) I have now managed to assemble a complete guide for running the timebox CLI on macOS in a virtual enviroment with Python 2.7.
For this guide, I'll just assume that you clone this repository or extract its zip to ~/timebox (/Users/yourusername/timebox). Here we go:
First, check that pip is up to date:
python -m pip install --user --upgrade pip- Install virtualenv. As far as I know, all Macs ship with easy_install, so
sudo easy_install virtualenv
- From your home dir:
git clone https://github.com/ScR4tCh/timebox.git or extract the zip and copy/move its contents to ~/timebox
cd ~/timebox
- Create the virtual enviroment and activate it:
virtualenv ~/timebox // or simply "virtualenv timebox"
source bin/activate- Install (some of) the dependencies
sudo -H pip install -r requirements.txt
cd ~/timebox (cd ..)Now for the tedious part.
- You'll need the "osx" folder from the PyBluez rep later on, so we'll start with cloning it and install the fundamentals.
git clone https://github.com/karulis/pybluez.git
cd pybluez
python setup.py install- (Important!) Use the force and pull off some jedi mind tricks on macOS:
cd ~/timebox
pip install --upgrade git+https://github.com/karulis/pybluez.git#egg=pybluez
sudo -H cp -R pybluez/osx pybluez/lightblue
sudo -H cp -R pybluez/lightblue lib/python2.7/site-packages/- Clean up (delete the temporary pybluez folder)
rm -R pybluez- Do a quick test to check if Bluetooth is working. Save the following to a new .py file and name it bluetooth-test.py. Run the test with
python bluetooth-test.py
# simple inquiry example
import bluetooth
import sys
nearby_devices = bluetooth.discover_devices(lookup_names=True)
print("found %d devices" % len(nearby_devices))
for addr, name in nearby_devices:
print(" %s - %s" % (addr, name))If there's no error messages, and you are presented a Bluetooth device status report, Bluetooth and Python 2 are now best friends, and you are hereby a certified Jedi. The rest is in the help function and the README (Thanks! @ScR4tCh )
Example:
cd timebox
python timebox.py clock --color #FF0000Hope this helps anyone. I'm off to see where I can take this further 🙂
Best regards,
Andreas