Arranging a dependency tree

Paul McGuire ptmcg at austin.rr._bogus_.com
Fri Aug 13 21:51:55 EDT 2004


"Kyle Root" <kyleroot at gmail.com> wrote in message
news:6ccff37a.0408111831.6eb25a4e at posting.google.com...
> I'm working on a little practice program, but I've become stuck and am
> now utterly confused :?
>
> I've created a jumble of python modules, in each one is a tuple that
> goes something like,
>
> deps = ("file10","file7","file3").
>
> And some have no dependencies at all.  I have one file called "start",
> and the whole thing makes a tree of dependencies as each file has deps
> and their deps might have deps, and so on.  What I'm trying to do is
> "straighten" them or put them in order as if they were to be
> installed.  Basically I'm trying to replicate the way portage does it.
> :)
>
> I've been thinking about this for a few days but I always get lost.
> So far I have a has_deps(filename) function, and not much else. I get
> stuck on the actual changing the files from the random jumble to a
> into a nice orderly list of files.    One problem that I can't
> overcome is when I'm a couple of deps in and I finally get to the
> files that don't require anything, I have no way of getting back to do
> the parent file's other deps. (Does that make any sense?)
>
> Basically I was wondering if anyone had any tips or pointers, or knew
> of any dependency resolving algorithms...
>
> Thanks,
> Kyle

Look into using pydot if you want to actually draw the trees/graphs.

-- Paul





More information about the Python-list mailing list