[sword-devel] python3 module ?

Greg Hellings greg.hellings at gmail.com
Wed Jun 12 10:28:08 MST 2019


Ah, perhaps I am not building the Python 3 bindings for EPEL, because
that's a beast and EPEL has Python 2 by default. So rather than keep
up with the backport treadmill on EPEL7, I stuck with just Python 2
bindings. However, you can see here in the Fedora spec file how the
Python 3 bindings are being built. Notice, though, that there are a
few minor patches I apply to 1.8.1 (but which should all be present in
SVN master branch) in order to get it to build.

https://src.fedoraproject.org/rpms/sword/blob/master/f/sword.spec

The notable parts are

       -DSWORD_PYTHON_3:BOOL=TRUE \

In 1.8.1 the language I use for building Python 2/3 changed to support
building both out of the same source. This required creating separate
bool values for both py2 and py3 and allowing both to be built
simultaneously. The most important patch to the source that should
enable that is https://src.fedoraproject.org/rpms/sword/blob/master/f/sword-1.8.1-swig.diff
along with https://src.fedoraproject.org/rpms/sword/blob/master/f/sword-1.8.1-cmake.diff.

I would like to get a 1.8.2 wrapped up once Troy is finished with his
Bishop 1.2.0 work, and include quite a few fixes. However, I have not
had access to our Jenkins CI system for some time. I'll need to work
with Troy to get that back so I can update release procedures and
bundle up 1.8.2 to include things like the Python binding build fixes.

--Greg


On Wed, Jun 12, 2019 at 12:05 PM pierre amadio <amadio.pierre at gmail.com> wrote:
>
> Hello !
>
> I do not have access to the debian box i had trouble with when i wrote
> the mail (i should have access to it again in some weeks or monthes),
> but it was a debian stable with sword 1.8.1
>
> i kept note on the way i build things usually with python2 here:
> https://github.com/pierre-amadio/SwordSandBox/blob/master/notes.txt
>
> as well as how i try to do thing with python3:
> https://github.com/pierre-amadio/SwordSandBox/blob/master/python/ankistuff/notes.txt
>
> When i succeed building something that worked in an ugly way (changing
> stuff manually) as above, it was on a RHEL7.5 with sword 1.8.1, on a
> box i have still access to (my main laptop).
>
> I did not use any configure switched to mention i wanted python3
> binding, so i guess this is what i missed, but i m still puzzled:
>
> - On the sword-1.8.1-3.el7.src.rpm that comes with epel, the spec file
> is set to build a python module indeed, but i do not undertsand how it
> is supposed to pick python3 (i must admit i m not really used to
> cmake).
>
> %cmake -DLIBSWORD_LIBRARY_TYPE=Shared \
>        -DSWORD_BINDINGS="Python" \
> ...
> ...
> and later, in the files section, it looks like a macro speciffically
> mention python2:
>
> %files python
> %{python2_sitearch}/Sword.py
>
> - I try to see what switch was available with the build process i was used to:
>
> cd sword-1.8.1
> ./autogen.sh
> #not finding python3 specific stuff here
> ./configure --prefix=/usr/local/sword --with-clucene --with-curl_sftp
> --enable-examples
> make
> make install
> make install_config
>
> And then building the python module:
>
> cd ~/tmp/sword-1.8.1/bindings/swig/package
> ./autogen.sh
> #Here the configure let me specify with python version i m interested
> in. Let s try:
> ./configure PKG_CONFIG_PATH=/usr/local/sword/lib/pkgconfig
> CPPFLAGS="-I/usr/local/sword/include/" --with-python=/usr/bin/python3
>
> But it does not look good:
>
> #######################
> checking for Python prefix...
> checking for Python exec-prefix...
> checking for Python version...   File "<string>", line 1
>     import string,operator; print
> operator.getitem(string.split(string.__file__,'/'),-2)
>                                          ^
> SyntaxError: invalid syntax
>
> checking for Python header files...
> checking for Python library... Not found
> ########################
>
> So i cannot continue with the expected:
>
> make pythonswig
> PKG_CONFIG_PATH=/usr/local/sword/lib/pkgconfig
> CPPFLAGS="-I/usr/local/sword/include/" make python_make
>
> Is it having problem with system where both python2 and python3 are installed ?
>
>
>
> On Wed, 12 Jun 2019 at 00:46, Greg Hellings <greg.hellings at gmail.com> wrote:
> >
> > What version are you trying with? What error message are you getting?
> >
> > The bindings have supported python2/3 for quite some time using nothing more than a configure time switch. I build both for Fedora/EPEL, as can be seen in the official spec file.
> >
> > --Greg
> >
> > On Sun, Jun 9, 2019, 13:03 pierre amadio <amadio.pierre at gmail.com> wrote:
> >>
> >> Hello.
> >>
> >> Some times ago, i managed to build a python3 sword module with some
> >> hack (changing manually the content of the setup.py genrated by make
> >> pythonswig because subprocess.run does not work in python3).
> >> This was on a Red Hat based box.
> >> Now that i try again on Debian, the make pythonswig process itself fail.
> >>
> >> Is there any plan to have official support for python3 in a future release ?
> >>
> >> Is there by any chance already a branch of some devel tree i could
> >> clone and get a local version of sword with pyton3 module ?
> >>
> >> _______________________________________________
> >> sword-devel mailing list: sword-devel at crosswire.org
> >> http://www.crosswire.org/mailman/listinfo/sword-devel
> >> Instructions to unsubscribe/change your settings at above page
> >
> > _______________________________________________
> > sword-devel mailing list: sword-devel at crosswire.org
> > http://www.crosswire.org/mailman/listinfo/sword-devel
> > Instructions to unsubscribe/change your settings at above page
>
> _______________________________________________
> sword-devel mailing list: sword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/sword-devel
> Instructions to unsubscribe/change your settings at above page



More information about the sword-devel mailing list