Description: Fix for wrong paths in web app
 During the build process, the default paths need to be used for
 update-profiles.pl to succeed. After installation the custom paths
 are used instead.
Author: Uwe Steinmann <uwe@steinmann.cx>, Bas Couwenberg <sebastic@debian.org>
Forwarded: not-needed

--- a/web/www/routino/paths.py
+++ b/web/www/routino/paths.py
@@ -19,15 +19,20 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 
+import os
 import os.path
 
 # Directory path parameters
 
 # EDIT THIS to set the root directory for the non-web data files (absolute or relative to here).
 root_dir = "../.."
+if 'MODE' not in os.environ or os.environ['MODE'] != 'build':
+    root_dir = "/var/lib/routino"
 
 # EDIT THIS to change the location of the individual directories (relative to the root directory).
 bin_dir     = os.path.join(root_dir, "bin")
+if 'MODE' not in os.environ or os.environ['MODE'] != 'build':
+    bin_dir = "/usr/bin"
 data_dir    = os.path.join(root_dir, "data")
 results_dir = os.path.join(root_dir, "results")
 
--- a/web/Makefile
+++ b/web/Makefile
@@ -104,7 +104,7 @@ all-profiles: all-bin all-data
 	     [ $(WEBDATADIR)/profiles.xml -nt $(WEBWWWDIR)/profiles.py ] || \
 	     [ $(WEBDATADIR)/profiles.xml -nt $(WEBWWWDIR)/profiles.js ]; then \
 	    echo update-profiles.py ;\
-	    ( cd $(WEBWWWDIR) ; $(PYTHON) update-profiles.py ) ;\
+	    ( cd $(WEBWWWDIR) ; MODE=build $(PYTHON) update-profiles.py ) ;\
 	 fi
 
 ####
@@ -137,15 +137,15 @@ endif
 
 $(WEBWWWDIR)/router.html.en: $(WEBTRANSDIR)/router.html $(TRANS_FILES) $(WEBTRANSDIR)/translate.py
 	@echo translate.py
-	@cd $(WEBTRANSDIR) && $(PYTHON) translate.py
+	@cd $(WEBTRANSDIR) && MODE=build $(PYTHON) translate.py
 
 $(WEBWWWDIR)/visualiser.html.en: $(WEBTRANSDIR)/visualiser.html $(TRANS_FILES) $(WEBTRANSDIR)/translate.py
 	@echo translate.py
-	@cd $(WEBTRANSDIR) && $(PYTHON) translate.py
+	@cd $(WEBTRANSDIR) && MODE=build $(PYTHON) translate.py
 
 $(XMLDIR)/routino-translations.xml: $(WEBTRANSDIR)/translations-head.xml $(WEBTRANSDIR)/translations-body.xml $(WEBTRANSDIR)/translations-tail.xml $(TRANS_FILES) $(WEBTRANSDIR)/translate.py
 	@echo translate.py
-	@cd $(WEBTRANSDIR) && $(PYTHON) translate.py
+	@cd $(WEBTRANSDIR) && MODE=build $(PYTHON) translate.py
 
 ####
 
@@ -153,7 +153,7 @@ all-icons: $(WEBICONDIR)/ball-0.png
 
 $(WEBICONDIR)/ball-0.png: $(WEBICONDIR)/create-icons.py
 	@echo create-icons.py
-	@cd $(WEBICONDIR) && $(PYTHON) create-icons.py
+	@cd $(WEBICONDIR) && MODE=build $(PYTHON) create-icons.py
 
 ####
 
