[Pkg-anonymity-tools] [torbrowser-launcher] 01/43: allow installation into a virtualenv

Ulrike Uhlig u-guest at moszumanska.debian.org
Tue Sep 2 07:19:53 UTC 2014


This is an automated email from the git hooks/post-receive script.

u-guest pushed a commit to branch master
in repository torbrowser-launcher.

commit bcbd3ab72ab2b1a828e02af02249d76cfe424901
Author: Leif Ryge <leif at synthesize.us>
Date:   Mon Aug 11 03:38:31 2014 +0000

    allow installation into a virtualenv
    
     - use sys.prefix instead of hardcoding '/usr'
     - don't try to install the apparmor profile when in a virtualenv
---
 setup.py            | 16 +++++++++-------
 torbrowser-launcher |  3 ++-
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/setup.py b/setup.py
index f0ac421..aae20d4 100644
--- a/setup.py
+++ b/setup.py
@@ -28,8 +28,8 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 from distutils.core import setup
 import os
+import sys
 SHARE = 'share'
-PREFIX = '/usr'
 
 
 def file_list(path):
@@ -44,14 +44,16 @@ with open(os.path.join(SHARE, 'torbrowser-launcher/version')) as buf:
 
 datafiles = []
 for root, dirs, files in os.walk(SHARE):
-    datafiles.append((os.path.join(PREFIX, root),
+    datafiles.append((os.path.join(sys.prefix, root),
                       [os.path.join(root, f) for f in files]))
 
-datafiles += [('/etc/apparmor.d/', [
-    'apparmor/torbrowser.Browser.firefox',
-    'apparmor/torbrowser.start-tor-browser',
-    'apparmor/torbrowser.Tor.tor',
-    'apparmor/usr.bin.torbrowser-launcher'])]
+if not hasattr(sys, 'real_prefix'):
+    # we're not in a virtualenv, so we can probably write to /etc
+    datafiles += [('/etc/apparmor.d/', [
+        'apparmor/torbrowser.Browser.firefox',
+        'apparmor/torbrowser.start-tor-browser',
+        'apparmor/torbrowser.Tor.tor',
+        'apparmor/usr.bin.torbrowser-launcher'])]
 
 setup(name='torbrowser-launcher',
       version=version,
diff --git a/torbrowser-launcher b/torbrowser-launcher
index 080279c..066e554 100755
--- a/torbrowser-launcher
+++ b/torbrowser-launcher
@@ -28,8 +28,9 @@ OTHER DEALINGS IN THE SOFTWARE.
 """
 
 import os
-SHARE = os.getenv('TBL_SHARE', '/usr/share')
 import sys
+SHARE = os.getenv('TBL_SHARE', sys.prefix+'/share')
+
 import platform
 
 import gettext

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/torbrowser-launcher.git



More information about the Pkg-anonymity-tools mailing list