mirror of
https://github.com/kovidgoyal/calibre.git
synced 2026-05-27 01:02:34 -04:00
Switch linux build to using python 2.6 and cx_Freeze
This commit is contained in:
+38
@@ -0,0 +1,38 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# ConsoleSetLibPath.py
|
||||
# Initialization script for cx_Freeze which manipulates the path so that the
|
||||
# directory in which the executable is found is searched for extensions but
|
||||
# no other directory is searched. The environment variable LD_LIBRARY_PATH is
|
||||
# manipulated first, however, to ensure that shared libraries found in the
|
||||
# target directory are found. This requires a restart of the executable because
|
||||
# the environment variable LD_LIBRARY_PATH is only checked at startup.
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
import encodings
|
||||
import os
|
||||
import sys
|
||||
import warnings
|
||||
import zipimport
|
||||
|
||||
paths = os.environ.get("LD_LIBRARY_PATH", "").split(os.pathsep)
|
||||
if DIR_NAME not in paths:
|
||||
paths.insert(0, DIR_NAME)
|
||||
os.environ["LD_LIBRARY_PATH"] = os.pathsep.join(paths)
|
||||
os.execv(sys.executable, sys.argv)
|
||||
|
||||
sys.frozen = True
|
||||
sys.path = sys.path[:4]
|
||||
|
||||
os.environ["TCL_LIBRARY"] = os.path.join(DIR_NAME, "tcl")
|
||||
os.environ["TK_LIBRARY"] = os.path.join(DIR_NAME, "tk")
|
||||
|
||||
m = __import__("__main__")
|
||||
importer = zipimport.zipimporter(INITSCRIPT_ZIP_FILE_NAME)
|
||||
code = importer.get_code(m.__name__)
|
||||
exec code in m.__dict__
|
||||
|
||||
if sys.version_info[:2] >= (2, 5):
|
||||
module = sys.modules.get("threading")
|
||||
if module is not None:
|
||||
module._shutdown()
|
||||
|
||||
Reference in New Issue
Block a user