-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.py
43 lines (34 loc) · 999 Bytes
/
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
"""Simple Build Script to create a python package wheel. """
# Python Dependencies
import os
import shutil
import subprocess
project_dir = os.path.split(os.path.abspath(__file__))[0]
package_name = "AirtablePy"
def main():
# Cleanup before build
try:
shutil.rmtree('dist')
except FileNotFoundError:
pass
try:
shutil.rmtree('build')
except FileNotFoundError:
pass
try:
shutil.rmtree(f'{package_name}/{package_name}.egg-info')
except FileNotFoundError:
pass
# Build
subprocess.run(["python", "setup.py", "sdist", "bdist_wheel"])
# Cleanup after
shutil.rmtree('build')
shutil.rmtree(f'{package_name}.egg-info')
dist_path = os.path.join(project_dir, 'dist')
non_wheels = [os.path.join(dist_path, f)
for f in os.listdir(dist_path)
if os.path.splitext(f)[-1] != '.whl']
for fp in non_wheels:
os.remove(fp)
if __name__ == '__main__':
main()