EnvConfig.TestEnvOps Namespace Reference

Classes

class  TempDir
 
class  TemporaryDir
 
class  Test
 

Functions

def buildDir
 

Variables

 saved_processors = Variable.processors
 

Detailed Description

Created on Jul 12, 2011

@author: mplajner

Function Documentation

def EnvConfig.TestEnvOps.buildDir (   files,
  rootdir = os.curdir 
)
Create a directory structure from the content of files.

@param files: a dictionary or list of pairs mapping a filename to the content
              if the content is a dictionary, recurse
@param rootdir: base directory

Definition at line 21 of file TestEnvOps.py.

21 def buildDir(files, rootdir=os.curdir):
22  '''
23  Create a directory structure from the content of files.
24 
25  @param files: a dictionary or list of pairs mapping a filename to the content
26  if the content is a dictionary, recurse
27  @param rootdir: base directory
28  '''
29  if type(files) is dict:
30  files = files.items()
31 
32  # ensure that the root exists (to allow empty directories)
33  if not os.path.exists(rootdir):
34  os.makedirs(rootdir)
35 
36  # create all the entries
37  for filename, data in files:
38  filename = os.path.join(rootdir, filename)
39  if type(data) is dict:
40  buildDir(data, filename)
41  else:
42  d = os.path.dirname(filename)
43  if not os.path.exists(d):
44  os.makedirs(d)
45  f = open(filename, "w")
46  if data:
47  f.write(data)
48  f.close()
49 
string type
Definition: gaudirun.py:151

Variable Documentation

EnvConfig.TestEnvOps.saved_processors = Variable.processors

Definition at line 16 of file TestEnvOps.py.