Initial check-in
This commit is contained in:
10
tftpboot/firmware/mkregex.py
Executable file
10
tftpboot/firmware/mkregex.py
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env python
|
||||
from hachoir_regex import parse
|
||||
from os import listdir,walk,path
|
||||
from os.path import basename,join,isdir
|
||||
|
||||
rootdir = ".";
|
||||
for subdir in next(walk(rootdir))[1]:
|
||||
paths = listdir(subdir)
|
||||
as_regex = [parse(path) for path in paths]
|
||||
print "^{}$ /firmware/{}/\\1".format(reduce(lambda x, y: x | y, as_regex), basename(subdir))
|
Reference in New Issue
Block a user