Anyways, if anybody finds it useful, feel free to play with it.
-tim
# various entries of the items as they would
# appear in the INSTALLED_APPS
APP1 = 'proj.app1'
APP2 = 'proj.app2'
APP3 = 'proj.app3'
APP4 = 'proj.app4'
APP5 = 'proj.app5'
APP6 = 'proj.app6'
APP7 = 'proj.app7'
APP8 = 'proj.app8'
APP9 = 'proj.app9'
# of the form KEY: [apps that KEY depends on]
DEPENDENCIES = {
APP2: [APP6, APP4, APP3],
APP5: [APP6, APP2],
APP6: [APP7, APP9, APP8],
}
# apps that you actually want in this deployment
SPECIFIED_APPS = [
APP1,
APP2,
]
def dependency_track(dependencies, specs):
results = set()
dependencys_to_process = specs
while dependencys_to_process:
dependency = dependencys_to_process.pop()
if dependency not in results:
results.add(dependency)
if dependency in dependencies:
dependencys_to_process.extend(
[d for d in dependencies[dependency] if d not in
results]
)
return tuple(results)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
) + dependency_track(DEPENDENCIES, SPECIFIED_APPS)
print INSTALLED_APPS
This looks interesting, and there was some discussion of something
similar for django (quite a while ago: [1]). Could you create a ticket
at code.djangoproject.com with a brief overview of how you did this,
to stimulate further discussion?
Thanks,
Simon G.
[1] http://groups.google.com/group/django-developers/msg/be076ab6855b9b9f
Ticket #4224 created with a fair bit of rambling description.
http://code.djangoproject.com/ticket/4224
Better more detail than insufficient detail, IMHO. :*)
-tim