summarylogtreecommitdiffstats
path: root/paths-in-opt.patch
diff options
context:
space:
mode:
authorScore_Under2019-01-10 14:54:38 +0000
committerScore_Under2019-01-10 14:54:47 +0000
commitbfb5253cb6f464ba37ab48e6c84f2408549d9267 (patch)
treed70889d1023181b91eca05745cac07af5bbf07d4 /paths-in-opt.patch
parent2cbe0c183e9f39f09dbfb098d28c1eea5cd5316a (diff)
downloadaur-bfb5253cb6f464ba37ab48e6c84f2408549d9267.tar.gz
Update for Hydrus 335 (Python 3 support!!)
Diffstat (limited to 'paths-in-opt.patch')
-rw-r--r--paths-in-opt.patch59
1 files changed, 42 insertions, 17 deletions
diff --git a/paths-in-opt.patch b/paths-in-opt.patch
index 36c05a157242..d0ed5692ff8c 100644
--- a/paths-in-opt.patch
+++ b/paths-in-opt.patch
@@ -1,53 +1,78 @@
diff --git a/include/ClientGUI.py b/include/ClientGUI.py
-index 92828e0..297bd0e 100755
+index 1d39c4f..e506341 100755
--- a/include/ClientGUI.py
+++ b/include/ClientGUI.py
-@@ -476,7 +476,7 @@ class FrameGUI( ClientGUITopLevelWindows.FrameThatResizes ):
+@@ -397,7 +397,7 @@ class FrameGUI( ClientGUITopLevelWindows.FrameThatResizes ):
python_executable = python_executable.replace( 'pythonw', 'python' )
- server_script_path = os.path.join( HC.BASE_DIR, 'server.py' )
+ server_script_path = '/opt/hydrus/server.py'
- cmd = '"' + python_executable + '" "' + server_script_path + '" ' + db_param
+ cmd = [ python_executable, server_script_path, db_param ]
diff --git a/include/HydrusConstants.py b/include/HydrusConstants.py
-index bb0a939..8e690e1 100755
+index 7b45015..47fc32c 100755
--- a/include/HydrusConstants.py
+++ b/include/HydrusConstants.py
-@@ -3,30 +3,15 @@ import sys
+@@ -2,30 +2,9 @@ import os
+ import sys
# dirs
++RUNNING_FROM_FROZEN_BUILD = False
--BASE_DIR = sys.path[0]
--
--if BASE_DIR == '':
+-if getattr( sys, 'frozen', False ):
-
-- BASE_DIR = os.getcwdu()
+- RUNNING_FROM_FROZEN_BUILD = True
-
--else:
+- # we are in a pyinstaller frozen app
+-
+- BASE_DIR = getattr( sys, '_MEIPASS', None )
-
-- try:
+- if BASE_DIR is None:
-
-- BASE_DIR = BASE_DIR.decode( 'utf-8' )
+- raise Exception( 'It seems this hydrus is running from a frozen bundle, but there was no _MEIPASS variable under sys to define the bundle directory.' )
-
-- except:
+-
+-else:
+-
+- RUNNING_FROM_FROZEN_BUILD = False
+-
+- BASE_DIR = sys.path[0]
+-
+- if BASE_DIR == '':
-
-- pass
+- BASE_DIR = os.getcwd()
-
--
++BASE_DIR = os.path.expanduser("~/.local/share/hydrus")
+
+ PLATFORM_WINDOWS = False
+ PLATFORM_OSX = False
+@@ -38,23 +17,16 @@ elif sys.platform == 'linux': PLATFORM_LINUX = True
+ RUNNING_FROM_SOURCE = sys.argv[0].endswith( '.py' ) or sys.argv[0].endswith( '.pyw' )
+ RUNNING_FROM_OSX_APP = os.path.exists( os.path.join( BASE_DIR, 'running_from_app' ) )
+
-BIN_DIR = os.path.join( BASE_DIR, 'bin' )
-HELP_DIR = os.path.join( BASE_DIR, 'help' )
-INCLUDE_DIR = os.path.join( BASE_DIR, 'include' )
-STATIC_DIR = os.path.join( BASE_DIR, 'static' )
-+BASE_DIR = os.path.expanduser("~/.local/share/hydrus")
-+
+BIN_DIR = "/opt/hydrus/bin"
+HELP_DIR = "/opt/hydrus/help"
+INCLUDE_DIR = "/opt/hydrus/include"
+STATIC_DIR = "/opt/hydrus/static"
DEFAULT_DB_DIR = os.path.join( BASE_DIR, 'db' )
+
+-if PLATFORM_OSX:
+-
+- USERPATH_DB_DIR = os.path.join( os.path.expanduser( '~' ), 'Library', 'Hydrus' )
+-
+-else:
+-
+- USERPATH_DB_DIR = os.path.join( os.path.expanduser( '~' ), 'Hydrus' )
+-
++USERPATH_DB_DIR = DEFAULT_DB_DIR
+
-LICENSE_PATH = os.path.join( BASE_DIR, 'license.txt' )
+LICENSE_PATH = "/usr/share/licenses/hydrus/license.txt"