forked from purduesigbots/pros-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.py
66 lines (55 loc) · 2.32 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
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
import os
import sys
from distutils.util import get_platform
import requests.certs
from cx_Freeze import Executable, setup
from install_requires import install_requires as install_reqs
import pros.cli.main
build_exe_options = {
'packages': ['ssl', 'requests', 'idna'] + [f'pros.cli.{root_source}' for root_source in pros.cli.main.root_sources],
"include_files": [(requests.certs.where(), 'cacert.pem')],
'excludes': ['pip', 'distutils'], # optimization excludes
'constants': [
f'{key}=\'{value}\'' for key, value in {
'CLI_VERSION': open('version').read().strip(),
'FROZEN_PLATFORM_V1': 'Windows64' if get_platform() == 'win-amd64' else 'Windows86'
}.items()
],
'include_msvcr': True
# 'zip_include_packages': [],
# 'zip_exclude_packages': []
}
build_mac_options = {
'bundle_name': 'PROS CLI',
'iconfile': 'pros.icns'
}
if os.environ.get('MAC_SIGNING_IDENTITY') is not None:
build_mac_options['codesign_identity'] = os.environ.get('MAC_SIGNING_IDENTITY')
build_mac_options['codesign_deep'] = True
modules = ['pros']
if sys.platform == 'win32':
extension = '.exe'
else:
extension = ''
setup(
name='pros-cli-v5',
version=open('pip_version').read().strip(),
packages=modules,
url='https://github.com/purduesigbots/pros-cli',
license='MPL-2.0',
author='Purdue ACM Sigbots',
author_email='[email protected]',
description='Command Line Interface for managing PROS projects',
options={"build_exe": build_exe_options, 'bdist_mac': build_mac_options},
install_requires=install_reqs,
executables=[Executable('pros/cli/main.py', targetName=f'prosv5{extension}'),
Executable('pros/cli/compile_commands/intercept-cc.py', targetName=f'intercept-cc{extension}'),
Executable('pros/cli/compile_commands/intercept-cc.py', targetName=f'intercept-c++{extension}')]
)
if sys.argv[1] == 'build_exe':
import distutils.util
build_dir = './build/exe.{}-{}.{}'.format(distutils.util.get_platform(), sys.version_info[0], sys.version_info[1])
import shutil
import platform
shutil.make_archive('pros_cli-{}-{}-{}'.format(open('version').read().strip(), platform.system()[0:3].lower(),
platform.architecture()[0]), 'zip', build_dir, '.')