Allow tests to find share folders when building .deb

This commit is contained in:
Micah Lee 2017-11-20 16:19:04 -08:00
parent 21e1dac2c3
commit d544a0341f
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73
3 changed files with 9 additions and 4 deletions

1
.gitignore vendored
View File

@ -27,6 +27,7 @@ pip-log.txt
.coverage
.tox
nosetests.xml
.cache
# Translations
*.mo

View File

@ -1,11 +1,12 @@
include LICENSE
include README.md
include BUILD.md
include resources/*
include resources/images/*
include resources/locale/*
include resources/html/*
include share/*
include share/images/*
include share/locale/*
include share/html/*
include install/onionshare.desktop
include install/onionshare.appdata.xml
include install/onionshare80.xpm
include install/scripts/onionshare-nautilus.py
include test/*.py

View File

@ -69,6 +69,9 @@ def get_resource_path(filename):
if getattr(sys, 'onionshare_dev_mode', False):
# Look for resources directory relative to python file
prefix = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))), 'share')
if not os.path.exists(prefix):
# While running tests during stdeb bdist_deb, look 3 directories up for the share folder
prefix = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(prefix)))), 'share')
elif p == 'Linux' and sys.argv and sys.argv[0].startswith(sys.prefix):
# OnionShare is installed systemwide in Linux