X Tutup
Skip to content

Commit d0ff024

Browse files
author
Troy Melhase
committed
Moves back to multiple config dir handling. Adds some dummy config modules.
1 parent e527355 commit d0ff024

File tree

5 files changed

+11
-8
lines changed

5 files changed

+11
-8
lines changed

bin/j2py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,11 @@ def main(options):
7171
fileout = '%s.py' % (path.splitext(filein)[0])
7272

7373
configs = options.configs
74-
if options.configdir and not isinstance(filein, file):
75-
dirconfigname = configFromDir(filein, options.configdir)
76-
if path.exists(dirconfigname):
77-
configs.insert(0, dirconfigname)
74+
if options.configdirs and not isinstance(filein, file):
75+
for configdir in options.configdirs:
76+
dirname = configFromDir(filein, configdir)
77+
if path.exists(dirname):
78+
configs.insert(0, dirname)
7879
if options.includedefaults:
7980
configs.insert(0, 'java2python.config.default')
8081

@@ -183,11 +184,10 @@ def config(argv):
183184
metavar='OUTPUTFILE', default=None)
184185
add('-c', '--config', dest='configs',
185186
help='Use CONFIG file or module. May be repeated.',
186-
metavar='CONFIG', default=[],
187-
action='append')
188-
add('-d', '--configdir', dest='configdir',
187+
metavar='CONFIG', default=[], action='append')
188+
add('-d', '--configdir', dest='configdirs',
189189
help='Use DIR to match input filename with config filename.',
190-
metavar='DIR', default=None)
190+
metavar='DIR', default=[], action='append')
191191
add('-f', '--profile', dest='profile',
192192
help='Profile execution and print results to stderr.',
193193
default=False, action='store_true')
@@ -223,6 +223,7 @@ def config(argv):
223223
ns.inputfile = sys.stdin
224224
if ns.outputfile == '-':
225225
ns.outputfile = sys.stdout
226+
226227
configColors(ns.nocolor)
227228
configLogging(ns.loglevel)
228229
return ns

java2python/config/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ class Config(object):
1212

1313
def __init__(self, names):
1414
self.configs = [self.load(name) for name in names]
15+
for config in self.configs:
16+
print '## CONFIG', config
1517

1618
def every(self, key, default=None):
1719
""" Returns the value at the given key from each config module. """

test/altconfigs/Class10.py

Whitespace-only changes.

test/other_config_a.py

Whitespace-only changes.

test/other_config_b.py

Whitespace-only changes.

0 commit comments

Comments
 (0)
X Tutup