-
Notifications
You must be signed in to change notification settings - Fork 0
/
clean.py
41 lines (33 loc) · 893 Bytes
/
clean.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
"""
This module will mimic what
clean:
rm -rf dist/
rm -rf build/
rm -f shuttleasgi/*.c
rm -f shuttleasgi/*.so
rm -f shuttleasgi/*.pyd
does in a Makefile.
"""
import os
import shutil
def clean():
# Remove dist/ directory
if os.path.exists("dist/"):
shutil.rmtree("dist/")
# Remove build/ directory
if os.path.exists("build/"):
shutil.rmtree("build/")
# Remove shuttleasgi/*.c
for file in os.listdir("shuttleasgi/"):
if file.endswith(".c"):
os.remove(f"shuttleasgi/{file}")
# Remove shuttleasgi/*.so
for file in os.listdir("shuttleasgi/"):
if file.endswith(".so"):
os.remove(f"shuttleasgi/{file}")
# Remove shuttleasgi/*.pyd
for file in os.listdir("shuttleasgi/"):
if file.endswith(".pyd"):
os.remove(f"shuttleasgi/{file}")
if __name__ == "__main__":
clean()