-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.py
34 lines (28 loc) · 1.08 KB
/
build.py
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
import os
import sys
import glob
from zipfile import ZipFile
if len(sys.argv) == 2:
version = int(sys.argv[1])
else:
version = int(input('var version: '))
cslistName = 'ADD_ME.cslist'
varName = 'Yoooi.ToySerialController.{}.var'.format(version)
zipPath = 'Custom\\Scripts\\Yoooi\\ToySerialController\\'
print('Creating "{}"'.format(cslistName))
with open('ADD_ME.cslist', 'w+', encoding='utf-8') as cslist:
for file in sorted(glob.glob('**/*.cs', recursive=True)):
if not file.startswith('src') and not file.startswith('lib'):
continue
cslist.write('{}\n'.format(file))
print('Adding "{}"'.format(file))
print('Creating "{}"'.format(varName))
with open(cslistName, 'r', encoding = 'utf-8') as cslist:
with ZipFile(varName, 'w') as var:
var.write('meta.json')
var.write('LICENSE.md')
var.write(cslistName, os.path.join(zipPath, cslistName))
for file in [x.strip() for x in cslist]:
var.write(file, os.path.join(zipPath, file))
for file in var.namelist():
print('Adding "{}"'.format(file))