forked from Tribler/tribler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtribler.spec
87 lines (71 loc) · 3.27 KB
/
tribler.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# -*- mode: python -*-
block_cipher = None
import os
import sys
import shutil
sys.path.insert(0, os.getcwdu())
from Tribler.Core.version import version_id
version_str = version_id.split('-')[0]
widget_files = []
for file in os.listdir("TriblerGUI/widgets"):
if file.endswith(".py"):
widget_files.append('TriblerGUI.widgets.%s' % file[:-3])
data_to_copy = [('electrum', 'electrum'), ('TriblerGUI/qt_resources', 'qt_resources'), ('TriblerGUI/images', 'images'), ('twisted', 'twisted'), ('Tribler', 'tribler_source/Tribler'), ('logger.conf', '.')]
if sys.platform.startswith('darwin'):
data_to_copy += [('/Applications/VLC.app/Contents/MacOS/lib', 'vlc/lib'), ('/Applications/VLC.app/Contents/MacOS/plugins', 'vlc/plugins')]
# Create the right version info in the Info.plist file
with open('Tribler/Main/Build/Mac/Info.plist', 'r') as f:
content = f.read()
content = content.replace('__VERSION__', version_str)
os.unlink('Tribler/Main/Build/Mac/Info.plist')
with open('Tribler/Main/Build/Mac/Info.plist', 'w') as f:
f.write(content)
# We use plyvel on Windows since leveldb is unable to deal with unicode paths
excluded_libs = ['wx', 'leveldb'] if sys.platform == 'win32' else ['wx']
electrum_files = ['electrum/electrum', 'electrum/lib/util.py', 'electrum/lib/wallet.py', 'electrum/lib/simple_config.py', 'electrum/lib/bitcoin.py', 'electrum/lib/dnssec.py', 'electrum/lib/commands.py']
a = Analysis(['run_tribler.py'] + electrum_files,
pathex=['/Users/martijndevos/Documents/tribler'],
binaries=None,
datas=data_to_copy,
hiddenimports=['csv', 'socks'] + widget_files,
hookspath=[],
runtime_hooks=[],
excludes=excluded_libs,
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
# Add libsodium.dylib on OS X
if sys.platform == 'darwin':
a.binaries = a.binaries - TOC([('/usr/local/lib/libsodium.so', None, None),])
a.binaries = a.binaries + TOC([('libsodium.dylib', '/usr/local/lib/libsodium.dylib', None),])
exe = EXE(pyz,
a.scripts,
exclude_binaries=True,
name='tribler',
debug=False,
strip=False,
upx=True,
console=True,
icon='Tribler/Main/Build/Win/tribler.ico')
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
name='tribler')
app = BUNDLE(coll,
name='tribler.app',
icon='Tribler/Main/Build/Mac/tribler.icns',
bundle_identifier='nl.tudelft.tribler',
info_plist={'NSHighResolutionCapable': 'True', 'CFBundleInfoDictionaryVersion': 1.0, 'CFBundleVersion': version_str, 'CFBundleShortVersionString': version_str},
console=True)
# Remove libvlc - conflicts on Windows
if sys.platform == 'win32':
os.remove(os.path.join(DISTPATH, 'tribler', 'libvlc.dll'))
os.remove(os.path.join(DISTPATH, 'tribler', 'libvlccore.dll'))
# Replace the Info.plist file on MacOS
if sys.platform == 'darwin':
shutil.copy('Tribler/Main/Build/Mac/Info.plist', 'dist/Tribler.app/Contents/Info.plist')