Distutils: relative paths

F

Frans Englich

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
 
G

George Sakkis

Frans Englich said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top