[Distutils] Re: Mixing pure python and extension module and multi platform

M.-A. Lemburg mal@lemburg.com
Wed Mar 19 08:04:05 2003


Berthold H=F6llmann wrote:
> "M.-A. Lemburg" <mal@lemburg.com> writes:
>=20
>=20
>>Berthold H=F6llmann wrote:
>>
>>>"M.-A. Lemburg" <mal@lemburg.com> writes:
>>>
>>>>If you are using packages, that's the only way it works (you can't
>>>>have two parallel package structures with the same base name in
>>>>Python). If you are distributing the files as top-level files,
>>>>then this looks like a bug.
>>>
>>>So it is, I guess a bug. I build a small example:
>>
>>I don't think so...
>>
>>
>>>setup (name         =3D "pork.spam",
>>>       version      =3D "0.0.0",
>>>       description  =3D "just a test",
>>>       author       =3D 'Berthold H=F6llmann',
>>>       author_email =3D "hoel@GL-Group.com",
>>>       ext_modules  =3D [Extension('spam', ['spam.c'])],
>>>       package_dir =3D {'pork': '.'},
>>
>>          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>
>>
>>>       py_modules   =3D ['pork.pork'],
>>>)
>=20
>=20
> sorry, of course, but, I moved pork.py and __init__.py to the new
> generated pork subdirectory, removed the "package_dir" line and

You should also rename the py_modules entry to 'pork'.

>>python setup.py -n install

Uhm, where did you tell distutils to install in two different
directories for platform dependent and independent files ?

> Adding parser accelerators ...
> Done.
> running install
> running build
> running build_py
> copying pork/__init__.py -> build/lib.linux-i686-2.2/pork
> not copying pork/pork.py (output up-to-date)
> running build_ext
> skipping 'spam' extension (up-to-date)
> running install_lib
> copying build/lib.linux-i686-2.2/pork/pork.py -> /usr/local/fitools/san=
dbox/linux/lib/python2.2/site-packages/pork
> copying build/lib.linux-i686-2.2/spam.so -> /usr/local/fitools/sandbox/=
linux/lib/python2.2/site-packages
> error: file '/usr/local/fitools/sandbox/linux/lib/python2.2/site-packag=
es/pork/pork.py' does not exist
> [16946 refs]
>=20
> Do you accept this as an error?

No, because 'pork.pork' is not allowed in py_modules (it's a hack
that sometimes works, but not intended as feature AFAIK).

--=20
Marc-Andre Lemburg
eGenix.com

Professional Python Software directly from the Source  (#1, Mar 19 2003)
 >>> Python/Zope Products & Consulting ...         http://www.egenix.com/
 >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________
Python UK 2003, Oxford:                                     13 days left
EuroPython 2003, Charleroi, Belgium:                        97 days left