mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-20 09:29:24 +01:00
supybot-test: Simplify impl of --exclude.
This commit is contained in:
parent
3eb20adaf2
commit
73b604f875
@ -34,6 +34,7 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import shutil
|
import shutil
|
||||||
|
import fnmatch
|
||||||
started = time.time()
|
started = time.time()
|
||||||
|
|
||||||
import supybot
|
import supybot
|
||||||
@ -164,12 +165,16 @@ if __name__ == '__main__':
|
|||||||
world.disableMultiprocessing = options.disableMultiprocessing
|
world.disableMultiprocessing = options.disableMultiprocessing
|
||||||
|
|
||||||
# This must go before checking for args, of course.
|
# This must go before checking for args, of course.
|
||||||
|
if options.excludePlugins:
|
||||||
|
exclusionPattern = re.compile('|'.join(
|
||||||
|
fnmatch.translate(pat) for pat in options.excludePlugins
|
||||||
|
))
|
||||||
|
else:
|
||||||
|
exclusionPattern = None
|
||||||
for pluginDir in options.pluginsDirs:
|
for pluginDir in options.pluginsDirs:
|
||||||
for name in glob.glob(os.path.join(pluginDir, '*')):
|
for name in glob.glob(os.path.join(pluginDir, '*')):
|
||||||
#print '***', name
|
if (exclusionPattern is None or not exclusionPattern.match(name)) \
|
||||||
if not any(map(lambda x:name in x,
|
and os.path.isdir(name):
|
||||||
map(glob.glob, options.excludePlugins))) and \
|
|
||||||
os.path.isdir(name):
|
|
||||||
args.append(name)
|
args.append(name)
|
||||||
|
|
||||||
if not args:
|
if not args:
|
||||||
|
Loading…
Reference in New Issue
Block a user