nixpkgs/pkgs/applications/networking/instant-messengers/blink/pythonpath.patch

50 lines
1.8 KiB
Diff
Raw Normal View History

2016-03-12 22:33:00 +01:00
--- blink-2.0.0/blink/resources.py 2016-03-09 14:39:07.000000000 +0100
+++ blink-2.0.0/blink/resources-patched.py 2016-03-12 21:34:14.965476623 +0100
@@ -1,7 +1,10 @@
+# Copyright (C) 2010-2013 AG Projects. See LICENSE for details.
+#
"""Provide access to Blink's resources"""
-import __main__
+__all__ = ['ApplicationData', 'Resources', 'IconManager']
+
import imghdr
import os
import platform
@@ -19,14 +22,10 @@
from blink.util import run_in_gui_thread
-__all__ = ['ApplicationData', 'Resources', 'IconManager']
-
-
class DirectoryContextManager(unicode):
def __enter__(self):
self.directory = os.getcwdu()
os.chdir(self)
-
def __exit__(self, type, value, traceback):
os.chdir(self.directory)
@@ -61,18 +60,7 @@
2015-04-08 06:57:48 +02:00
@classproperty
def directory(cls):
if cls._cached_directory is None:
2016-03-12 22:33:00 +01:00
- try:
- binary_directory = os.path.dirname(os.path.realpath(__main__.__file__))
- except AttributeError:
- if hasattr(sys, 'frozen'):
- application_directory = os.path.dirname(os.path.realpath(sys.executable))
- else:
- application_directory = os.path.realpath('') # executed in interactive interpreter
2015-04-08 06:57:48 +02:00
- else:
- if os.path.basename(binary_directory) == 'bin':
- application_directory = os.path.dirname(binary_directory)
- else:
- application_directory = binary_directory
+ application_directory = '@out@'
if os.path.exists(os.path.join(application_directory, 'resources', 'blink.ui')):
cls._cached_directory = os.path.join(application_directory, 'resources').decode(sys.getfilesystemencoding())
2014-05-16 22:46:03 +02:00
else: