old_contents: #!/usr/bin/env python
  import os
  import subprocess
  import re
  import sys
  
  scriptRoot=os.path.dirname(os.path.realpath(__file__))
  projectRoot=os.path.dirname(scriptRoot)
  
  os.chdir(projectRoot)
  
  # SBT now includes colour codes in the output. We need to strip them.
  # This solution uses a regex to match and substitute them. Regex taken from
  # http://superuser.com/questions/380772/removing-ansi-color-codes-from-text-stream
  def remove_colour_codes(string):
  	ccrgx = re.compile('\\x1b\[[0-9;]*m')
  	return ccrgx.sub('', string)
  
  # Get data from SBT
  print("Classpath: ")
  classpath = remove_colour_codes(subprocess.check_output(["sbt", "show runtime:fullClasspath"]).decode())
  print(classpath)
  
  print("mainClasses: ")
  mainClasses = remove_colour_codes(subprocess.check_output(["sbt", "show discoveredMainClasses"]).decode())
  print(mainClasses)
  
  print("javaOptions: ")
  javaOptions = remove_colour_codes(subprocess.check_output(["sbt", "show javaOptions"]).decode())
  print(javaOptions)
  
  # Build a regex to match mainclasses and java options
  mcjoRegex = re.compile("\[info\] \* (.*)")
  
  # Extract the classes 
  mainClasses = mcjoRegex.findall(mainClasses)
  print("Discovered mainClasses: ")
  for mc in mainClasses: 
  	print("\t - " + mc)
  
  # And Java options
  javaOptions = mcjoRegex.findall(javaOptions)
  print("Discovered javaOptions: ")
  for jo in javaOptions: 
  	print("\t - " + jo)
  
  # Start building a comannd to print to a file
  command = "#!/bin/bash\n\njava "
  
  # Add java options
  command += ' '.join(javaOptions)
  
  command += " -cp "
  
  # Add things from classpath
  command += ':'.join(re.compile("Attributed\(([^\)]*)\)").findall(classpath))
  
  # make a folder to store the compiled scripts
  subprocess.call(["mkdir", "-p", "compiled_scripts"])
  
  # for each of the mainclasses, build a runscript
  for clazz in mainClasses:
  	finalCommand = command + " " + clazz + " $*\n"
  	fileName = scriptRoot + "/compiled_scripts/" + clazz.split(".")[-1]
  	f = open(fileName, "w")
  	f.write(finalCommand)
  	f.close()
  	subprocess.call(["chmod", "u+x", fileName])
  	print("Created a script for " + clazz)
  
new_contents: #!/usr/bin/env python
  import os
  import subprocess
  import re
  import sys
  
  scriptRoot=os.path.dirname(os.path.realpath(__file__))
  projectRoot=os.path.dirname(scriptRoot)
  
  os.chdir(projectRoot)
  
  # SBT now includes colour codes in the output. We need to strip them.
  # This solution uses a regex to match and substitute them. Regex taken from
  # http://superuser.com/questions/380772/removing-ansi-color-codes-from-text-stream
  def remove_colour_codes(string):
  	ccrgx = re.compile('\\x1b\[[0-9;]*m')
  	return ccrgx.sub('', string)
  
  # Get data from SBT
  print("Classpath: ")
  classpath = remove_colour_codes(subprocess.check_output(["sbt", "show runtime:fullClasspath"]).decode())
  print(classpath)
  
  print("mainClasses: ")
  mainClasses = remove_colour_codes(subprocess.check_output(["sbt", "show discoveredMainClasses"]).decode())
  print(mainClasses)
  
  print("javaOptions: ")
  javaOptions = remove_colour_codes(subprocess.check_output(["sbt", "show javaOptions"]).decode())
  print(javaOptions)
  
  # Build a regex to match mainclasses and java options
  mcjoRegex = re.compile("\[info\] \* (.*)")
  
  # Extract the classes 
  mainClasses = mcjoRegex.findall(mainClasses)
  print("Discovered mainClasses: ")
  for mc in mainClasses: 
  	print("\t - " + mc)
  
  # And Java options
  javaOptions = mcjoRegex.findall(javaOptions)
  print("Discovered javaOptions: ")
  for jo in javaOptions: 
  	print("\t - " + jo)
  
  # Start building a comannd to print to a file
  command = "#!/bin/bash\n\njava "
  
  # Add java options
  command += ' '.join(javaOptions)
  
  command += " -cp "
  
  # Add things from classpath
  command += ':'.join(re.compile("Attributed\(([^\)]*)\)").findall(classpath))
  
  # make a folder to store the compiled scripts
  subprocess.call(["mkdir", "-p", scriptRoot + "compiled_scripts"])
  
  # for each of the mainclasses, build a runscript
  for clazz in mainClasses:
  	finalCommand = command + " " + clazz + " $*\n"
  	fileName = scriptRoot + "/compiled_scripts/" + clazz.split(".")[-1]
  	f = open(fileName, "w")
  	f.write(finalCommand)
  	f.close()
  	subprocess.call(["chmod", "u+x", fileName])
  	print("Created a script for " + clazz)
  
subject: Fix compiled_scripts folder creation in buildRunScripts-SBT-13.13.py script