old_contents: #!/usr/bin/env python
  
  # ==================================================
  # open
  # --------------------------------------------------
  
  from __future__ import print_function
  from __future__ import absolute_import
  import os
  import sys
  import tct
  
  params = tct.readjson(sys.argv[1])
  facts = tct.readjson(params['factsfile'])
  milestones = tct.readjson(params['milestonesfile'])
  resultfile = params['resultfile']
  result = tct.readjson(resultfile)
  toolname = params['toolname']
  toolname_pure = params['toolname_pure']
  toolchain_name = facts['toolchain_name']
  workdir = params['workdir']
  loglist = result['loglist'] = result.get('loglist', [])
  exitcode = CONTINUE = 0
  
  
  # ==================================================
  # Make a copy of milestones for later inspection?
  # --------------------------------------------------
  
  if 0 or milestones.get('debug_always_make_milestones_snapshot'):
      tct.make_snapshot_of_milestones(params['milestonesfile'], sys.argv[1])
  
  
  # ==================================================
  # Helper functions
  # --------------------------------------------------
  
  deepget = tct.deepget
  
  def lookup(D, *keys, **kwdargs):
      result = deepget(D, *keys, **kwdargs)
      loglist.append((keys, result))
      return result
  
  
  # ==================================================
  # define
  # --------------------------------------------------
  
  TheProjectLog = None
  TheProjectBuild = None
  
  
  # ==================================================
  # Check params
  # --------------------------------------------------
  
  if exitcode == CONTINUE:
      loglist.append('CHECK PARAMS')
  
      TheProject = lookup(milestones, 'TheProject')
  
      if not (TheProject):
          exitcode = 22
  
  if exitcode == CONTINUE:
      loglist.append('PARAMS are ok')
  else:
      loglist.append('PROBLEMS with params')
  
  if CONTINUE != 0:
      loglist.append({'CONTINUE': CONTINUE})
      loglist.append('NOTHING to do')
  
  
  # ==================================================
  # work
  # --------------------------------------------------
  
  if exitcode == CONTINUE:
  
      TheProjectLog = TheProject + 'Log'
      if not os.path.exists(TheProjectLog):
          os.makedirs(TheProjectLog)
  
      TheProjectBuild = TheProject + 'Build'
      if not os.path.exists(TheProjectBuild):
          os.makedirs(TheProjectBuild)
  
  
  # ==================================================
  # Set MILESTONE
  # --------------------------------------------------
  
  if TheProjectBuild:
      result['MILESTONES'].append({'TheProjectBuild': TheProjectBuild})
  
  if TheProjectLog:
      result['MILESTONES'].append({'TheProjectLog': TheProjectLog})
  
  
  # ==================================================
  # save result
  # --------------------------------------------------
  
  tct.writejson(result, resultfile)
  
  # ==================================================
  # Return with proper exitcode
  # --------------------------------------------------
  
  sys.exit(exitcode)
  
new_contents: #!/usr/bin/env python
  
  # ==================================================
  # open
  # --------------------------------------------------
  
  from __future__ import print_function
  from __future__ import absolute_import
  import os
  import sys
  import tct
  
  params = tct.readjson(sys.argv[1])
  facts = tct.readjson(params['factsfile'])
  milestones = tct.readjson(params['milestonesfile'])
  resultfile = params['resultfile']
  result = tct.readjson(resultfile)
  toolname = params['toolname']
  toolname_pure = params['toolname_pure']
  toolchain_name = facts['toolchain_name']
  workdir = params['workdir']
  loglist = result['loglist'] = result.get('loglist', [])
  exitcode = CONTINUE = 0
  
  
  # ==================================================
  # Make a copy of milestones for later inspection?
  # --------------------------------------------------
  
  if 0 or milestones.get('debug_always_make_milestones_snapshot'):
      tct.make_snapshot_of_milestones(params['milestonesfile'], sys.argv[1])
  
  
  # ==================================================
  # Helper functions
  # --------------------------------------------------
  
  deepget = tct.deepget
  
  def lookup(D, *keys, **kwdargs):
      result = deepget(D, *keys, **kwdargs)
      loglist.append((keys, result))
      return result
  
  
  # ==================================================
  # define
  # --------------------------------------------------
  
  TheProjectLog = None
  TheProjectBuild = None
  TheProjectWebroot = None
  
  
  # ==================================================
  # Check params
  # --------------------------------------------------
  
  if exitcode == CONTINUE:
      loglist.append('CHECK PARAMS')
  
      TheProject = lookup(milestones, 'TheProject')
  
      if not (TheProject):
          exitcode = 22
  
  if exitcode == CONTINUE:
      loglist.append('PARAMS are ok')
  else:
      loglist.append('PROBLEMS with params')
  
  if CONTINUE != 0:
      loglist.append({'CONTINUE': CONTINUE})
      loglist.append('NOTHING to do')
  
  
  # ==================================================
  # work
  # --------------------------------------------------
  
  if exitcode == CONTINUE:
  
      TheProjectLog = TheProject + 'Log'
      if not os.path.exists(TheProjectLog):
          os.makedirs(TheProjectLog)
  
      TheProjectBuild = TheProject + 'Build'
      if not os.path.exists(TheProjectBuild):
          os.makedirs(TheProjectBuild)
  
      TheProjectWebroot = TheProject + 'Webroot'
      if not os.path.exists(TheProjectWebroot):
          os.makedirs(TheProjectWebroot)
  
  
  # ==================================================
  # Set MILESTONE
  # --------------------------------------------------
  
  if TheProjectBuild:
      result['MILESTONES'].append({'TheProjectBuild': TheProjectBuild})
  
  if TheProjectLog:
      result['MILESTONES'].append({'TheProjectLog': TheProjectLog})
  
  if TheProjectWebroot:
      result['MILESTONES'].append({'TheProjectWebroot': TheProjectWebroot})
  
  
  # ==================================================
  # save result
  # --------------------------------------------------
  
  tct.writejson(result, resultfile)
  
  # ==================================================
  # Return with proper exitcode
  # --------------------------------------------------
  
  sys.exit(exitcode)
  
subject: Add 'TheProjectWebroot' in run_20-Create-project-dirs.py