[sword-devel] cmake python

Ben cricketc at gmail.com
Mon Dec 17 04:32:01 MST 2012


On 12/17/2012 12:40 AM, Greg Hellings wrote:
> On Sat, Dec 1, 2012 at 9:44 PM, Ben <cricketc at gmail.com> wrote:
>> On 11/21/2012 10:27 PM, Ben wrote:
>>>
>>> Hello,
>>>
>>> A couple thoughts related to building python bindings with cmake:
>>>
>>> 1. <build dir>/bindings/swig/python/setup.py has the following line:
>>> #!/usr/bin/python python
>>> Looks like that should just be /usr/bin/python, or /usr/bin/env python?
>>>
>>> 2. It'd be nice to be able to install the python module to some
>>> non-standard location, so as to not require root access or conflict with
>>> system packages.
>>> <source dir>/bindings/swig/python/install.cmake - I added --user to the
>>> python setup.py install command, and that installed it just to my user
>>> directory. That doesn't require root access, although it still might
>>> conflict some with a system package. Another option might be to just
>>> install the python bindings to the same custom prefix as the sword
>>> library? Not sure what the best way is to implement this option.
>>
>>
>> I'm attaching a patch that corrects number 1. For number 2, I set it up to
>> allow installing the python Sword module to the user's directory, if
>> -DPYTHON_USER_INSTALL=Yes is passed to the cmake command. If the option's
>> not there, it just operates as normal.
>
> I committed a fix for 1. It's more of a linting issue than a functional issue.

Agreed.

>>
>> I tried to set it up with running "python setup.py install --home=<dir>",
>> but I didn't get it working with directories with spaces in the path.
>
> I'll experiment with some ways to do this. I have already done a solid
> reworking of the Python build and install process and cleaned up quite
> a few warnings since the last SWORD release so they build much more
> cleanly now. This is a good change to have as well.
>
> The cmake install system should allow quite a bit more ease of
> flexibility for configuring and installing to target locations. I will
> try to remember to add this when I add that functionality as well.

Cool, thanks. Also, I was looking at the tests, and it didn't look to me 
like cmake was building the tests directory properly, so I actually went 
back to using the old build system. If you want to commit any changes to 
build the tests, that would be helpful to me (or maybe I missed 
something...).

-Ben



More information about the sword-devel mailing list