Bug #60: Relative import syntax (dots) does not disable top-level (absolute) imports.

git-svn-id: http://svn.pyinstaller.org/trunk@679 8dd32b29-ccff-0310-8a9a-9233e24343b1
This commit is contained in:
giovannibajo
2009-06-15 22:47:53 +00:00
parent 5aa7540cd3
commit bbe074c8e8
13 changed files with 37 additions and 2 deletions
+1
View File
@@ -0,0 +1 @@
View File
+6
View File
@@ -0,0 +1,6 @@
from .relimp3b import b1
from .relimp3c import c1
def getString():
return b1.string + c1.string
+2
View File
@@ -0,0 +1,2 @@
class c1:
string = "... and this"
+1
View File
@@ -0,0 +1 @@
raise ValueError
+1
View File
@@ -0,0 +1 @@
raise ValueError
+1
View File
@@ -0,0 +1 @@
+1
View File
@@ -0,0 +1 @@
string = "I hope you see this!"
+1
View File
@@ -0,0 +1 @@
raise RuntimeError
+4
View File
@@ -0,0 +1,4 @@
from relimp3a.aa import a1
if __name__ == '__main__':
print a1.getString()
+17
View File
@@ -0,0 +1,17 @@
# -*- mode: python -*-
__testname__ = 'test-relative-import3'
a = Analysis([os.path.join(HOMEPATH,'support/_mountzlib.py'),
__testname__ + '.py'],
)
pyz = PYZ(a.pure)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
name = os.path.join('dist', __testname__, __testname__ +'.exe'),
debug=False,
strip=False,
upx=False,
console=1 )
+1 -1
View File
@@ -406,7 +406,7 @@ class ImportManager:
if level > 1:
importernm = _string_split(importernm, '.')[:-level+1]
importernm = _string_join('.', importernm)
contexts = []
contexts = [None]
if importernm:
if ispkg:
# If you use the "from __init__ import" syntax, the package
+1 -1
View File
@@ -494,7 +494,7 @@ class ImportTracker:
level -= 1
if level > 0:
importernm = string.join(string.split(importernm, '.')[:-level], ".")
contexts = [importernm]
contexts = [importernm, None]
importernm = None
_all = None