2019-12-16 16:52:59 -06:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
import sys
|
2014-10-27 16:29:04 -06:00
|
|
|
import application
|
|
|
|
import platform
|
2019-12-16 16:52:59 -06:00
|
|
|
import os
|
2021-07-07 01:41:08 -05:00
|
|
|
from cx_Freeze import setup, Executable, winmsvcr
|
2016-05-07 17:08:40 -05:00
|
|
|
from requests import certs
|
2014-10-27 16:29:04 -06:00
|
|
|
|
|
|
|
def get_architecture_files():
|
2021-06-16 16:18:41 -05:00
|
|
|
if platform.architecture()[0][:2] == "32":
|
2021-11-15 06:04:18 -06:00
|
|
|
return ["../windows-dependencies/x86/oggenc2.exe", "../windows-dependencies/x86/bootstrap.exe", "../windows-dependencies/x86/libvlc.dll", "../windows-dependencies/x86/libvlccore.dll", "../windows-dependencies/x86/plugins", ["../windows-dependencies/dictionaries", "lib/enchant/data/mingw32/share/enchant/hunspell"], ["../windows-dependencies/x86/Microsoft.VC142.CRT", "."], ["../windows-dependencies/x86/Microsoft.VC142.MFC", "."], ["../windows-dependencies/x86/Microsoft.VC142.MFCLOC", "."], ["../windows-dependencies/x86/ucrt", "."]]
|
2021-06-16 16:18:41 -05:00
|
|
|
elif platform.architecture()[0][:2] == "64":
|
2021-11-15 06:04:18 -06:00
|
|
|
return ["../windows-dependencies/x64/oggenc2.exe", "../windows-dependencies/x64/bootstrap.exe", "../windows-dependencies/x64/libvlc.dll", "../windows-dependencies/x64/libvlccore.dll", "../windows-dependencies/x64/plugins", ["../windows-dependencies/dictionaries", "lib/enchant/data/mingw64/share/enchant/hunspell"], ["../windows-dependencies/x64/Microsoft.VC142.CRT", "."], ["../windows-dependencies/x64/Microsoft.VC142.MFC", "."], ["../windows-dependencies/x64/Microsoft.VC142.MFCLOC", "."], ["../windows-dependencies/x64/ucrt", "."]]
|
2014-10-27 16:29:04 -06:00
|
|
|
|
2019-12-16 16:52:59 -06:00
|
|
|
def find_sound_lib_datafiles():
|
2021-06-16 16:18:41 -05:00
|
|
|
import os
|
|
|
|
import platform
|
|
|
|
import sound_lib
|
|
|
|
path = os.path.join(sound_lib.__path__[0], 'lib')
|
|
|
|
if platform.architecture()[0] == '32bit' or platform.system() == 'Darwin':
|
|
|
|
arch = 'x86'
|
|
|
|
else:
|
|
|
|
arch = 'x64'
|
|
|
|
dest_dir = os.path.join('sound_lib', 'lib', arch)
|
|
|
|
source = os.path.join(path, arch)
|
|
|
|
return (source, dest_dir)
|
2019-12-16 16:52:59 -06:00
|
|
|
|
|
|
|
def find_accessible_output2_datafiles():
|
2021-06-16 16:18:41 -05:00
|
|
|
import os
|
|
|
|
import accessible_output2
|
|
|
|
path = os.path.join(accessible_output2.__path__[0], 'lib')
|
|
|
|
dest_dir = os.path.join('accessible_output2', 'lib')
|
|
|
|
return (path, dest_dir)
|
2019-12-16 16:52:59 -06:00
|
|
|
|
|
|
|
base = None
|
|
|
|
if sys.platform == 'win32':
|
|
|
|
base = 'Win32GUI'
|
|
|
|
|
|
|
|
build_exe_options = dict(
|
2021-06-16 16:18:41 -05:00
|
|
|
build_exe="dist",
|
|
|
|
optimize=1,
|
|
|
|
includes=["enchant.tokenize.en"], # This is not handled automatically by cx_freeze.
|
2021-07-07 01:41:08 -05:00
|
|
|
include_msvcr=False,
|
2021-06-16 16:18:41 -05:00
|
|
|
replace_paths = [("*", "")],
|
2023-04-13 12:55:43 -06:00
|
|
|
include_files=["icon.ico", "app-configuration.defaults", "mastodon.defaults", "keymaps", "locales", "sounds", "documentation", find_sound_lib_datafiles(), find_accessible_output2_datafiles()]+get_architecture_files(),
|
2021-06-16 16:18:41 -05:00
|
|
|
packages=["wxUI"],
|
2021-10-29 10:58:30 -05:00
|
|
|
bin_path_excludes=["C:\\Program Files", "C:\Program Files (x86)"],
|
2021-06-16 16:18:41 -05:00
|
|
|
)
|
2019-12-16 16:52:59 -06:00
|
|
|
|
|
|
|
executables = [
|
2021-10-29 10:58:30 -05:00
|
|
|
Executable('main.py', base=base, target_name="twblue")
|
2019-12-16 16:52:59 -06:00
|
|
|
]
|
|
|
|
|
2021-07-07 01:41:08 -05:00
|
|
|
winmsvcr.FILES = ()
|
|
|
|
winmsvcr.FILES_TO_DUPLICATE = ()
|
2019-12-16 16:52:59 -06:00
|
|
|
setup(name=application.name,
|
|
|
|
version=application.version,
|
|
|
|
description=application.description,
|
|
|
|
options = {"build_exe": build_exe_options},
|
|
|
|
executables=executables
|
|
|
|
)
|