Le 10/04/2013 11:47, Armin Rigo a �crit :
> I hope you're not afraid to use ffi.verify(), like some persons seem
> to be.
I would like to say that avoiding .verify() is not only based on
irrational fear. There are real reasons to prefer .dlopen(), especially
when you want other people to use your project.
The upside of using .verify() instead of .dlopen() exist because it uses
a C compiler. The downside is that it requires a C compiler.
The documentation says:
> If you use CFFI and verify() in a project that you plan to
> distribute, other users will install it on machines that may not have
> a C compiler. Here is how to write a setup.py script using distutils
> in such a way that the extension modules are listed too. This lets
> normal setup.py commands compile and package the C extension modules
> too.
But this is misleading. Although such a setup means that a C compiler is
not used at runtime, it is still required when installing from source
which often happens on the same machine.
When I tell my users to run "pip install weasyprint", they don�t want to
know about cairocffi or CFFI. Some don�t even what to know about Python.
If they happen to be on Windows, there is a very low probability that
they have a functional C compiler.
Even when the system does have a compiler, it�s not always obvious how
to configure it (include_dirs, library_dirs, �) in a way that works of
different systems.
On the other hand, I don�t want to maintain a bunch of pre-compiled
distributions for a bunch of platforms (that I may not have access to)
and a bunch of Python versions.
So far, pure-Python source distributions on PyPI and using .dlopen() is
the only viable scenario that I found for users on all kinds of platforms.
(Someone else is maintaining pre-compiled builds for CFFI:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#cffi )
But if there are work-arounds for the these issues, I�d love to hear
about it!
Cheers,
--
Simon Sapin