diff --git a/main.py b/main.py new file mode 100644 index 0000000..8518858 --- /dev/null +++ b/main.py @@ -0,0 +1 @@ +import sbapp.main \ No newline at end of file diff --git a/sbapp/main.py b/sbapp/main.py index a8446c2..aa7ca6c 100644 --- a/sbapp/main.py +++ b/sbapp/main.py @@ -6118,3 +6118,6 @@ def run(): if __name__ == "__main__": run() + +if __name__ == "sbapp.main": + run() \ No newline at end of file diff --git a/sbapp/sideband/core.py b/sbapp/sideband/core.py index 137dc8d..48ce9ee 100644 --- a/sbapp/sideband/core.py +++ b/sbapp/sideband/core.py @@ -178,19 +178,21 @@ class SidebandCore(): self.cache_dir = self.app_dir+"/cache" self.rns_configdir = None + + core_path = os.path.abspath(__file__) + if "core.pyc" in core_path: + core_path = core_path.replace("core.pyc", "core.py") + if RNS.vendor.platformutils.is_android(): self.app_dir = android_app_dir+"/io.unsigned.sideband/files/" self.cache_dir = self.app_dir+"/cache" self.rns_configdir = self.app_dir+"/app_storage/reticulum" self.asset_dir = self.app_dir+"/app/assets" elif RNS.vendor.platformutils.is_darwin(): - core_path = os.path.abspath(__file__) self.asset_dir = core_path.replace("/sideband/core.py", "/assets") elif RNS.vendor.platformutils.get_platform() == "linux": - core_path = os.path.abspath(__file__) self.asset_dir = core_path.replace("/sideband/core.py", "/assets") elif RNS.vendor.platformutils.is_windows(): - core_path = os.path.abspath(__file__) self.asset_dir = core_path.replace("\\sideband\\core.py", "\\assets") else: self.asset_dir = plyer.storagepath.get_application_dir()+"/sbapp/assets" diff --git a/sideband.spec b/sideband.spec new file mode 100644 index 0000000..eb01ad4 --- /dev/null +++ b/sideband.spec @@ -0,0 +1,67 @@ +# -*- mode: python ; coding: utf-8 -*- + +from kivy_deps import sdl2, glew + +a = Analysis( + ['main.py'], + pathex=[], + binaries=[], + datas=[], + hiddenimports=[], + hookspath=[], + hooksconfig={}, + runtime_hooks=[], + excludes=[], + noarchive=False, + optimize=0, +) +pyz = PYZ(a.pure) + +def extra_datas(mydir): + def rec_glob(p, files): + import os + import glob + for d in glob.glob(p): + if os.path.isfile(d): + files.append(d) + rec_glob("%s/*" % d, files) + files = [] + rec_glob("%s/*" % mydir, files) + extra_datas = [] + for f in files: + extra_datas.append((f, f, 'DATA')) + + return extra_datas + +a.datas += extra_datas('sbapp') +a.datas += extra_datas('RNS') +a.datas += extra_datas('LXMF') + +exe = EXE( + pyz, + a.scripts, + [], + exclude_binaries=True, + name='main', + debug=False, + bootloader_ignore_signals=False, + strip=False, + upx=True, + console=True, + disable_windowed_traceback=False, + argv_emulation=False, + target_arch=None, + codesign_identity=None, + entitlements_file=None, +) + +coll = COLLECT( + exe, + a.binaries, + a.datas, + *[Tree(p) for p in (sdl2.dep_bins + glew.dep_bins)], + strip=False, + upx=True, + upx_exclude=[], + name='main', +)