Show
Ignore:
Timestamp:
06/24/06 09:40:42 (7 years ago)
Author:
mk
Message:

Added support for eggs (closes ticket #34).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/mk/cheesecake/util.py

    r58 r75  
    99PAD_VALUE = 4 
    1010 
    11 def run_cmd(cmd): 
    12     """ 
    13     Run command and return its return code and its output 
     11def run_cmd(cmd, env=None): 
     12    """Run command and return its return code and its output. 
    1413    """ 
    1514    arglist = cmd.split() 
    1615    try: 
    17         p = Popen(arglist, stdout=PIPE, stderr=STDOUT
     16        p = Popen(arglist, stdout=PIPE, stderr=STDOUT, env=env
    1817    except ProcessError, e: 
    1918        return 1, e 
     
    149148    tarinfo = t.members[0] 
    150149    return tarinfo.name.split(os.sep)[0] 
     150 
     151def mkdirs(dir): 
     152    """Make directory with parent directories as needed. 
     153 
     154    Don't throw an exception if directory exists. 
     155    """ 
     156    parts = dir.split(os.path.sep) 
     157    for length in xrange(1, len(parts)+1): 
     158        path = os.path.sep.join([''] + parts[:length]) 
     159        if not os.path.exists(path): 
     160            os.mkdir(path)