[tor-commits] [ooni-probe/master] Fix installation for virtualenv

art at torproject.org art at torproject.org
Wed Jun 19 12:32:46 UTC 2013


commit 3e3843515d3ca6179b10f1652e930f54151655e5
Author: Arturo Filastò <art at fuffa.org>
Date:   Mon Jun 17 13:13:27 2013 +0200

    Fix installation for virtualenv
---
 setup.py |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/setup.py b/setup.py
index 7912924..ec4b353 100644
--- a/setup.py
+++ b/setup.py
@@ -18,13 +18,18 @@ dependency_links = [
     'https://people.torproject.org/~ioerror/src/mirrors/ooniprobe'
 ]
 
+usr_share_path = '/usr/share/ooni'
+# If this is true then it means we are in a virtualenv
+if hasattr(sys, 'real_prefix'):
+    usr_share_path = pj(sys.prefix, 'share', 'ooni')
+
 data_files = []
 for root, dirs, file_names in os.walk('data/'):
     files = []
     for file_name in file_names:
         if not file_name.endswith('.pyc'):
             files.append(pj(root, file_name))
-    data_files.append([pj('/usr/share/ooni', root), files])
+    data_files.append([pj(usr_share_path, root), files])
 
 with open('requirements.txt') as f:
     for line in f:





More information about the tor-commits mailing list