logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
parser = argparse.ArgumentParser(description='Build Casa in a container')
parser.add_argument("-c", "--container", type=str, required=True,
help='Source code location f.e. /home/<user>/source')
parser.add_argument("-u", "--user", type=str, required=True, help='user')
parser.add_argument("-d", "--uid", type=str, required=True, help='uid')
parser.add_argument("--testtools", required=False, action='store_true', help='Run casatools tests')
parser.add_argument("--testtasks", required=False, action='store_true', help='Run casatasks tests')
parser.add_argument("-b", "--buildtarget", type=str, required=False, help='Use genmake to build casatools with. Default is bdist_wheel.')
parser.add_argument("-p", "--pythonversion", type=str, required=True, help='Python version. For example 3.6')
parser.add_argument('--debug', action='store_true', help='Print debug messages')
args = parser.parse_args()
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
logger.debug('Argument values:')
logger.debug(args.container)
logger.debug(args.buildtarget)
logger.debug(args.pythonversion)
container = args.container
pythonversion = args.pythonversion
testtools = args.testtools
testtasks = args.testtasks
tools_target = " --relwithdebinfo --stripsyms bdist_wheel"
tasks_target = "bdist_wheel"
shell_target = "bdist_wheel"
if args.buildtarget =="genmake":
mypath = os.path.dirname(os.path.abspath(__file__))
logger.debug("Script path: " + mypath)
print("Executing: " + cmd)
process = subprocess.Popen(cmd, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT, shell=True)
output = process.stdout.readline().decode('UTF-8')
if output == '' and process.poll() is not None: