[Pkg-privacy-commits] [torbrowser-launcher] 322/476: allow installation into a virtualenv

Ximin Luo infinity0 at moszumanska.debian.org
Sat Aug 22 13:21:51 UTC 2015


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

infinity0 pushed a commit to branch debian
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/pkg-privacy/packages/torbrowser-launcher.git



More information about the Pkg-privacy-commits mailing list