forked from lumapu/ahoy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreduceGxEPD2.py
41 lines (32 loc) · 969 Bytes
/
reduceGxEPD2.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
import os
import subprocess
import glob
Import("env")
def rmDirWithFiles(path):
if os.path.isdir(path):
for f in glob.glob(path + "/*"):
os.remove(f)
os.rmdir(path)
def clean(libName):
# save current wd
start = os.getcwd()
if os.path.exists('.pio/libdeps/' + env['PIOENV'] + '/' + libName) == False:
print("path '" + '.pio/libdeps/' + env['PIOENV'] + '/' + libName + "' does not exist")
return
os.chdir('.pio/libdeps/' + env['PIOENV'] + '/' + libName)
os.chdir('src/')
types = ('epd/*.h', 'epd/*.cpp') # the tuple of file types
files = []
for t in types:
files.extend(glob.glob(t))
for f in files:
if f.count('GxEPD2_150_BN') == 0:
os.remove(f)
rmDirWithFiles("epd3c")
rmDirWithFiles("epd4c")
rmDirWithFiles("epd7c")
rmDirWithFiles("gdeq")
rmDirWithFiles("gdey")
rmDirWithFiles("it8951")
os.chdir(start)
clean("GxEPD2")