This repository has been archived by the owner on Feb 7, 2022. It is now read-only.
forked from purduesigbots/pros-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.py
77 lines (65 loc) · 2.88 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
67
68
69
70
71
72
73
74
75
76
77
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
sentry_integrations = [
'django', 'spark', 'aiohttp', 'argv', 'asgi', 'atexit', 'aws_lambda', 'beam',
'boto3', 'bottle', 'celery', 'chalice', 'dedupe', 'excepthook', 'executing',
'falcon', 'flask', 'gcp', 'gnu_backtrace', 'logging', 'modules', 'pure_eval',
'pyramid', 'redis', 'rq', 'sanic', 'serverless', 'sqlalchemy', 'stdlib',
'threading', 'tornado', 'trytond', 'wsgi'
]
build_exe_options = {
'packages': ['ssl', 'requests', 'idna'] +
[f'sentry_sdk.integrations.{integration}' for integration in sentry_integrations] +
[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',
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='pros_development@cs.purdue.edu',
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', target_name=f'pros{extension}'),
Executable('pros/cli/main.py', target_name=f'prosv5{extension}'),
Executable('pros/cli/compile_commands/intercept-cc.py', target_name=f'intercept-cc{extension}'),
Executable('pros/cli/compile_commands/intercept-cc.py', target_name=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, '.')