[Pkg-privacy-commits] [onionshare] 23/55: Added resources to cx_Freeze setup, and make those resources findable by the app

Ulrike Uhlig u-guest at moszumanska.debian.org
Thu Sep 8 10:26:47 UTC 2016


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

u-guest pushed a commit to branch debian
in repository onionshare.

commit 8e8ea9c357ca0aab9f3840141692d4c83f2a17b9
Author: Micah Lee <micah at micahflee.com>
Date:   Sun Sep 4 19:54:45 2016 -0700

    Added resources to cx_Freeze setup, and make those resources findable by the app
---
 onionshare/helpers.py | 10 ++++++++--
 setup.py              |  3 ++-
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/onionshare/helpers.py b/onionshare/helpers.py
index 814d020..04e70c1 100644
--- a/onionshare/helpers.py
+++ b/onionshare/helpers.py
@@ -37,9 +37,15 @@ def get_resource_path(filename):
     if p == 'Linux' and sys.argv and sys.argv[0].startswith('/usr/bin/onionshare'):
         # OnionShare is installed systemwide in Linux
         resources_dir = os.path.join(sys.prefix, 'share/onionshare')
-    elif getattr(sys, 'frozen', False): # Check if app is "frozen" with pyinstaller
+    elif getattr(sys, 'frozen', False): # Check if app is "frozen" with pyinstaller, cx_Freeze
         # https://pythonhosted.org/PyInstaller/#run-time-information
-        resources_dir = sys._MEIPASS
+		# http://cx-freeze.readthedocs.io/en/latest/faq.html#using-data-files
+		if p == 'Windows':
+			# Windows is using cx_Freeze
+			resources_dir = os.path.join(os.path.dirname(sys.executable), 'resources')
+		else:
+			# OS X is using PyInstaller
+			resources_dir = sys._MEIPASS
     else:  # Look for resources directory relative to python file
         resources_dir = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))), 'resources')
 
diff --git a/setup.py b/setup.py
index c0bac7b..34a04a9 100644
--- a/setup.py
+++ b/setup.py
@@ -86,7 +86,8 @@ if os == 'Windows':
         options={
 			"build_exe": {
 				"packages": [],
-				"excludes": []
+				"excludes": [],
+				"include_files": ['resources']
 			}
 		},
         executables=[

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/onionshare.git



More information about the Pkg-privacy-commits mailing list