Distutils: relative paths

George Sakkis gsakkis at rutgers.edu
Sat Feb 19 20:22:15 EST 2005


"Frans Englich" <frans.englich at telia.com> wrote in message
news:mailman.2843.1108854701.22381.python-list at python.org...
>
> Hello,
>
> I have trouble installing a data directory which is not a child of my package
> directory in the source directory.
>
> My source directory looks like this:
>
> ./setup.py
> schemas/*.xsd
> foo/*.py
>
> And when it's installed, it should look like:
>
> site-packages/foo/*.py
> site-packages/foo/schemas/*.xsd
>
> In other words, schemas, from being a sibling of foo, became a child of foo.
>
> Now, how is this expressed in the setup.py?
>
> I tried this:
>
> setup( name="Foo",
>     packages=["foo"],
>     package_data={ "foo": ["../schemas/*.xsd"] },
>     package_dir={ "foo": "foo"},
> [...]
>
> but it resulted in schemas being a package, not child of foo(!).
>
> I've read the relevant page in the reference manual,
> http://www.python.org/doc/current/dist/node11.html
>
> but I can't find the trick. Any ideas?
>
>
> Cheers,
>
> Frans
>

If I interpret it correctly, "the files are expected to be part of the package in the source
directories" means that you cannot specify a sibling directory as package data, so the easiest way
is to make "schemas" child of foo. If this is not possible, you may check the 'data_files' option
(http://www.python.org/doc/current/dist/node12.html).

George





More information about the Python-list mailing list