[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Ideal directory structure?

There's no particular message I want to reply to: just wanted to signal
that I find the structure


the most practical to get appname running in both installed and
uninstalled mode - which I do find very useful for most applications.

Then, in my apps, I put

not_installed_dir = os.path.dirname(os.path.realpath(__file__))
if os.path.exists(not_installed_dir + '/stuff/appname.svg'):
    STUFF_DIR = not_installed_dir + '/stuff'
    LOCALE_DIR = not_installed_dir + '/locale'
    for directory in [sys.prefix, sys.prefix + '/local']:
        installed_root_dir = directory + '/share'
        if os.path.exists(installed_root_dir +
            STUFF_DIR = installed_root_dir +
            LOCALE_DIR = installed_root_dir + '/locale'

... and then put STUFF_DIR in the path of files I need (and import
normally the modules/packages).

What I ignore is: is there some smarter (than [sys.prefix, sys.prefix +
'/local']) way to check possible _installed_ locations?


Reply to: