Skip to content
This repository has been archived by the owner on Apr 2, 2022. It is now read-only.

Commit

Permalink
Fixed linux build
Browse files Browse the repository at this point in the history
  • Loading branch information
maximilionus committed Aug 17, 2020
1 parent 69e54a8 commit a024dcc
Showing 1 changed file with 28 additions and 18 deletions.
46 changes: 28 additions & 18 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"""

from time import time
from os import pathsep, path
from sys import platform
from os import pathsep, path
from argparse import ArgumentParser

import PyInstaller.__main__
Expand All @@ -28,19 +28,26 @@

def build_client():
# TODO: Exclude server-side
if platform == 'win32':
icon = '--icon=./VectorMessenger/' + h.ICON_CLIENT_PATH[2:]
else:
icon = ''

ADD_FILES = (
f'--add-data=./VectorMessenger/data/ico{pathsep}./data/ico',
f'--add-data=./LICENSE{pathsep}.',
)
icon = '--icon=./VectorMessenger/' + h.ICON_CLIENT_PATH[2:]

HIDDEN_IMPORT = [
'pkg_resources.py2_warn'
]
if platform != 'win32':
# Fix of tkinter import for linux builds
# ! Remove when legacy gui completely removed
HIDDEN_IMPORT.extend(['tkinter', 'PIL._tkinter_finder'])
HIDDEN_IMPORT = [('--hidden-import=' + arg) for arg in HIDDEN_IMPORT]

ADD_FILES = [
f'./VectorMessenger/data/ico{pathsep}./data/ico',
f'./LICENSE{pathsep}.',
]
ADD_FILES = [('--add-data=' + arg) for arg in ADD_FILES]

PyInstaller.__main__.run([
'--name={}'.format("VM_Client"),
'--hidden-import=pkg_resources.py2_warn',
*HIDDEN_IMPORT,
'--windowed',
*ADD_FILES,
icon,
Expand All @@ -51,19 +58,22 @@ def build_client():

def build_server():
# TODO: Exclude client-side and encryption modules
if platform == 'win32':
icon = '--icon=./VectorMessenger/' + h.ICON_SERVER_PATH[2:]
else:
icon = ''
icon = '--icon=./VectorMessenger/' + h.ICON_SERVER_PATH[2:]

HIDDEN_IMPORT = [
'pkg_resources.py2_warn'
]
HIDDEN_IMPORT = [('--hidden-import=' + arg) for arg in HIDDEN_IMPORT]

ADD_FILES = (
f'--add-data=./VectorMessenger/data/ico{pathsep}./data/ico',
f'--add-data=./LICENSE{pathsep}.',
f'./VectorMessenger/data/ico{pathsep}./data/ico',
f'./LICENSE{pathsep}.',
)
ADD_FILES = [('--add-data=' + arg) for arg in ADD_FILES]

PyInstaller.__main__.run([
'--name={}'.format("VM_Server"),
'--hidden-import=pkg_resources.py2_warn',
*HIDDEN_IMPORT,
'--console',
*ADD_FILES,
icon,
Expand Down

0 comments on commit a024dcc

Please sign in to comment.