diff options
Diffstat (limited to 'Examples/python/import_packages')
12 files changed, 51 insertions, 51 deletions
diff --git a/Examples/python/import_packages/from_init1/runme.py b/Examples/python/import_packages/from_init1/runme.py index a663a136b..c76716f16 100644 --- a/Examples/python/import_packages/from_init1/runme.py +++ b/Examples/python/import_packages/from_init1/runme.py @@ -6,26 +6,26 @@ def run_except_on_windows(commandline, env=None): if os.name != "nt" and sys.platform != "cygwin": # Strange failures on windows/cygin/mingw subprocess.check_call(commandline, env=env, shell=True) - print(" Finished running: " + commandline) + print((" Finished running: " + commandline)) # Test import of modules content from within __init__.py testname = os.path.basename(os.path.dirname(os.path.abspath(__file__))) -print "Testing " + testname + " - %module(package=...) + python 'import' in __init__.py" +print("Testing " + testname + " - %module(package=...) + python 'import' in __init__.py") if sys.version_info < (2, 5): - print " Skipping test as Python version is < 2.5 and does not support relative import syntax: 'from . import x'" + print(" Skipping test as Python version is < 2.5 and does not support relative import syntax: 'from . import x'") sys.exit(0) if sys.version_info < (3, 0): import py2.pkg2 - print " Finished importing py2.pkg2" + print(" Finished importing py2.pkg2") commandline = sys.executable + " -m py2.pkg2.bar" run_except_on_windows(commandline) commandline = sys.executable + " -m py2.pkg2.foo" run_except_on_windows(commandline) else: import py3.pkg2 - print " Finished importing py3.pkg2" + print(" Finished importing py3.pkg2") # commandline = sys.executable + " -m py3.pkg2.bar" # run_except_on_windows(commandline) # commandline = sys.executable + " -m py3.pkg2.foo" diff --git a/Examples/python/import_packages/from_init2/runme.py b/Examples/python/import_packages/from_init2/runme.py index 3c7b12693..c9c46a4da 100644 --- a/Examples/python/import_packages/from_init2/runme.py +++ b/Examples/python/import_packages/from_init2/runme.py @@ -6,24 +6,24 @@ def run_except_on_windows(commandline, env=None): if os.name != "nt" and sys.platform != "cygwin": # Strange failures on windows/cygin/mingw subprocess.check_call(commandline, env=env, shell=True) - print(" Finished running: " + commandline) + print((" Finished running: " + commandline)) # Test import of modules content from within __init__.py testname = os.path.basename(os.path.dirname(os.path.abspath(__file__))) -print "Testing " + testname + " - %module(package=...) + python 'import' in __init__.py" +print("Testing " + testname + " - %module(package=...) + python 'import' in __init__.py") if sys.version_info < (2, 5): - print " Skipping test as Python version is < 2.5 and does not support relative import syntax: 'from . import x'" + print(" Skipping test as Python version is < 2.5 and does not support relative import syntax: 'from . import x'") sys.exit(0) if sys.version_info < (3, 0): import py2.pkg2 - print " Finished importing py2.pkg2" + print(" Finished importing py2.pkg2") commandline = sys.executable + " -m py2.pkg2.bar" run_except_on_windows(commandline) else: import py3.pkg2 - print " Finished importing py3.pkg2" + print(" Finished importing py3.pkg2") # commandline = sys.executable + " -m py3.pkg2.bar" # run_except_on_windows(commandline) diff --git a/Examples/python/import_packages/from_init3/runme.py b/Examples/python/import_packages/from_init3/runme.py index 3c7b12693..c9c46a4da 100644 --- a/Examples/python/import_packages/from_init3/runme.py +++ b/Examples/python/import_packages/from_init3/runme.py @@ -6,24 +6,24 @@ def run_except_on_windows(commandline, env=None): if os.name != "nt" and sys.platform != "cygwin": # Strange failures on windows/cygin/mingw subprocess.check_call(commandline, env=env, shell=True) - print(" Finished running: " + commandline) + print((" Finished running: " + commandline)) # Test import of modules content from within __init__.py testname = os.path.basename(os.path.dirname(os.path.abspath(__file__))) -print "Testing " + testname + " - %module(package=...) + python 'import' in __init__.py" +print("Testing " + testname + " - %module(package=...) + python 'import' in __init__.py") if sys.version_info < (2, 5): - print " Skipping test as Python version is < 2.5 and does not support relative import syntax: 'from . import x'" + print(" Skipping test as Python version is < 2.5 and does not support relative import syntax: 'from . import x'") sys.exit(0) if sys.version_info < (3, 0): import py2.pkg2 - print " Finished importing py2.pkg2" + print(" Finished importing py2.pkg2") commandline = sys.executable + " -m py2.pkg2.bar" run_except_on_windows(commandline) else: import py3.pkg2 - print " Finished importing py3.pkg2" + print(" Finished importing py3.pkg2") # commandline = sys.executable + " -m py3.pkg2.bar" # run_except_on_windows(commandline) diff --git a/Examples/python/import_packages/module_is_init/runme.py b/Examples/python/import_packages/module_is_init/runme.py index b5e646e85..c4806cdf8 100644 --- a/Examples/python/import_packages/module_is_init/runme.py +++ b/Examples/python/import_packages/module_is_init/runme.py @@ -3,10 +3,10 @@ import sys # Test import of a SWIG generated module renamed as the package's __init__.py testname = os.path.basename(os.path.dirname(os.path.abspath(__file__))) -print "Testing " + testname + " - module renamed as __init__.py" +print("Testing " + testname + " - module renamed as __init__.py") if sys.version_info >= (3, 0, 0) and sys.version_info < (3, 3, 0): - print " Not importing as Python version is >= 3.0 and < 3.3" + print(" Not importing as Python version is >= 3.0 and < 3.3") # Package detection does not work in these versions. # Can be fixed by using this in the interface file: # %module(moduleimport="from . import $module") foo # without -builtin @@ -14,7 +14,7 @@ if sys.version_info >= (3, 0, 0) and sys.version_info < (3, 3, 0): sys.exit(0) import pkg1 -print " Finished importing pkg1" +print(" Finished importing pkg1") if pkg1.foofunction(123) != 1230: raise RuntimeError("foofunction failed") @@ -23,4 +23,4 @@ fc = pkg1.FooClass() if fc.foomethod(1) != 6: raise RuntimeError("foomethod failed") -print " Finished testing pkg1" +print(" Finished testing pkg1") diff --git a/Examples/python/import_packages/namespace_pkg/runme.py b/Examples/python/import_packages/namespace_pkg/runme.py index d2af05619..54a8e4ee6 100644 --- a/Examples/python/import_packages/namespace_pkg/runme.py +++ b/Examples/python/import_packages/namespace_pkg/runme.py @@ -5,14 +5,14 @@ import subprocess import sys testname = os.path.basename(os.path.dirname(os.path.abspath(__file__))) -print "Testing " + testname + " - namespace packages" +print("Testing " + testname + " - namespace packages") if sys.version_info < (3, 3, 0): - print " Not importing nstest as Python version is < 3.3" + print(" Not importing nstest as Python version is < 3.3") sys.exit(0) import nstest -print " Finished importing nstest" +print(" Finished importing nstest") nstest.main() diff --git a/Examples/python/import_packages/relativeimport1/runme.py b/Examples/python/import_packages/relativeimport1/runme.py index 87101ea46..3073cb5a7 100644 --- a/Examples/python/import_packages/relativeimport1/runme.py +++ b/Examples/python/import_packages/relativeimport1/runme.py @@ -6,26 +6,26 @@ def run_except_on_windows(commandline, env=None): if os.name != "nt" and sys.platform != "cygwin": # Strange failures on windows/cygin/mingw subprocess.check_call(commandline, env=env, shell=True) - print(" Finished running: " + commandline) + print((" Finished running: " + commandline)) # Test import of modules content from within __init__.py testname = os.path.basename(os.path.dirname(os.path.abspath(__file__))) -print "Testing " + testname + " - %module(package=...) with -relativeimport" +print("Testing " + testname + " - %module(package=...) with -relativeimport") if sys.version_info < (2, 5): - print " Skipping test as Python version is < 2.5 and does not support relative import syntax: 'from . import x'" + print(" Skipping test as Python version is < 2.5 and does not support relative import syntax: 'from . import x'") sys.exit(0) if sys.version_info < (3, 0): import py2.pkg2.bar - print " Finished importing py2.pkg2.bar" + print(" Finished importing py2.pkg2.bar") commandline = sys.executable + " -m py2.pkg2.bar" run_except_on_windows(commandline) commandline = sys.executable + " -m py2.pkg2.pkg3.foo" run_except_on_windows(commandline) else: import py3.pkg2.bar - print " Finished importing py3.pkg2.bar" + print(" Finished importing py3.pkg2.bar") commandline = sys.executable + " -m py3.pkg2.bar" run_except_on_windows(commandline) commandline = sys.executable + " -m py3.pkg2.pkg3.foo" diff --git a/Examples/python/import_packages/relativeimport2/runme.py b/Examples/python/import_packages/relativeimport2/runme.py index f5b55782f..9ab8d9471 100644 --- a/Examples/python/import_packages/relativeimport2/runme.py +++ b/Examples/python/import_packages/relativeimport2/runme.py @@ -6,26 +6,26 @@ def run_except_on_windows(commandline, env=None): if os.name != "nt" and sys.platform != "cygwin": # Strange failures on windows/cygin/mingw subprocess.check_call(commandline, env=env, shell=True) - print(" Finished running: " + commandline) + print((" Finished running: " + commandline)) # Test import of modules content from within __init__.py testname = os.path.basename(os.path.dirname(os.path.abspath(__file__))) -print "Testing " + testname + " - %module(package=...) + python 'import' in __init__.py" +print("Testing " + testname + " - %module(package=...) + python 'import' in __init__.py") if sys.version_info < (2, 5): - print " Skipping test as Python version is < 2.5 and does not support relative import syntax: 'from . import x'" + print(" Skipping test as Python version is < 2.5 and does not support relative import syntax: 'from . import x'") sys.exit(0) if sys.version_info < (3, 0): import py2.pkg2.bar - print " Finished importing py2.pkg2.bar" + print(" Finished importing py2.pkg2.bar") commandline = sys.executable + " -m py2.pkg2.bar" run_except_on_windows(commandline) commandline = sys.executable + " -m py2.pkg2.pkg3.pkg4.foo" run_except_on_windows(commandline) else: import py3.pkg2.bar - print " Finished importing py3.pkg2.bar" + print(" Finished importing py3.pkg2.bar") commandline = sys.executable + " -m py3.pkg2.bar" run_except_on_windows(commandline) commandline = sys.executable + " -m py3.pkg2.pkg3.pkg4.foo" diff --git a/Examples/python/import_packages/relativeimport3/runme.py b/Examples/python/import_packages/relativeimport3/runme.py index 87101ea46..3073cb5a7 100644 --- a/Examples/python/import_packages/relativeimport3/runme.py +++ b/Examples/python/import_packages/relativeimport3/runme.py @@ -6,26 +6,26 @@ def run_except_on_windows(commandline, env=None): if os.name != "nt" and sys.platform != "cygwin": # Strange failures on windows/cygin/mingw subprocess.check_call(commandline, env=env, shell=True) - print(" Finished running: " + commandline) + print((" Finished running: " + commandline)) # Test import of modules content from within __init__.py testname = os.path.basename(os.path.dirname(os.path.abspath(__file__))) -print "Testing " + testname + " - %module(package=...) with -relativeimport" +print("Testing " + testname + " - %module(package=...) with -relativeimport") if sys.version_info < (2, 5): - print " Skipping test as Python version is < 2.5 and does not support relative import syntax: 'from . import x'" + print(" Skipping test as Python version is < 2.5 and does not support relative import syntax: 'from . import x'") sys.exit(0) if sys.version_info < (3, 0): import py2.pkg2.bar - print " Finished importing py2.pkg2.bar" + print(" Finished importing py2.pkg2.bar") commandline = sys.executable + " -m py2.pkg2.bar" run_except_on_windows(commandline) commandline = sys.executable + " -m py2.pkg2.pkg3.foo" run_except_on_windows(commandline) else: import py3.pkg2.bar - print " Finished importing py3.pkg2.bar" + print(" Finished importing py3.pkg2.bar") commandline = sys.executable + " -m py3.pkg2.bar" run_except_on_windows(commandline) commandline = sys.executable + " -m py3.pkg2.pkg3.foo" diff --git a/Examples/python/import_packages/same_modnames1/runme.py b/Examples/python/import_packages/same_modnames1/runme.py index a64551bfd..05846ed9d 100644 --- a/Examples/python/import_packages/same_modnames1/runme.py +++ b/Examples/python/import_packages/same_modnames1/runme.py @@ -6,21 +6,21 @@ def run_except_on_windows(commandline, env=None): if os.name != "nt" and sys.platform != "cygwin": # Strange failures on windows/cygin/mingw subprocess.check_call(commandline, env=env, shell=True) - print(" Finished running: " + commandline) + print((" Finished running: " + commandline)) # Test import of same modules from different packages testname = os.path.basename(os.path.dirname(os.path.abspath(__file__))) -print "Testing " + testname + " - %module(package=...) + python 'import' in __init__.py" +print("Testing " + testname + " - %module(package=...) + python 'import' in __init__.py") import pkg2.foo -print " Finished importing pkg2.foo" +print(" Finished importing pkg2.foo") var2 = pkg2.foo.Pkg2_Foo() classname = str(type(var2)) if classname.find("pkg2.foo.Pkg2_Foo") == -1: raise RuntimeError("failed type checking: " + classname) -print " Successfully created object pkg2.foo.Pkg2_Foo" +print(" Successfully created object pkg2.foo.Pkg2_Foo") commandline = sys.executable + " -m pkg2.foo" run_except_on_windows(commandline) diff --git a/Examples/python/import_packages/same_modnames2/runme.py b/Examples/python/import_packages/same_modnames2/runme.py index c2cf2744c..190dadc77 100644 --- a/Examples/python/import_packages/same_modnames2/runme.py +++ b/Examples/python/import_packages/same_modnames2/runme.py @@ -6,20 +6,20 @@ def run_except_on_windows(commandline, env=None): if os.name != "nt" and sys.platform != "cygwin": # Strange failures on windows/cygin/mingw subprocess.check_call(commandline, env=env, shell=True) - print(" Finished running: " + commandline) + print((" Finished running: " + commandline)) testname = os.path.basename(os.path.dirname(os.path.abspath(__file__))) -print "Testing " + testname + " - %module(package=...) + python 'import' in __init__.py" +print("Testing " + testname + " - %module(package=...) + python 'import' in __init__.py") import pkg1.pkg2.foo -print " Finished importing pkg1.pkg2.foo" +print(" Finished importing pkg1.pkg2.foo") var2 = pkg1.pkg2.foo.Pkg2_Foo() classname = str(type(var2)) if classname.find("pkg1.pkg2.foo.Pkg2_Foo") == -1: raise RuntimeError("failed type checking: " + classname) -print " Successfully created object pkg1.pkg2.foo.Pkg2_Foo" +print(" Successfully created object pkg1.pkg2.foo.Pkg2_Foo") commandline = sys.executable + " -m pkg1.pkg2.foo" run_except_on_windows(commandline) diff --git a/Examples/python/import_packages/split_modules/vanilla/runme.py b/Examples/python/import_packages/split_modules/vanilla/runme.py index 79d79b4c3..0f7b8806b 100644 --- a/Examples/python/import_packages/split_modules/vanilla/runme.py +++ b/Examples/python/import_packages/split_modules/vanilla/runme.py @@ -6,14 +6,14 @@ def run_except_on_windows(commandline, env=None): if os.name != "nt" and sys.platform != "cygwin": # Strange failures on windows/cygin/mingw subprocess.check_call(commandline, env=env, shell=True) - print(" Finished running: " + commandline) + print((" Finished running: " + commandline)) testname = os.path.basename(os.path.dirname(os.path.abspath(__file__))) -print "Testing " + testname + " - split modules" +print("Testing " + testname + " - split modules") import pkg1.foo -print " Finished importing pkg1.foo" +print(" Finished importing pkg1.foo") if not(pkg1.foo.count() == 3): raise RuntimeError("test failed") diff --git a/Examples/python/import_packages/split_modules/vanilla_split/runme.py b/Examples/python/import_packages/split_modules/vanilla_split/runme.py index 79d79b4c3..0f7b8806b 100644 --- a/Examples/python/import_packages/split_modules/vanilla_split/runme.py +++ b/Examples/python/import_packages/split_modules/vanilla_split/runme.py @@ -6,14 +6,14 @@ def run_except_on_windows(commandline, env=None): if os.name != "nt" and sys.platform != "cygwin": # Strange failures on windows/cygin/mingw subprocess.check_call(commandline, env=env, shell=True) - print(" Finished running: " + commandline) + print((" Finished running: " + commandline)) testname = os.path.basename(os.path.dirname(os.path.abspath(__file__))) -print "Testing " + testname + " - split modules" +print("Testing " + testname + " - split modules") import pkg1.foo -print " Finished importing pkg1.foo" +print(" Finished importing pkg1.foo") if not(pkg1.foo.count() == 3): raise RuntimeError("test failed") |