xbmcmodule compiled as a shared library for PyDev?
#1
First day looking through source code on this project (well, for the last few years anyway, actually, first day with Python ever). Thanks for the great tutorial on getting PyDev working (in Eclipse). I have XBMC running on my linux based HTPC while debugging from my laptop.

The only problem I have now is that, since I'm new to python development (and therefore new to xbmc script development) it would be great to get autocompletion on xbmc, xbmcaddons, xbmcgui, etc. I think (and please correct me if I'm wrong) this requires compiling a .so version of xbmcmodule and including it in a zip file then adding it to the PYTHONPATH and then to "Forced Builtins" in Eclipse.

Has anyone done this and if so, can the relevant Makefile changes be provided here (if not added as an option to the configuration step)?

Thanks. Please let me know if I misunderstand something about the way this works.

Jim

Edit: I'm running on Linux (Ubuntu 10.04, with XBMC SVN revision 31822)
Reply
#2
I suspect you're embarking into new territory as far as everyone is concerned. The modules are located in xbmc/lib/libPython. As you can appreciate, they rely quite a bit on XBMC itself, so I'm not sure how easy it would be to build a .so.

Cheers,
Jonathan
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#3
Thanks for the reply.

Having spent the last 10 years doing java development, linking shared libraries is a bit esoteric for me, but I noticed that a static library is built for the that module so I figured linking a shared library (maybe even by simply including the shared library and exporting all of the functions/globals) wouldn't be that difficult.

I don't fully understand how Python interprets the builtin's but I assume that the function signatures along with the global char[]'s that make up the apidocs could be imported by PyDev.

I was thinking about writing a script to scrape the 4 cpp files and generate what PyDev calls "Predefined Competions" (http://pydev.org/manual_101_interpreter.html#id1).

Let me know if either path (shared library or creating "Predefined Completions") makes sense and if anyone is interested. If I get it working I can provide it to the appropriate team member.

Thanks
Jim

EDIT: One more thing. I didn't mean to suggest replacing what was currently being used to build the running system with a shared library. Only generating an additional shared library (when the appropriate config options are provided) for the purposes of using them as part of Python development in Eclipse.
Reply
#4
It looks like the Predefined Completions thing might be of use, yeah. We'd be happy to host such completions (or ideally the scripts to generate them) if you come up with something that works.

Cheers,
Jonathan
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#5
Actually, after looking at it and thinking about it for a while, since Python allows reflection/introspection I think the best and least invasive way to do it is by writing a Python script that generates the Predefined Completions and running it from within xbmc.

I'll post something here when I have something ready.
Reply
#6
You might want to checkout the pydocs script on the xbmc-addons google code project. That might be useful as a starting point. It's in the addons dir in root of the SVN.

Cheers,
Jonathan
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#7
Just grabbed it. Thanks! It looks like a perfect starting point (actually - it looks like it gets me most of the way there).
Reply
#8
OK,

I have this completed and working (sorry it took too long). I'm not sure how to make it available to others.

It works pretty will. It provides autocompletion and dynamic access to the documentation in the IDE.

Let me know.

Thanks
Reply
#9
jfcarroll Wrote:OK,

I have this completed and working (sorry it took too long). I'm not sure how to make it available to others.

It works pretty will. It provides autocompletion and dynamic access to the documentation in the IDE.

Let me know.

Thanks

want
Reply
#10
Thanks xbmchead,

Anyone that wants a copy, prior to me figuring out how to submit it, just PM me with your email address. I'll send you a zip file to unzip into your .xbmc/addons.

Feedback is always welcome.
Reply
#11
I uploaded the code to a new project on code.google.com. You can get it through svn:

svn co http://xbmc-pydev-predefcom.googlecode.c...ypredefcom script.pypredefcom

There's a README.txt file in the root directory. Let me know if you have any issues.
Reply
#12
Thanks, have been deving on my plugin with eclipse for a while, this will make things even more useful, will check it out when I get some time.

Out of curiosity: Did you do anything more than what we have in our wiki here: http://wiki.xbmc.org/index.php?title=HOW...th_Eclipse to get things up and running ? I've had some problems with xbmc completely crashing if my script in xbmc crashes when run under the debugger, making things annoyingly useless for me. It might have to do with some error in the console I see, about xbmc not being able to locate a threading.py, but I haven't had the time yet to look into things, and my c++ isn't that strong.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
Reply
#13
I haven't experienced the crashing but the codebase I was doing remote debugging with is about a month old now (32124).

Also, I installed the PyDev source using "Option 2" from that page. I created an addon called script.module.pydev and put the source code in a lib directory. Then I threw an addon.xml file in there and it become accessible from other addons. The addon.xml file I used is:

Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.module.pydev"
       name="pydev-debug"
       version="1.5.9"
       provider-name="PyDev">
  <requires>
    <import addon="xbmc.python" version="1.0"/>
  </requires>
  <extension point="xbmc.python.module"
             library="lib" />
  <extension point="xbmc.addon.metadata">
    <platform>all</platform>
  </extension>
</addon>


... also, I'm running on Ubuntu.
Reply

Logout Mark Read Team Forum Stats Members Help
xbmcmodule compiled as a shared library for PyDev?0