monome / libmonome

makes writing applications for Monomes easy.
ISC License
302 stars 158 forks source link

Python binding no longer gets built/fails building #54

Closed simonvanderveldt closed 6 years ago

simonvanderveldt commented 6 years ago

I guess this is caused by the update to waf 2.0 (or maybe waf's behaviour already changed in an earlier version).

First of all bld.env.CYTHON no longer gets set, no clue why yet. And when I change that so it forces building the python bindings waf errors with the following message

File /home/simon/src/forks/libmonome/bindings/python/monome.pyx has no mapping in ['.py', '.c', '.obj', '.o', '.pc.in'] (load a waf tool?)

There's probably a way to fix this, but I couldn't find anything useful in the waf docs. I was hoping the cython example in waf would be useful, but that has the same error :x https://github.com/waf-project/waf/issues/2047

wrl commented 6 years ago

you need to build your own waf executable with the tool included. clone the waf repo and do ./waf-light --tools=cython

simonvanderveldt commented 6 years ago

you need to build your own waf executable with the tool included. clone the waf repo and do ./waf-light --tools=cython

@wrl I manged to get it to work by including the waf cython tool which is part of the extra modules https://github.com/waf-project/waf/blob/master/waflib/extras/cython.py.

Which way would you prefer to fix this? Build the waf executable which includes the cython waf tool or include the above mentioned file in the repo?

wrl commented 6 years ago

would much prefer building the waf executable.

simonvanderveldt commented 6 years ago

would much prefer building the waf executable.

OK, I'll create a PR

coreyker commented 4 years ago

Just tried to build this with

./waf configure --enable-python --python=/usr/local/bin/python2.7
./waf build
./waf install

but the python bindings aren't showing up in /usr/local/lib/python2.7/site-packages, and import monome fails. Not sure if I'm doing something wrong as I thought this issue was resolved...

coreyker commented 4 years ago

I was able to build it manually by making a setup.py file with the contents:

from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize

ext_modules = [
    Extension("monome",
              sources=["monome.pyx"],
              libraries=["monome"]  # Unix-like specific
              )
]

setup(name="Demos",
      ext_modules=cythonize(ext_modules))

and invoking python setup.py build_ext --inplace