forked from ppizarror/pygame-menu
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.py
More file actions
38 lines (31 loc) · 1.1 KB
/
build.py
File metadata and controls
38 lines (31 loc) · 1.1 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
"""
pygame-menu
https://github.com/ppizarror/pygame-menu
BUILD
Build file.
"""
import os
import sys
assert len(sys.argv) == 2, 'Argument is required, usage: build.py pip/twine/gource'
mode = sys.argv[1].strip()
python = 'python3' if not sys.platform == 'win32' else 'py -3.8'
if mode == 'pip':
if os.path.isdir('dist'):
for k in os.listdir('dist'):
if 'pygame_menu-' in k or 'pygame-menu-' in k:
os.remove(f'dist/{k}')
if os.path.isdir('build'):
for k in os.listdir('build'):
if 'bdist.' in k or k == 'lib':
os.system(f'rm -rf build/{k}')
os.system(f'{python} setup.py sdist bdist_wheel')
elif mode == 'twine':
if os.path.isdir('dist'):
os.system(f'{python} -m twine upload dist/*')
else:
raise FileNotFoundError('Not distribution been found, execute build.py pip')
elif mode == 'gource':
os.system('gource -s 0.25 --title pygame-menu --disable-auto-rotate --key '
'--highlight-users --disable-bloom --multi-sampling -w --transparent --path ./')
else:
raise ValueError(f'Unknown mode {mode}')