fix the relative import patch by try both relative and absolute import

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10625 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Haoyu Bai 2008-07-02 04:56:11 +00:00
commit 1f2c29342f

View file

@ -701,7 +701,10 @@ public:
* code conditional on the python version.
*/
Printv(f_shadow, "if version_info >= (2,6,0):\n", NULL);
Printf(f_shadow, tab4 "from . import %s\n", module);
Printv(f_shadow, tab4, "try:\n", NULL);
Printf(f_shadow, tab8 "from . import %s\n", module);
Printv(f_shadow, tab4, "except ValueError:\n");
Printf(f_shadow, tab8 "import %s\n", module);
Printv(f_shadow, "else:\n", NULL);
Printf(f_shadow, tab4 "import %s\n", module);