Skip to content

Commit

Permalink
Fix Tribler Experimental build on all platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
Tribler Builder committed Apr 5, 2024
1 parent 64ad3b4 commit 62ec886
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 22 deletions.
Empty file added build/__init__.py
Empty file.
3 changes: 2 additions & 1 deletion build/debian/makedist_debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ python3 ./build/update_version.py -r .
python3 ./build/debian/update_metainfo.py -r .

# ----- Build binaries
python3 -m PyInstaller tribler.spec --log-level="${LOG_LEVEL}"
echo Building Tribler using Cx_Freeze
python3 setup.py build

# ----- Build dpkg
cp -r ./dist/tribler ./build/debian/tribler/usr/share/tribler
Expand Down
3 changes: 2 additions & 1 deletion build/mac/makedist_macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ python3 -m pip install --upgrade -r requirements-build.txt

# ----- Build

pyinstaller tribler.spec --log-level="${LOG_LEVEL}"
echo Building Tribler using Cx_Freeze
python3 setup.py build

mkdir -p dist/installdir
mv dist/$APPNAME.app dist/installdir
Expand Down
Empty file added build/win/__init__.py
Empty file.
3 changes: 1 addition & 2 deletions build/win/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,10 @@ def get_freeze_build_options():

# These packages will be included in the build
sys.path.insert(0, 'src')
sys.path.insert(0, 'pyipv8')
included_packages = [
"aiohttp_apispec",
"PIL",
"pkg_resources",
"pyipv8",
"pyqtgraph",
"requests",
"tribler.core",
Expand Down
3 changes: 1 addition & 2 deletions requirements-build.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
-r requirements.txt

PyInstaller==5.13.1; sys_platform == 'linux2' or sys_platform == 'linux'
cx_Freeze==6.15.16; sys_platform == 'win32'
cx_Freeze==6.15.16

setuptools==65.5.1; sys_platform == 'darwin'
text-unidecode==1.3; sys_platform == 'darwin'
Expand Down
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from setuptools import find_packages

from build import setup, setup_options, setup_executables
from build.win.build import setup, setup_options, setup_executables


def read_version_from_file(file_path):
Expand All @@ -21,6 +21,8 @@ def read_version_from_file(file_path):

def read_requirements(file_name, directory='.'):
file_path = os.path.join(directory, file_name)
if not os.path.exists(file_path):
return []
requirements = []
with open(file_path, 'r', encoding='utf-8') as file:
for line in file:
Expand Down
19 changes: 4 additions & 15 deletions tribler.spec
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ import shutil
import sys

import aiohttp_apispec
import sentry_sdk

from PyInstaller.utils.hooks import collect_data_files, collect_submodules

root_dir = os.path.abspath(os.path.dirname(__name__))
src_dir = os.path.join(root_dir, "src")
sys.path.append(src_dir)

pyipv8_dir = os.path.join(root_dir, "pyipv8")
sys.path.append(pyipv8_dir)

from tribler.core.version import version_id

version_str = version_id.split('-')[0]
Expand All @@ -32,7 +35,6 @@ for file in os.listdir(os.path.join(src_dir, "tribler", "gui", "widgets")):
data_to_copy = [
(os.path.join(src_dir, "tribler", "gui", "qt_resources"), 'qt_resources'),
(os.path.join(src_dir, "tribler", "gui", "images"), 'images'),
(os.path.join(src_dir, "tribler", "gui", "i18n"), 'i18n'),
(os.path.join(src_dir, "tribler", "core"), 'tribler_source/tribler/core'),
(os.path.join(src_dir, "tribler", "gui"), 'tribler_source/tribler/gui'),
(os.path.join(root_dir, "build", "win", "resources"), 'tribler_source/resources'),
Expand Down Expand Up @@ -69,18 +71,6 @@ excluded_libs = ['wx', 'PyQt4', 'FixTk', 'tcl', 'tk', '_tkinter', 'tkinter', 'Tk
# Pony dependencies; each packages need to be added separatedly; added as hidden import
pony_deps = ['pony', 'pony.orm', 'pony.orm.dbproviders', 'pony.orm.dbproviders.sqlite']


# Sentry hidden imports
def get_sentry_hooks():
package = sentry_sdk.integrations
sentry_hooks = ['sentry_sdk', 'sentry_sdk.integrations']
for _, modname, _ in pkgutil.walk_packages(path=package.__path__,
prefix=package.__name__ + '.',
onerror=lambda x: None):
sentry_hooks.append(modname)
return sentry_hooks


# Hidden imports
hiddenimports = [
'csv',
Expand All @@ -105,7 +95,6 @@ hiddenimports = [
]
hiddenimports += widget_files
hiddenimports += pony_deps
hiddenimports += get_sentry_hooks()

# Fix for issue: Could not load a pixbuf from icon theme.
# Unrecognized image file format (gdk-pixbuf-error-quark, 3).
Expand Down

0 comments on commit 62ec886

Please sign in to comment.