kivy: include in frozen library zip
This commit is contained in:
parent
05a51346f9
commit
65d213c494
6
kvui.py
6
kvui.py
|
@ -8,6 +8,10 @@ os.environ["KIVY_NO_FILELOG"] = "1"
|
|||
os.environ["KIVY_NO_ARGS"] = "1"
|
||||
os.environ["KIVY_LOG_ENABLE"] = "0"
|
||||
|
||||
import Utils
|
||||
if Utils.is_frozen():
|
||||
os.environ["KIVY_DATA_DIR"] = Utils.local_path("data")
|
||||
|
||||
from kivy.config import Config
|
||||
|
||||
Config.set("input", "mouse", "mouse,disable_multitouch")
|
||||
|
@ -42,7 +46,7 @@ from kivy.uix.popup import Popup
|
|||
|
||||
fade_in_animation = Animation(opacity=0, duration=0) + Animation(opacity=1, duration=0.25)
|
||||
|
||||
import Utils
|
||||
|
||||
from NetUtils import JSONtoTextParser, JSONMessagePart, SlotType
|
||||
|
||||
if typing.TYPE_CHECKING:
|
||||
|
|
13
setup.py
13
setup.py
|
@ -111,8 +111,10 @@ class BuildExeCommand(cx_Freeze.command.build_exe.BuildEXE):
|
|||
self.libfolder = Path(self.buildfolder, "lib")
|
||||
self.library = Path(self.libfolder, "library.zip")
|
||||
|
||||
def installfile(self, path, keep_content=False):
|
||||
def installfile(self, path, subpath=None, keep_content: bool = False):
|
||||
folder = self.buildfolder
|
||||
if subpath:
|
||||
folder /= subpath
|
||||
print('copying', path, '->', folder)
|
||||
if path.is_dir():
|
||||
folder /= path.name
|
||||
|
@ -173,6 +175,12 @@ class BuildExeCommand(cx_Freeze.command.build_exe.BuildEXE):
|
|||
for data in self.extra_data:
|
||||
self.installfile(Path(data))
|
||||
|
||||
# kivi data files
|
||||
import kivy
|
||||
shutil.copytree(os.path.join(os.path.dirname(kivy.__file__), "data"),
|
||||
self.buildfolder / "data",
|
||||
dirs_exist_ok=True)
|
||||
|
||||
os.makedirs(self.buildfolder / "Players" / "Templates", exist_ok=True)
|
||||
from WebHostLib.options import create
|
||||
create()
|
||||
|
@ -189,7 +197,6 @@ class BuildExeCommand(cx_Freeze.command.build_exe.BuildEXE):
|
|||
from maseya import z3pr
|
||||
except ImportError:
|
||||
print("Maseya Palette Shuffle not found, skipping data files.")
|
||||
z3pr = None
|
||||
else:
|
||||
# maseya Palette Shuffle exists and needs its data files
|
||||
print("Maseya Palette Shuffle found, including data files...")
|
||||
|
@ -408,7 +415,7 @@ cx_Freeze.setup(
|
|||
"excludes": ["numpy", "Cython", "PySide2", "PIL",
|
||||
"pandas"],
|
||||
"zip_include_packages": ["*"],
|
||||
"zip_exclude_packages": ["worlds", "kivy", "sc2"],
|
||||
"zip_exclude_packages": ["worlds", "sc2"],
|
||||
"include_files": find_libs("libssl.so", "libcrypto.so") if is_linux else [],
|
||||
"include_msvcr": False,
|
||||
"replace_paths": [("*", "")],
|
||||
|
|
Loading…
Reference in New Issue