* for OSX
install gettext from  http://www.ellert.se/twain-sane/

* for windows
use preconfigured environment with python, kivy, and gettext
to prepare a dist clean local files:
cd python27/share/rmap
remove:
rmap.sqlite3
saveddata-service.pickle
cache
in lib/site-package/rmap
and rmap.ini 

7zip -> aggiungi all'archivio -> formato 7z -lzma2 -> crea archvio autoestraente


Upgrade in all system should be done with:

pip install --upgrade rmap

* to extract messages and translate and compile
python setup.py makemessages

poedit locale/it/LC_MESSAGES/django.po
poedit registration/locale/it/LC_MESSAGES/django.po

python setup.py compilemessages

* to rebuild android package
buildozer android release
./sign.sh

* to manually initialize a DB
python manage.py migrate --no-initial-data
python manage.py changepassword rmap

* how to use the last django in android
for the last django:
   rm .buildozer/android/platform/python-for-android/recipes/django/recipe.sh
or if you want 1.9.2
   edit .buildozer/android/platform/python-for-android/recipes/django/recipe.sh
        VERSION_django=${VERSION_django:-1.9.2}
        MD5_django=ee90280973d435a1a6aa01b453b50cd1

comment wsgiref in
.buildozer/android/platform/python-for-android/src/blacklist.txt

clean locale files:

  # old find .buildozer/applibs/django -name \*.mo -exec rm \{\} \;
  # old find .buildozer/applibs/django -name \*.po -exec rm \{\} \;

  # new find .buildozer/android/platform/build/dists/rmap/private/lib/python2.7/site-packages/django -name \*.mo -exec rm \{\} \;
  # new find .buildozer/android/platform/build/dists/rmap/private/lib/python2.7/site-packages/django -name \*.po -exec rm \{\} \;

apply patch as in
  https://github.com/r-map/rmap/issues/25
to
   # old .buildozer/applibs/django/db/migrations/loader.py
  .buildozer/android/platform/build/dists/rmap/private/lib/python2.7/site-packages/django/db/migrations/loader.py

* dump data by natural keys
 python manage.py dumpdata --natural-foreign --natural-primary --format=json auth.user|json_reformat

for pip:
python setup.py distclean compilemessages sdist upload -r pypi
(*.mo files in locale have to be distributed in source tarball)

install with:
rm -rf /tmp/pip-build-root/rmap/
pip -v install --upgrade  rmap


>>> initialize DB

./rmapctrl --syncdb

>>> Configure a station (wizard) by command line:
./rmap-configure --wizard --station_slug=ETH_fixed --board_slug=master_eth_fixed --height=100 --stationname="Casa esterno" --username=user --password=password --server=rmap.cc --mqttsamplerate=5 --lat=44.69950 --lon=10.64555 --upload_to_server

>>> Add sensors to board
./rmap-configure --addsensors_by_template=stima_t --station_slug=ETH_fixed --board_slug=master_eth_fixed --user=user --password=password --upload_to_server

>>> Configure eth board
./rmap-configure --config_station --station_slug=ETH_fixed --board_slug=master_eth_fixed --user=user --password=password --upload_to_server


>>> Configure GSM board (richardson station)
./rmap-configure --config_station --board_slug=stima_gps --station_slug=richardson --username=pat1


>>> Create GSM report THP station and configure board
rmapctrl --syncdb
rmap-configure --wizard --station_slug=report_thp --height=100 --stationname="ARPAE" --username=username --password=password --server=rmap.cc --lat=44.69950 --lon=10.64555 --mqttrootpath=report --mqttmaintpath=report
rmap-configure --addboard --station_slug=report_thp --board_slug=report_thp_gsm --user=username --serialactivate --mqttactivate --mqttuser=username --mqttpassword=password --mqttsamplerate=900
rmap-configure --addsensors_by_template=stima_report_thp --station_slug=report_thp --board_slug=report_thp_gsm --user=username --password=password --upload_to_server

rmap-configure --config_station --station_slug=report_thp --board_slug=report_thp_gsm --username=username --baudrate 115200


#obsolete notes:

* bug in plyer to patch:
https://www.bountysource.com/issues/7197528-overflowerror-python-int-too-large-to-convert-to-c-long-android-lollipop
you have to modify it in .buildozer dir
./android/platform/python-for-android/dist/rmap/python-install/lib/python2.7/site-packages/plyer/platforms/android/gps.py

* to use pyserial comment 
#lib-dynload/termios.so
in
./android/platform/python-for-android/src/blacklist.txt
./android/platform/python-for-android/dist/rmap/blacklist.txt

