Skip to content

Commit 4b4073d

Browse files
committed
fixed import related bugs and bugs that appeared during the merge
1 parent 2a53fe4 commit 4b4073d

File tree

8 files changed

+16
-25
lines changed

8 files changed

+16
-25
lines changed

examples/libtest/I18N/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ def another_example(self):
1111
domains = []
1212

1313
import sys
14-
import domain
14+
import I18N.domain
1515
domains.append('domain')
16-
import domain.subdomain
16+
import I18N.domain.subdomain
1717
domains.append('domain.subdomain')
1818

1919
def set_locale(loc):

examples/libtest/b.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/sh
2-
C:/python26/python.exe ./load_issues.py
2+
C:/python27/python.exe ./load_issues.py
33
../../bin/pyjsbuild.py --no-compile-inplace --strict --dynamic '^I18N[.].*.._..' $@ LibTest `findlinux I18N -name ??_??.py`
44
# For --translator=dict
55
# - disable the generator test for now (will hang forever)

examples/libtest/imports/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@ def conditional_func():
3030
# Import all
3131
all_masked = False
3232
all_override = False
33-
from allwith__all__ import *
34-
from allsimple import *
33+
from .allwith__all__ import *
34+
from .allsimple import *

examples/libtest/imports/cls1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11

2-
from cls import CLS
2+
from .cls import CLS
33

examples/libtest/imports/override.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11

2-
import overrideme
2+
from . import overrideme

pyjs/src/pyjs/builtin/pyjslib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7135,7 +7135,7 @@ def sprintf(strng, args):
71357135
return result.join("");
71367136
""")
71377137

7138-
__module_internals = set(['__track_lines__'])
7138+
__module_internals = set(['__track_lines__', 'toString'])
71397139
def _globals(module):
71407140
"""
71417141
XXX: It should return dictproxy instead!

pyjs/src/pyjs/lib/os/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import path
1+
from . import path
22

33
name = 'pyjs'
44

pyjs/src/pyjs/translator_proto.py

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -974,7 +974,7 @@ def __init__(self, compiler,
974974
# print out the deps and check for wrong imports
975975
if self.imported_modules:
976976
self.w( '/*')
977-
self.w( 'PYJS_DEPS: %s' % map(uescapejs, self.imported_modules))
977+
self.w( 'PYJS_DEPS: %s' % map(str, self.imported_modules))
978978
self.w( '*/')
979979

980980
# print out the imported js
@@ -1891,8 +1891,7 @@ def _import(self, node, current_klass, root_level = False):
18911891
# object to check our scope
18921892
self._doImport(node.names, current_klass, root_level, True)
18931893

1894-
def _doImport(self, names, current_klass, root_level, assignBase,
1895-
absPath=False, all=False):
1894+
def _doImport(self, names, current_klass, root_level, assignBase, all=False):
18961895
if root_level:
18971896
modtype = 'root-module'
18981897
else:
@@ -1931,10 +1930,7 @@ def _doImport(self, names, current_klass, root_level, assignBase,
19311930
or (assignBase and not package_mod[0] in ['root-module', 'module'])
19321931
):
19331932
# the import statement
1934-
if absPath:
1935-
context = 'null'
1936-
else:
1937-
context = self.import_context
1933+
context = 'null'
19381934
if not all:
19391935
import_stmt = "@{{___import___}}('%s', %s" % (
19401936
importName,
@@ -2011,9 +2007,6 @@ def _from(self, node, current_klass, root_level=False):
20112007
# Ignoring from __future__ import name[0]
20122008
pass
20132009
return
2014-
# TODO: check again if this really works correctly. We've switched to absolute
2015-
# imports like in Python 3.
2016-
absPath = True
20172010
modname = node.modname
20182011
if hasattr(node, 'level') and node.level > 0:
20192012
if self.relative_import_context is not None:
@@ -2032,11 +2025,11 @@ def _from(self, node, current_klass, root_level=False):
20322025
for name in node.names:
20332026
if name[0] == "*":
20342027
self._doImport(((modname, name[0]),), current_klass,
2035-
root_level, False, absPath, True)
2028+
root_level, False, True)
20362029
continue
20372030
sub = modname + '.' + name[0]
20382031
ass_name = name[1] or name[0]
2039-
self._doImport(((sub, ass_name),), current_klass, root_level, True, absPath)
2032+
self._doImport(((sub, ass_name),), current_klass, root_level, True)
20402033

20412034
def _function(self, node, current_klass, force_local=False):
20422035
save_top_level = self.top_level
@@ -3102,8 +3095,8 @@ def _assigns_list(self, v, current_klass, expr, kind=None): # DANIEL KLUEV VERSI
31023095
if self.descriptors:
31033096
desc_setattr = ("""%(l)s.__is_instance__ && """
31043097
"""typeof %(l)s.__setattr__ == 'function' ? """
3105-
"""%(l)s.__setattr__('%(a)s', %(r)s) : """
3106-
"""%(setattr)s(%(l)s, '%(a)s', %(r)s); """ %
3098+
"""%(l)s.__setattr__(%(a)s, %(r)s) : """
3099+
"""%(setattr)s(%(l)s, %(a)s, %(r)s); """ %
31073100
dict(
31083101
setattr=self.pyjslib_name('setattr'),
31093102
l=lhs,
@@ -4584,10 +4577,8 @@ def visitFrom(self, node):
45844577
return
45854578
# XXX: hack for in-function checking, we should have another
45864579
# object to check our scope
4587-
absPath = False
45884580
modname = node.modname
45894581
if hasattr(node, 'level') and node.level > 0:
4590-
absPath = True
45914582
modname = self.module_name.split('.')
45924583
level = node.level
45934584
if len(modname) < level:

0 commit comments

Comments
 (0)