From 24b2a251760e02c53387d4ca466d83bedfc49d01 Mon Sep 17 00:00:00 2001 From: Stefan Saraev Date: Fri, 16 Mar 2018 17:00:59 +0200 Subject: [PATCH] get_dmrmarc_json.py: clarify python-requests requirment --- README.de.md | 5 +++-- README.md | 3 +++ db/Makefile | 2 +- db/get_dmrmarc_json.py | 8 +++++++- docs/debian.md | 4 ++-- docs/raspi.md | 2 +- 6 files changed, 17 insertions(+), 7 deletions(-) diff --git a/README.de.md b/README.de.md index 40134caa..1dbcff9e 100644 --- a/README.de.md +++ b/README.de.md @@ -36,18 +36,19 @@ Ebenso sind zur Nutzung folgende Pakete erforderlich: * Python 2.7 or newer: http://www.python.org * PyUSB 1.0: (0.4 does not work.) http://sourceforge.net/apps/mediawiki/pyusb/ * libusb 1.0: (0.4 does not work.) http://www.libusb.org/ +* python-requests: http://python-requests.org/ #### Automatische Installation der benötigten Pakete Debian Stretch: apt-get install gcc-arm-none-eabi binutils-arm-none-eabi \ - libnewlib-arm-none-eabi libusb-1.0 python-usb + libnewlib-arm-none-eabi libusb-1.0 python-usb python-requests Debian Jessie / Ubuntu 16.04 LTS: apt-get install gcc-arm-none-eabi binutils-arm-none-eabi libusb-1.0 git \ - libnewlib-arm-none-eabi make curl python-pip unzip + libnewlib-arm-none-eabi make curl python-pip python-requests unzip pip install pyusb -U # update PyUSB to 1.0 diff --git a/README.md b/README.md index 0fde6f0b..fcf903d7 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,9 @@ repository. We use a heap-less printf library under the BSD license. * libusb 1.0: (0.4 does not work.) http://www.libusb.org/ +* python-requests + http://python-requests.org/ + This project should work across Linux, Mac OS, and Windows, but has not been tested on all platforms. A separate client, MD380Tool, is under development for Android. diff --git a/db/Makefile b/db/Makefile index 437163b7..272cb9a0 100644 --- a/db/Makefile +++ b/db/Makefile @@ -32,7 +32,7 @@ dmrmarc2.tmp: dmrmarc.tmp awk -F, -f insert_nick.awk <$< >$@ dmrmarc.tmp: - python2 get_dmrmarc_json.py >$@ 2>get_dmrmarc.errors + python2 get_dmrmarc_json.py >$@ reflector.tmp: curl $(CURL_FLAGS) 'http://registry.dstar.su/reflector.db' | perl -pe '$$_ = "" if ( $$. == 1 ); s#@#,#; s#@.*#,,,,,,#' >$@ diff --git a/db/get_dmrmarc_json.py b/db/get_dmrmarc_json.py index 6e9f07a0..5750c9a4 100644 --- a/db/get_dmrmarc_json.py +++ b/db/get_dmrmarc_json.py @@ -3,9 +3,15 @@ # KD4Z # dmr-marc decided to stop offering CSV output format, so json here we come -import requests import sys +try: + import requests +except ImportError as e: + sys.stderr.write('\n' + str(e) + '\n') + sys.stderr.write('\nERROR: please install python-requests\n\n') + exit(127) + def noCommas(field): try: diff --git a/docs/debian.md b/docs/debian.md index 2bdd0c9c..e72c1f2b 100644 --- a/docs/debian.md +++ b/docs/debian.md @@ -5,7 +5,7 @@ #### Debian Stretch: #### apt-get install gcc-arm-none-eabi binutils-arm-none-eabi libnewlib-arm-none-eabi \ - libusb-1.0 python-usb make curl + libusb-1.0 python-usb python-requests make curl #### Debian Jessie (using backports.debian.org): #### @@ -23,7 +23,7 @@ Install python-usb from backports, the rest from Jessie apt -t jessie-backports install python-usb apt install gcc-arm-none-eabi binutils-arm-none-eabi libnewlib-arm-none-eabi \ - libusb-1.0 make curl + libusb-1.0 make curl python-requests #### Debian Jessie (using python-pip): #### diff --git a/docs/raspi.md b/docs/raspi.md index a26e1b7e..8660b888 100644 --- a/docs/raspi.md +++ b/docs/raspi.md @@ -7,7 +7,7 @@ Tested on 2016-05-10-raspbian-jessie by IZ2XBZ ``` sudo apt-get install gcc-arm-none-eabi binutils-arm-none-eabi libusb-1.0 \ - libnewlib-arm-none-eabi make curl + libnewlib-arm-none-eabi make curl python-requests Tested on 2017-03-02-raspbian-jessie by YT5ZEC (dragstor): In addition to the notes above, install the following pip package, in order to get cable to work.