Skip to content

Commit e04841e

Browse files
committed
Merge branch 'develop'
2 parents 54fc0bb + 094708a commit e04841e

File tree

12 files changed

+42
-16
lines changed

12 files changed

+42
-16
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 1.3.2
2+
current_version = 1.3.3
33
commit = True
44
tag = True
55

Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ RUN apk update \
1818
procps=3.3.15-r0 \
1919
tcpdump=4.9.2-r3 \
2020
scapy=2.4.0-r0 \
21+
&& apk add --no-cache \
22+
bash \
2123
&& pip install --no-cache-dir -r py3-requirements.txt \
2224
&& pip install . \
2325
&& python -m amazon_dash.install \

README.rst

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,17 @@ with few resources.
4646

4747
.. code:: console
4848
49-
$ sudo pip install amazon-dash # and after:
50-
$ sudo python -m amazon_dash.install
49+
$ sudo pip3 install amazon-dash # and after:
50+
$ sudo python3 -m amazon_dash.install
5151
5252
Also available on `AUR <https://aur.archlinux.org/packages/amazon-dash-git/>`_ and
53-
`FreeNAS <http://docs.nekmo.org/amazon-dash/installation.html#freenas>`_. See other installation methods
54-
`in the documentation <http://docs.nekmo.org/amazon-dash/installation.html>`_.
53+
`FreeNAS <http://docs.nekmo.org/amazon-dash/installation.html#freenas>`_. You can also use ``pip2`` and
54+
``python2`` if your system only has Python2, but Python 3 is the recommended version. See other installation
55+
methods `in the documentation <http://docs.nekmo.org/amazon-dash/installation.html>`_.
5556

57+
**Note:** ``scapy 2.4.1/2.4.2`` releases are broken (``MANIFEST`` is missing in wheel). Scapy 2.4.0 will be used by
58+
default (or earlier). It may also be necessary to install ``tcpdump`` on your system (in Debian
59+
``apt install tcpdump``).
5660

5761
2. Use *discovery mode* **to know the mac of your Dash** (Run the program, and then press any button):
5862

amazon_dash/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11

2-
__version__ = '1.3.2'
2+
__version__ = '1.3.3'

amazon_dash/execute.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def execute(self, root_allowed=False):
209209
if self.data.get('content-type'):
210210
kwargs['headers']['content-type'] = self.data['content-type']
211211
if self.data.get('body'):
212-
kwargs['data'] = self.data['body']
212+
kwargs['data'] = self.data['body'].encode('utf-8')
213213
if self.data.get('auth'):
214214
kwargs['auth'] = tuple(self.data['auth'].split(':', 1))
215215
try:
@@ -278,7 +278,9 @@ def get_headers(self):
278278
:return: HTTP Headers
279279
:rtype: dict
280280
"""
281-
return copy.copy(self.default_headers or {})
281+
headers = copy.copy(self.default_headers or {})
282+
headers.update(self.data.get('headers') or {})
283+
return headers
282284

283285
def get_body(self):
284286
"""Get body to send. By default default_body
@@ -363,7 +365,7 @@ class ExecuteOpenHab(ExecuteOwnApiBase):
363365

364366
def __init__(self, name, data):
365367
super(ExecuteOpenHab, self).__init__(name, data)
366-
self.data['headers'] = {'Accept': 'application/json'}
368+
self.data['headers'] = dict(self.data.get('headers') or {}, **{'Accept': 'application/json'})
367369

368370
def get_url(self):
369371
"""Open Hab url

amazon_dash/install/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import platform
23
import shutil
34
import sys
45
from subprocess import check_output
@@ -15,6 +16,7 @@
1516
dirname = os.path.dirname(os.path.abspath(__file__))
1617
CONFIG_EXAMPLE = os.path.join(dirname, 'amazon-dash.yml')
1718
SYSTEMD_SERVICE = os.path.join(dirname, 'services', 'amazon-dash.service')
19+
UNSUPPORTED_SYSTEMS = ['Darwin', 'Windows']
1820

1921

2022
if sys.version_info < (3,0):
@@ -125,6 +127,12 @@ def installation(self):
125127
@click.group(cls=DefaultGroup, default='all', default_if_no_args=True)
126128
@click.option('--root-required/--root-not-required', default=True)
127129
def cli(root_required):
130+
system = platform.system()
131+
if system in UNSUPPORTED_SYSTEMS:
132+
click.echo('{} is not supported by the installation wizard. '
133+
'However, you can use Amazon-dash manually.\n'
134+
'http://docs.nekmo.org/amazon-dash/usage.html#manually'.format(system), err=True)
135+
sys.exit(2)
128136
if os.getuid() and root_required:
129137
click.echo('The installation must be done as root. Maybe you forgot sudo?', err=True)
130138
sys.exit(1)

amazon_dash/install/services/amazon-dash.service

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
[Unit]
22
Description=Amazon Dash service
3+
After=network-online.target
4+
Wants=network-online.target
35

46
[Service]
57
User=root

common-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PyYAML>=3.0
2-
jsonschema
2+
jsonschema<3.0.0
33
requests
44
click
55
click-default-group

docs/installation.rst

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,16 @@ To install amazon-dash, run these commands in your terminal:
1212

1313
.. code-block:: console
1414
15-
$ pip install -U amazon_dash
16-
$ sudo python -m amazon_dash.install
15+
$ sudo pip3 install -U amazon_dash
16+
$ sudo python3 -m amazon_dash.install
1717
1818
This is the preferred method to install amazon-dash, as it will always install the most recent stable release.
19-
You must execute both commands in the correct order.
19+
You must execute both commands in the correct order. Amazon-dash also works with Python2:
20+
21+
.. code-block:: console
22+
23+
$ sudo pip2 install -U amazon_dash
24+
$ sudo python2 -m amazon_dash.install
2025
2126
If you don't have `pip`_ installed, this `Python installation guide`_ can guide
2227
you through the process.
@@ -62,6 +67,9 @@ There is support for FreeNAS created by `Troy Prelog <https://github.com/tprelog
6267
wget -O /tmp/amazon-dash.json https://raw.githubusercontent.com/tprelog/iocage-amazon-dash/master/amazon-dash.json
6368
sudo iocage fetch -P dhcp=on vnet=on bpf=yes -n /tmp/amazon-dash.json --branch 'master'
6469

70+
**IMPORTANT**: ``scapy >= 2.4.1`` (including 2.4.2)
71+
`has a bug with FreeBSD <https://github.com/secdev/scapy/issues/1793>`_. Install Scapy 2.4.0
72+
6573

6674
Installation Issues
6775
-------------------

py2-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
scapy
1+
scapy<=2.4.0
22
subprocess32
33
-r common-requirements.txt

0 commit comments

Comments
 (0)