1212
More work on configs. · Shariffintech/java2python@ab3c58b · GitHub
Skip to content

Commit ab3c58b

Browse files
author
Troy Melhase
committed
More work on configs.
1 parent d0ff024 commit ab3c58b

File tree

4 files changed

+32
-34
lines changed

4 files changed

+32
-34
lines changed

java2python/config/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ 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
1715

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

test/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ parsers:
3535

3636

3737
%.py: %.class
38-
@$(j2py) $(addsuffix .java, $(basename $@)) $@ -c configs/__init__.py -d configs
38+
@$(j2py) $(addsuffix .java, $(basename $@)) $@ -c configs/defaults.py -d configs
3939

4040
%: %.py
4141
@bash -c "diff -q <($(python) $(addsuffix .py, $@)) <(java -ea $@)" && echo "[PASS] $@"

test/configs/__init__.py

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +0,0 @@
1-
#!/usr/bin/env python
2-
# -*- coding: utf-8 -*-
3-
from java2python.config import default
4-
5-
6-
modulePrologueHandlers = default.modulePrologueHandlers + [
7-
'from configs.overloading import overloaded',
8-
'from abc import ABCMeta, abstractmethod',
9-
'import zope.interface',
10-
]
11-
12-
13-
outputSubs = [
14-
(r'(.*?)\.getMessage\(\)', r'\1.message'),
15-
(r'(.*?)(\w+?)\.length(.*)', r'\1len(\2)\3'),
16-
(r'assertEquals', 'self.assertEquals'),
17-
(r'## import junit.framework', 'from unittest import *'),
18-
(r'(.*?)\.getClass\(\)', r'\1.__class__'),
19-
(r'(.*?)\.getName\(\)', r'\1.__name__'),
20-
(r'(.*?)\.getInterfaces\(\)', r'\1.__bases__'),
21-
22-
(r'(.*?)\.fooProp\(\)', r'\1.fooProp'),
23-
(r'(.*?)\.fooProp\((.+)\)', r'\1.fooProp = \2'),
24-
25-
(r'(.*?)lock(.*?) = object\(\)', r'\1lock\2 = Lock()'),
26-
27-
## these two fudge something that should be handled in parsing
28-
(r'(.*?)StaticInner\(\)', r'\1cls.StaticInner()'),
29-
(r'(.*?)outer\.cls', r'\1outer'),
30-
(r'from java\.util import \*', ''),
31-
]

test/configs/defaults.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
from java2python.config import default
4+
5+
6+
modulePrologueHandlers = default.modulePrologueHandlers + [
7+
'from configs.overloading import overloaded',
8+
'from abc import ABCMeta, abstractmethod',
9+
'import zope.interface',
10+
]
11+
12+
13+
outputSubs = [
14+
(r'(.*?)\.getMessage\(\)', r'\1.message'),
15+
(r'(.*?)(\w+?)\.length(.*)', r'\1len(\2)\3'),
16+
(r'assertEquals', 'self.assertEquals'),
17+
(r'## import junit.framework', 'from unittest import *'),
18+
(r'(.*?)\.getClass\(\)', r'\1.__class__'),
19+
(r'(.*?)\.getName\(\)', r'\1.__name__'),
20+
(r'(.*?)\.getInterfaces\(\)', r'\1.__bases__'),
21+
22+
(r'(.*?)\.fooProp\(\)', r'\1.fooProp'),
23+
(r'(.*?)\.fooProp\((.+)\)', r'\1.fooProp = \2'),
24+
25+
(r'(.*?)lock(.*?) = object\(\)', r'\1lock\2 = Lock()'),
26+
27+
## these two fudge something that should be handled in parsing
28+
(r'(.*?)StaticInner\(\)', r'\1cls.StaticInner()'),
29+
(r'(.*?)outer\.cls', r'\1outer'),
30+
(r'from java\.util import \*', ''),
31+
]

0 commit comments

Comments
 (0)