def getTopdir(topfile, start=None):
 if (not start):
  start = os.getcwd()
 here = start
 toomany = 20
 while (toomany > 0):
  if os.path.exists(os.path.join(here, topfile)):
   return here
  next = os.path.dirname(here)
  if (next == here):
   break
  here = next
  toomany -= 1
 output(("Unable to find topfile '%s' anywhere from %s upwards" % (topfile, start)))
 sys.exit(1)

def getTopdir ( topfile , start = None ) : if ( not start ) : start = os . getcwd ( ) here = start toomany = 20 while ( toomany > 0 ) : if os . path . exists ( os . path . join ( here , topfile ) ) : return here next = os . path . dirname ( here ) if ( next == here ) : break here = next toomany -= 1 output ( ( "Unable to find topfile '%s' anywhere from %s upwards" % ( topfile , start ) ) ) sys . exit ( 1 )
walk upwards from the current directory until we find this topfile .