Hi, I wanted to ask how hard would it be to port a python module having c extensions like e.g. "Python Image Library" or even something like ghostscript?
Is there a way to compile those modules easily using xdk? Python Image Library would be highly appreciated, I think Kodi versions ship with PIL.
Python modules having C extension
- byron
- Posts: 582
- Joined: Wed Jul 04, 2012 9:26 pm
- Location: Illinois
- Has thanked: 27 times
- Been thanked: 96 times
Re: Python modules having C extension
I too am interested in this...openweathermap (official? Kodi weather addon) requires this and the kodi shipped "PIL" doesn't work...it's looking for Python 2.6 dll and another dll as well. There's this thread
http://www.xbmc4xbox.org.uk/forum/viewt ... PIL#p20815
Perhaps jan would be willing to share this, it would probably be a good place to start at least
*EDIT*
Changed the link...originally posted the wrong thread, this above link is now correct.
http://www.xbmc4xbox.org.uk/forum/viewt ... PIL#p20815
Perhaps jan would be willing to share this, it would probably be a good place to start at least
*EDIT*
Changed the link...originally posted the wrong thread, this above link is now correct.
Re: Python modules having C extension
What Jan wrote in this thread is that he wants to port PIL and that he doesn't have the pyd files (native C modules, on windows called dll on xbox *maybe* too).
For porting PIL we would need to compile the c files. I already did that successfully using xdk but it built one lib file. In fact we'd need 5 library files or atleast (to get the main things working we need the files "_imaging.pyd", "_imaging_ft.pyd", "_imagingmath.pyd"). The first problem is that I dont know how we can compile these files to single lib/dll files (I even think that those files have to be compiled to dll because Buzz did so too on the Python xbox build). Assuming those were build correct and the PIL module is finished the next problem is that those C files implement something like an interface only. That means we would still need the freetype library, jpeg library etc for xbox compiled too.
Without some more information on this especially the way how a compiled freetype library would communicate with the _imaging_ft.pyd I dont know how to continue...
For porting PIL we would need to compile the c files. I already did that successfully using xdk but it built one lib file. In fact we'd need 5 library files or atleast (to get the main things working we need the files "_imaging.pyd", "_imaging_ft.pyd", "_imagingmath.pyd"). The first problem is that I dont know how we can compile these files to single lib/dll files (I even think that those files have to be compiled to dll because Buzz did so too on the Python xbox build). Assuming those were build correct and the PIL module is finished the next problem is that those C files implement something like an interface only. That means we would still need the freetype library, jpeg library etc for xbox compiled too.
Without some more information on this especially the way how a compiled freetype library would communicate with the _imaging_ft.pyd I dont know how to continue...
Re: Python modules having C extension
Awesome, thanks! If you do this it would be very appreciated if you could write down some steps you made to build this. Maybe some 'Hello World' C extension would be sufficient for us to see how the compilation process (of building a dll?) work and which settings to use in xdk.
Edit: I think this guide is a good start, though I can only get freetype and zlib compiled using xdk...
Now I also found a 'Hello World' extension with some text (in german), I'll try to rebuild this for xbox and if it works I'll have a look on 'bigger' modules.
Edit2:
Since I want to test the modules on windows I read that you have to have a python version built by the same compiler as the modules. So I tried to build Python 2.7.10 the compilation of core worked but it couldn't link the files. So I tested and found out Python 2.6.7 was the last version that built 'out of the box' using MSVS71. Here you can find a portable core version.
Edit: I think this guide is a good start, though I can only get freetype and zlib compiled using xdk...
Now I also found a 'Hello World' extension with some text (in german), I'll try to rebuild this for xbox and if it works I'll have a look on 'bigger' modules.
Edit2:
Since I want to test the modules on windows I read that you have to have a python version built by the same compiler as the modules. So I tried to build Python 2.7.10 the compilation of core worked but it couldn't link the files. So I tested and found out Python 2.6.7 was the last version that built 'out of the box' using MSVS71. Here you can find a portable core version.