Distributing Packages / os independent installation folder

Andres Rosado arosado at softhome.net
Sat Jun 8 21:03:32 EDT 2002

At 06:01 AM 6/7/2002 -0400, you wrote:
>I'm building a python interface to ImageMagick. I already succeded in
>building an installer with distutils, but have some questions regarding
>- where should my package and shared librarie go to? On windows I put the
>dll into python22/DLLs and the rest into a folder
>python22/Lib/site-packages/ImageMagick. What to do on other plattforms? I
>don't expect a DLLs folder on Linux. ;-)
>- In my __init__.py I have to change one environment variable. Currently I
>do it like this:
>import os
>os.environ['MAGICK_HOME'] = r'C:\Python22\Lib\site-packages\ImageMagick'
>from _ImageMagick import *
>Is there an plattform independent way to get the installation folder of my
>package? On windows I can get the python folder from registry, but this will
>also break on linux.

I'm new at Python, but you could use wrap any platform-dependant code in if 
statements using the os.name like this:

if os.name == 'nt':
         #Whatever you are going to do in WinNT family
elif os.name == 'posix':
         #Whatever you are going to do in Linux
         print '''Sorry, we don't support your platform.
Maybe continue message here.

For the other questions, I don't know. :(

Andres Rosado
Email: andresr at despammed.com
ICQ: 66750646
Homepage: http://andres980.tripod.com/

All the world's a stage and most of us are desperately unrehearsed.
                 -- Sean O'Casey

More information about the Python-list mailing list