Repository navigation
Expand file tree
/
Copy pathPackageScript
More file actions
67 lines (60 loc) · 2.23 KB
/
Copy pathPackageScript
File metadata and controls
67 lines (60 loc) · 2.23 KB
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
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os
builder.SetBuildFolder('package')
if len(MMSPlugin.binaries) != 1:
raise Exception('CS2AC must produce exactly one plugin binary.')
cxx = MMSPlugin.sdk_target.cxx
platform_folder = {
'windows': 'win64',
'linux': 'linuxsteamrt64',
}[cxx.target.platform]
addons_root = os.path.join('game', 'csgo', 'addons')
cfg_root = os.path.join('game', 'csgo', 'cfg')
plugin_root = os.path.join(addons_root, 'cs2ac')
bin_path = os.path.join(plugin_root, 'bin', platform_folder)
metamod_path = os.path.join(addons_root, 'metamod')
gamedata_path = os.path.join(plugin_root, 'gamedata')
licenses_path = os.path.join(plugin_root, 'licenses')
builder.AddFolder(bin_path)
builder.AddFolder(metamod_path)
gamedata_folder = builder.AddFolder(gamedata_path)
builder.AddFolder(licenses_path)
cfg_folder = builder.AddFolder(cfg_root)
task = MMSPlugin.binaries[0]
extension = os.path.splitext(os.path.basename(task.binary.path))[1]
builder.AddCopy(task.binary, os.path.join(bin_path, 'cs2ac' + extension))
builder.AddCopy(
os.path.join(builder.sourcePath, 'gamedata', 'cs2ac.games.txt'),
gamedata_folder
)
builder.AddCopy(
os.path.join(builder.sourcePath, 'cfg', 'cs2ac.cfg'),
cfg_folder
)
builder.AddCopy(
os.path.join(builder.sourcePath, 'THIRD_PARTY_NOTICES.md'),
os.path.join(plugin_root, 'THIRD_PARTY_NOTICES.md')
)
for source, target in (
('LICENSE', 'CS2AC-AGPL-3.0.txt'),
(os.path.join('licenses', 'CLIENTCVARVALUE-GPL-3.0.txt'),
'CLIENTCVARVALUE-GPL-3.0.txt'),
(os.path.join('licenses', 'DYNLIBUTILS-MIT.txt'), 'DYNLIBUTILS-MIT.txt'),
(os.path.join('licenses', 'CS2KZ-AGPL-3.0.txt'), 'CS2KZ-AGPL-3.0.txt'),
(os.path.join('licenses', 'FUNCHOOK.txt'), 'FUNCHOOK.txt'),
(os.path.join('licenses', 'DISTORM.txt'), 'DISTORM.txt'),
(os.path.join('metamod-source', 'LICENSE.txt'), 'METAMOD-SOURCE.txt'),
(os.path.join('hl2sdk-cs2', 'thirdparty', 'protobuf-3.21.8', 'LICENSE'),
'PROTOBUF.txt'),
):
builder.AddCopy(
os.path.join(builder.sourcePath, source),
os.path.join(licenses_path, target)
)
vdf = '''"Metamod Plugin"
{{
\t"alias"\t"cs2ac"
\t"file"\t"addons/cs2ac/bin/{}/cs2ac"
}}
'''.format(platform_folder)
builder.AddOutputFile(os.path.join(metamod_path, 'cs2ac.vdf'), vdf.encode('utf-8'))