-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclean
More file actions
executable file
·57 lines (43 loc) · 1.17 KB
/
clean
File metadata and controls
executable file
·57 lines (43 loc) · 1.17 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env python3
# This file is placed in the Public Domain.
#
# pylint: disable=C0116
"clean directories"
import os
import sys
SKIP = ["env", ".git"]
def loop(path, txt):
old = os.getcwd()
os.chdir(path)
for fnn in os.listdir(path):
if fnn in SKIP:
continue
old = os.getcwd()
fpath = os.path.abspath(os.path.join(path, fnn))
if os.path.isdir(fpath):
loop(fpath, txt)
if not os.path.isdir(fpath):
continue
os.chdir(fpath)
popen(txt)
os.chdir(old)
#os.chdir("..")
os.chdir(old)
def popen(txt):
for line in os.popen(txt).readlines():
print(line.rstrip())
sys.stdout.flush()
def main():
popen("rm -fRv DEAD* build dist MANIFEST *.egg-info *.whl")
popen("rm -fRv .pytest_cache .test __pycache__")
popen("rm -fRv lib/*.egg-info")
popen("rm -fRv .*~ *~")
popen('rm -fRv docs/evrm*.rst')
if "-f" in sys.argv:
popen("rm -fR html store env")
if "-ff" in sys.argv:
popen("rm -fR ~/.cache/pip")
loop(".", "rm -fRv *~")
loop(".", "rm -fRv __pycache__")
if __name__ == "__main__":
main()