Merge github.com:swig/swig
This commit is contained in:
commit
a9e29d2bc7
1 changed files with 10 additions and 15 deletions
|
|
@ -731,15 +731,12 @@ public:
|
||||||
* globals()[attr] = getattr(_foo, attr)
|
* globals()[attr] = getattr(_foo, attr)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Printf(default_import_code, "# pull in all the attributes from %s\n", module);
|
Printf(default_import_code, "\n# Pull in all the attributes from %s\n", module);
|
||||||
Printv(default_import_code, "if __name__.rpartition('.')[0] != '':\n", NULL);
|
Printv(default_import_code, "if __name__.rpartition('.')[0] != '':\n", NULL);
|
||||||
Printv(default_import_code, tab4, "if _swig_python_version_info >= (2, 7, 0):\n", NULL);
|
Printv(default_import_code, tab4, "try:\n", NULL);
|
||||||
Printv(default_import_code, tab8, "try:\n", NULL);
|
Printf(default_import_code, tab4 tab4 "from .%s import *\n", module);
|
||||||
Printf(default_import_code, tab8 tab4 "from .%s import *\n", module);
|
Printv(default_import_code, tab4 "except ImportError:\n", NULL);
|
||||||
Printv(default_import_code, tab8 "except ImportError:\n", NULL);
|
Printf(default_import_code, tab4 tab4 "from %s import *\n", module);
|
||||||
Printf(default_import_code, tab8 tab4 "from %s import *\n", module);
|
|
||||||
Printv(default_import_code, tab4, "else:\n", NULL);
|
|
||||||
Printf(default_import_code, tab8 "from %s import *\n", module);
|
|
||||||
Printv(default_import_code, "else:\n", NULL);
|
Printv(default_import_code, "else:\n", NULL);
|
||||||
Printf(default_import_code, tab4 "from %s import *\n", module);
|
Printf(default_import_code, tab4 "from %s import *\n", module);
|
||||||
}
|
}
|
||||||
|
|
@ -900,13 +897,14 @@ public:
|
||||||
Swig_banner_target_lang(f_shadow_py, "#");
|
Swig_banner_target_lang(f_shadow_py, "#");
|
||||||
if (Len(f_shadow_begin) > 0)
|
if (Len(f_shadow_begin) > 0)
|
||||||
Printv(f_shadow_py, "\n", f_shadow_begin, "\n", NIL);
|
Printv(f_shadow_py, "\n", f_shadow_begin, "\n", NIL);
|
||||||
if (Len(f_shadow_after_begin) > 0)
|
|
||||||
Printv(f_shadow_py, f_shadow_after_begin, "\n", NIL);
|
|
||||||
|
|
||||||
Printv(f_shadow_py, "\nfrom sys import version_info as _swig_python_version_info\n", NULL);
|
Printv(f_shadow_py, "\nfrom sys import version_info as _swig_python_version_info\n", NULL);
|
||||||
Printv(f_shadow_py, "if _swig_python_version_info < (2, 7, 0):\n", NULL);
|
Printv(f_shadow_py, "if _swig_python_version_info < (2, 7, 0):\n", NULL);
|
||||||
Printv(f_shadow_py, tab4, "raise RuntimeError('Python 2.7 or later required')\n\n", NULL);
|
Printv(f_shadow_py, tab4, "raise RuntimeError('Python 2.7 or later required')\n\n", NULL);
|
||||||
|
|
||||||
|
if (Len(f_shadow_after_begin) > 0)
|
||||||
|
Printv(f_shadow_py, f_shadow_after_begin, "\n", NIL);
|
||||||
|
|
||||||
if (moduleimport) {
|
if (moduleimport) {
|
||||||
Replaceall(moduleimport, "$module", module);
|
Replaceall(moduleimport, "$module", module);
|
||||||
Printv(f_shadow_py, moduleimport, "\n", NIL);
|
Printv(f_shadow_py, moduleimport, "\n", NIL);
|
||||||
|
|
@ -1121,12 +1119,9 @@ public:
|
||||||
Printf(out, "import %s%s%s%s\n", apkg, *Char(apkg) ? "." : "", pfx, mod);
|
Printf(out, "import %s%s%s%s\n", apkg, *Char(apkg) ? "." : "", pfx, mod);
|
||||||
Delete(apkg);
|
Delete(apkg);
|
||||||
} else {
|
} else {
|
||||||
Printf(out, "if _swig_python_version_info >= (2, 7, 0):\n");
|
|
||||||
if (py3_rlen1)
|
if (py3_rlen1)
|
||||||
Printf(out, tab4 "from . import %.*s\n", py3_rlen1, rpkg);
|
Printf(out, "from . import %.*s\n", py3_rlen1, rpkg);
|
||||||
Printf(out, tab4 "from .%s import %s%s\n", rpkg, pfx, mod);
|
Printf(out, "from .%s import %s%s\n", rpkg, pfx, mod);
|
||||||
Printf(out, "else:\n");
|
|
||||||
Printf(out, tab4 "import %s%s%s%s\n", rpkg, *Char(rpkg) ? "." : "", pfx, mod);
|
|
||||||
Delete(rpkg);
|
Delete(rpkg);
|
||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue