0

So I created a setup.py script for my python program with distutils and I think it behaves a bit strange. First off it installs all data_files into /usr/local/my_directory by default which is a bit weird since this isn't a really common place to store data, is it?
I changed the path to /usr/share/my_directory/. But now I'm not able to write to the database inside that directory and I can't set required permission from within setup.py neither since the actual database file has not been created when I run it.

Is my approach wrong? Should I use another tool for distributing?
Because at least for Linux, writing a simple setup sh script seems easier to me at the moment.

1 Answer 1

1

The immediate solution is to invoke setup.py with --prefix=/the/path/you/want.

A better approach would be to include the data as package_data. This way they will be installed along side your python package and you'll find it much easier to manage it (find paths etc).

Sign up to request clarification or add additional context in comments.

2 Comments

Both options are not working. I'm still not able to access the database. /usr/share/ is owned by root by default so it's not that simple I fear.
I meant something like python setup.py --prefix ~/myapp. Regarding the second, the database will be installed relative to your package.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.