summaryrefslogtreecommitdiff
path: root/desktop/install/pyinstaller.spec
blob: 24c0ed0700da4c08a5d6caf1cad5b163c4c45623 (plain)
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# -*- mode: python -*-

import os
import platform
from distutils.sysconfig import get_python_lib

p = platform.system()

version = open("share/version.txt").read().strip()

paths = ["."]
if p == "Windows":
    paths.append(os.path.join(get_python_lib(), "PyQt5", "Qt", "bin"))
    paths.append(
        os.path.join(
            os.path.abspath(os.sep),
            "Program Files (x86)",
            "Windows Kits",
            "10",
            "bin",
            "x86",
        )
    )
    paths.append(
        os.path.join(
            os.path.abspath(os.sep),
            "Program Files (x86)",
            "Windows Kits",
            "10",
            "bin",
            "x64",
        )
    )
    paths.append(
        os.path.join(
            os.path.abspath(os.sep),
            "Program Files (x86)",
            "Windows Kits",
            "10",
            "Redist",
            "ucrt",
            "DLLs",
            "x86",
        )
    )
    paths.append(
        os.path.join(
            os.path.abspath(os.sep),
            "Program Files (x86)",
            "Windows Kits",
            "10",
            "Redist",
            "ucrt",
            "DLLs",
            "x64",
        )
    )

a = Analysis(
    ["scripts/onionshare-pyinstaller"],
    pathex=paths,
    binaries=None,
    datas=[
        ("../share/version.txt", "share"),
        ("../share/wordlist.txt", "share"),
        ("../share/torrc_template", "share"),
        ("../share/torrc_template-obfs4", "share"),
        ("../share/torrc_template-meek_lite_azure", "share"),
        ("../share/images/*", "share/images"),
        ("../share/locale/*", "share/locale"),
        ("../share/static/*", "share/static"),
        ("../share/templates/*", "share/templates"),
        ("../share/static/css/*", "share/static/css"),
        ("../share/static/img/*", "share/static/img"),
        ("../share/static/js/*", "share/static/js"),
        ("../install/licenses/*", "licenses"),
    ],
    hiddenimports=["engineio.async_drivers.threading"],
    hookspath=[],
    runtime_hooks=[],
    win_no_prefer_redirects=False,
    win_private_assemblies=False,
    cipher=None,
)

pyz = PYZ(a.pure, a.zipped_data, cipher=None)

# Show console in dev releases, don't show console in production releases
console = "dev" in version

exe = EXE(
    pyz,
    a.scripts,
    exclude_binaries=True,
    name="onionshare-gui",
    debug=False,
    strip=False,
    upx=True,
    console=console,
)

coll = COLLECT(
    exe, a.binaries, a.zipfiles, a.datas, strip=False, upx=True, name="onionshare"
)

if p == "Darwin":
    app = BUNDLE(
        coll,
        name="OnionShare.app",
        icon="onionshare.icns",
        bundle_identifier="com.micahflee.onionshare",
        info_plist={
            "CFBundleShortVersionString": version,
            "NSHighResolutionCapable": "True",
        },
    )