[Image-SIG] now is the time...

Bernhard Herzog herzog@online.de
10 Feb 1999 20:26:07 +0100


"Fredrik Lundh" <fredrik@pythonware.com> writes:

> Bernhard Herzog wrote:
> >What I'd like to see in the final version of PIL is a standard way to
> >install the C headerfiles. I'd suggest to put them into a subdirectory
> >where the standard Python headers are installed (e.g.
> >/usr/local/include/python1.5/Extensions/).
> 
> I agree, but I currently lack the time and clues needed to
> do something intelligent about this.   Maybe someone else
> could come up with a good solution, and a patch or two?


I see two possible solutions for this:

1) extend Makefile.pre.in to install the package (the current install
   target would just install _imaging.so in the site-packages directory)
   This solution would probably be only useful for UNIX-like systems.

2) write an install script in Python for portability.


I'm in favor of 2) and I'd be willing to adapt the setup.py script I've
written for the new Sketch release.

So, my proposal would be a script install.py that installs PIL as a
package in

os.path.join(sys.prefix, 'lib', 'python' + sys.version[:3], 'site-packages')

and the header-files in 

os.path.join(sys.prefix, 'include', 'python' + sys.version[:3], 'Extensions')

The site-package directory could alternatively be determined from
sys.path or by grepping through the generated Makefile.

The script would, of course, have some command-line options to override
the defaults.

I think this would be enough for UNIX-like systems.



Questions:

1) How would this have to be done in Windows?

2) Which header-files have to be installed? Sketch only needs Imaging.h,
   ImConfig.h and ImPlatform.h.


The issue of the header files also raises the question of the public
C-interface of PIL. I.e. which structures and functions can be safely
used by third party modules such as Sketch and how to get the function
pointers?

I don't know whether it is really necessary to be able to access the
functions from C, in most cases it is much simpler and not significantly
slower to do that from Python code. Sketch at least only needs the
declarations of the image structs to access the data, it doesn't call
any PIL functions from C.


Any comments or other suggestions?


-- 
Bernhard Herzog	  | Sketch, a python based drawing program
herzog@online.de  | http://www.online.de/home/sketch/