#!/usr/bin/python ## # NAME # getdeps.py # # SYNOPSIS # getdeps.py package # # DESCRITPTION # builds list of dependent packages # # VERSION # 1.1.0 # 20050227 # # AUTHOR # marius schamschula # marius (a) physics.aamu.edu ## import commands, os, sys P = [] P = [sys.argv[1]] dp = commands.getoutput('echo $DEVDIR') print "Packages depending on " + P[0] + "\n" filenames = os.listdir(dp + "/") i = filenames.index('.DS_Store') del filenames[i] i = filenames.index('etc') del filenames[i] i = filenames.index('man') del filenames[i] while P: for f in filenames: portfiles = os.listdir(dp + "/" + f + "/") for p in portfiles: if '.port' in p: varfile = open(dp + "/" + f + "/" + p, 'r') L = varfile.readlines() for x in L: x = x.split("=") if x[0] == "DEPS": x = x[1].replace('"', '') x = x.split() for z in x: if z == P[0]: sname = p.replace('.port', '') print sname P.append(f) del P[0]