generated from zenustech/zeno_addon_wizard
-
Notifications
You must be signed in to change notification settings - Fork 5
/
dist.py
executable file
·47 lines (36 loc) · 1.42 KB
/
dist.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
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env python3
import os
import sys
import time
import shutil
import subprocess
if sys.platform == 'win32':
os_name = 'windows'
elif sys.platform == 'linux':
os_name = 'linux'
else:
raise AssertionError('not supported platform: {}'.format(sys.platform))
version = int(time.strftime('%Y')), int(time.strftime('%m')), int(time.strftime('%d'))
version = '{}.{}.{}'.format(*version)
print('==> release version={} os_name={}'.format(version, os_name))
if os_name == 'linux':
print('==> copying linux shared libraries')
subprocess.check_call([sys.executable, 'scripts/linux_dist_helper.py'])
elif os_name == 'windows':
print('==> removing windows static libraries')
subprocess.check_call([sys.executable, 'scripts/windows_dist_helper.py'])
print('==> creating packaging directory')
shutil.rmtree('dist', ignore_errors=True)
os.mkdir('dist')
shutil.copytree('zenoblend', 'dist/zenoblend')
print('==> appending version informations')
with open('dist/zenoblend/__init__.py', 'r') as f:
content = f.read()
content = content.replace("'version': (0, 0, 0)",
"'version': ({}, {}, {})".format(*version.split('.')))
with open('dist/zenoblend/__init__.py', 'w') as f:
f.write(content)
zipname = 'dist/zenoblend-{}-{}'.format(os_name, version)
print('==> creating zip archive at {}'.format(zipname))
shutil.make_archive(zipname, 'zip', 'dist', verbose=1)
print('==> done with zip archive {}.zip'.format(zipname))