From f56df5be46561b9d7298895bc87ff56e3db0a6d4 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Mon, 20 Nov 2017 16:19:04 -0800 Subject: [PATCH] Allow tests to find share folders when building .deb --- .gitignore | 1 + MANIFEST.in | 9 +++++---- onionshare/common.py | 3 +++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 20342555..712484d6 100644 --- a/.gitignore +++ b/.gitignore @@ -27,6 +27,7 @@ pip-log.txt .coverage .tox nosetests.xml +.cache # Translations *.mo diff --git a/MANIFEST.in b/MANIFEST.in index 64eca8f9..f4d1c078 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -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 diff --git a/onionshare/common.py b/onionshare/common.py index 89d4695f..176c7931 100644 --- a/onionshare/common.py +++ b/onionshare/common.py @@ -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