Reputation: 8246
So I'm in the following situation. I have a package generated with py2app. This has it's own structure and my projects sources are located in:
/dist.app/Contents/Resources/lib/python2.7/my_project
Now this works fine, however I want to give the possibility that developers add their own code where they want. So going trough all those folders every time seems rather ugly. So I was thinking I could try and (if possible):
1. Get the my_project folder at the top level, next to dist.app
2. Create only a link in the lib folder similar to what distutils `python setup.py develop` does.
But I'm rather stuck here. So far what I attempted was (from the unpackaged project):
Do a python setup.py develop
of my project. Go to python's site-packages and copy the my_project.egg-link
generated there into the above mentioned place. Edit it , as it's just a path to the actual project accordingly.
Copy the my_project.egg-info
that is generated next to the my_project folder.
This however doesn't seem to work. I also tried the easiest solution I could and create a MacOS alias of the folder which doesn't work either.
Any suggestions?
Regards, Bogdan
Upvotes: 0
Views: 157
Reputation: 10846
Are you talking about creating a plugin system for your app? The usual way to do this is have a directory somewhere that is designated the "plugins" directory - any folders in there are loaded as plugins. You could either hardcode this path or make it configurable using the application ui or a configuration file.
You can manipulate the Python path at runtime in your app to include the plugins directory. The path is available as a read/write list at sys.path or you can use site.addsitedir.
Upvotes: 1