Slicer: 2145-support-for-installing-extension-from-file 78aeed78

Author Committer Branch Timestamp Parent
jcfr jcfr 2145-support-for-installing-extension-from-file 2013-04-30 23:34:50 2145-support-for-installing-extension-from-file 8be840cb
Changeset

COMP: Remove python patch step related to "dll boundaries" hack

As explained in r21863, patching pythonrun.h and pythonrun.c was
required to prevent crash (related to dll boundaries [1][2]) when
building Slicer debug against a released python.

[1] http://stackoverflow.com/questions/2322095/why-does-this-program-crash-passing-of-stdstring-between-dlls
[2] http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/57e0d522-a42c-4add-963d-c87c6e76f161

Applying the approach discussed on the Blender mailing list[3], the
hack is not required anymore. This is made possible by using
"PyRun_String" function combined with the "execfile" statement.

[3] http://lists.blender.org/pipermail/bf-python/2008-May/005253.html

When transitioning to Python3 [4], use of "exec" and "compile" could be
considered:

with open('foo.py', 'r') as fh:
code = compile(fh.read(), 'foo.py', 'exec'); exec(code);

[4] http://stackoverflow.com/questions/436198/what-is-an-alternative-to-execfile-in-python-3-0

Approach making use of the "imp" module could also be investigated [5][6]

[5] http://www.ragestorm.net/blogs/?tag=execfile
[6] http://docs.python.org/2/library/imp.html

Finally, let's note that overall approach to load module could be
revised to prevent side effect as the one described in
"qSlicerScriptedFileDialog::setPythonSource"

git-svn-id: http://svn.slicer.org/Slicer4/trunk@21960 3bd1e089-480b-0410-8dfb-8563597acbee

mod - Base/Logic/vtkSlicerScriptedLoadableModuleLogic.cxx Diff File
mod - Base/QTGUI/qSlicerScriptedFileDialog.cxx Diff File
mod - Base/QTGUI/qSlicerScriptedFileDialog.h Diff File
mod - Base/QTGUI/qSlicerScriptedLoadableModule.cxx Diff File
mod - Base/QTGUI/qSlicerScriptedLoadableModuleWidget.cxx Diff File
mod - CMake/vtkSlicerConfigure.h.in Diff File
mod - Libs/MRML/Core/vtkMRMLConfigure.h.in Diff File
mod - Libs/MRML/DisplayableManager/vtkMRMLScriptedDisplayableManager.cxx Diff File
mod - SuperBuild.cmake Diff File
mod - SuperBuild/External_python.cmake Diff File