Description: Fix installation paths in setup.py.
Author: Iain R. Learmonth <irl@debian.org>
Last-Update: 2016-11-05
---
--- a/setup.py
+++ b/setup.py
@@ -87,6 +87,7 @@
 from __future__ import print_function
 
 import os
+import sys
 import errno
 import tempfile
 from glob import glob
@@ -169,25 +170,22 @@
 
     def set_data_files(self, prefix):
         share_path = pj(prefix, 'share')
-        if prefix.startswith("/usr"):
-            var_path = "/var/lib/"
-        else:
-            var_path = pj(prefix, 'var', 'lib')
+        var_path = pj(prefix, '..', 'var', 'lib')
 
         self.distribution.data_files.append(
             (
-                pj(share_path, 'ooni', 'decks-available'),
+                pj('share', 'ooni', 'decks-available'),
                 glob('data/decks/*')
             )
         )
         settings = SafeConfigParser()
         settings.add_section("directories")
         settings.set("directories", "usr_share",
-                     os.path.join(share_path, "ooni"))
+                     os.path.join("/usr", "share", "ooni"))
         settings.set("directories", "var_lib",
-                     os.path.join(var_path, "ooni"))
+                     os.path.join("/var", "lib", "ooni"))
         settings.set("directories", "etc",
-                     os.path.join(var_path, "ooni"))
+                     os.path.join("/etc"))
         with open("ooni/settings.ini", "w+") as fp:
             settings.write(fp)
 
@@ -196,7 +194,7 @@
         mkdir_p(pj(share_path, 'ooni', 'decks-available'))
 
     def pre_install(self):
-        prefix = os.path.abspath(self.prefix)
+        prefix = os.path.abspath("debian/ooniprobe/usr")
         self.set_data_files(prefix)
 
     def run(self):
--- a/ooni/settings.py
+++ b/ooni/settings.py
@@ -425,7 +425,6 @@
         sub_directories = [
             self.inputs_directory,
             self.decks_enabled_directory,
-            self.decks_available_directory,
             self.scheduler_directory,
             self.measurements_directory,
             self.resources_directory
--- a/ooni/settings.ini
+++ b/ooni/settings.ini
@@ -1,5 +1,5 @@
 [directories]
-usr_share = /Users/x/.virtualenvs/ooni-probe-test/share/ooni
-var_lib = /Users/x/.virtualenvs/ooni-probe-test/var/lib/ooni
-etc = /Users/x/.virtualenvs/ooni-probe-test/var/lib/ooni
+usr_share = /usr/share
+var_lib = /var/lib
+etc = /etc
 
