first commit

This commit is contained in:
Yura 2024-09-15 15:12:16 +03:00
commit 417e54da96
5696 changed files with 900003 additions and 0 deletions

View file

@ -0,0 +1,72 @@
"""
PyInstaller hooks
=================
Add ``hookspath=[kivymd.hooks_path]`` to your .spec file.
Example of .spec file
=====================
.. code-block:: python
# -*- mode: python ; coding: utf-8 -*-
import sys
import os
from kivy_deps import sdl2, glew
from kivymd import hooks_path as kivymd_hooks_path
path = os.path.abspath(".")
a = Analysis(
["main.py"],
pathex=[path],
hookspath=[kivymd_hooks_path],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=None,
noarchive=False,
)
pyz = PYZ(a.pure, a.zipped_data, cipher=None)
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
*[Tree(p) for p in (sdl2.dep_bins + glew.dep_bins)],
debug=False,
strip=False,
upx=True,
name="app_name",
console=True,
)
"""
__all__ = ("hooks_path", "get_hook_dirs", "get_pyinstaller_tests")
import os
from pathlib import Path
import kivymd
hooks_path = str(Path(__file__).absolute().parent)
"""Path to hook directory to use with PyInstaller.
See :mod:`kivymd.tools.packaging.pyinstaller` for more information."""
def get_hook_dirs():
return [hooks_path]
def get_pyinstaller_tests():
return [os.path.join(kivymd.path, "tests", "pyinstaller")]
if __name__ == "__main__":
print(hooks_path)
print(get_hook_dirs())
print(get_pyinstaller_tests())

View file

@ -0,0 +1,42 @@
"""
PyInstaller hook for KivyMD
===========================
Adds fonts, images and KV files to package.
All modules from uix directory are added by Kivy hook.
"""
import os
from pathlib import Path
import kivymd
datas = [
# Add `.ttf` files from the `kivymd/fonts` directory.
(
kivymd.fonts_path,
str(Path("kivymd").joinpath(Path(kivymd.fonts_path).name)),
),
# Add files from the `kivymd/images` directory.
(
kivymd.images_path,
str(Path("kivymd").joinpath(Path(kivymd.images_path).name)),
),
]
# Add `.kv. files from the `kivymd/uix` directory.
for path_to_kv_file in Path(kivymd.uix_path).glob("**/*.kv"):
datas.append(
(
str(Path(path_to_kv_file).parent.joinpath("*.kv")),
str(
Path("kivymd").joinpath(
"uix",
str(Path(path_to_kv_file).parent).split(
str(Path("kivymd").joinpath("uix")) + os.sep
)[1],
)
),
)
)