From 852d95794acb91bb6e27116575a361e48a3eaeaa Mon Sep 17 00:00:00 2001 From: Ben West Date: Thu, 14 May 2015 18:26:53 -0700 Subject: try not to violate Sandbox rules in virtualenvwrapper --- setup.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index 504f204..ea857e4 100644 --- a/setup.py +++ b/setup.py @@ -2,6 +2,13 @@ from setuptools import setup, find_packages import platform +import subprocess + +def is_virtualenv ( ): + import os + proc = subprocess.Popen(['which', 'virtualenvwrapper'], stderr=subprocess.PIPE, stdout=subprocess.PIPE) + has_venv = proc.poll( ) == 0 + return os.environ.get('VIRTUAL_ENV', has_venv) import dexcom_reader def readme(): @@ -10,8 +17,11 @@ def readme(): dataFiles = [ ] if platform.system( ) == 'Linux': + prefix = '/' + if is_virtualenv( ): + prefix = '' dataFiles = [ - ('/etc/udev/rules.d', ['etc/udev/rules.d/80-dexcom.rules']), + (prefix + 'etc/udev/rules.d', ['etc/udev/rules.d/80-dexcom.rules']), ] setup(name='dexcom_reader', -- cgit v1.2.3