# Path: progSpec.py
# def cdlog(lvl, mesg):
#     global MaxLogLevelToShow
#     global lastLogMesgs
#     global highestLvl
#     highestLvl=lvl
#     resizeLogArray(lvl)
#     lastLogMesgs[lvl]=mesg
#     for i in range(highestLvl+1, len(lastLogMesgs)):
#         lastLogMesgs[i]=''
#     if(lvl<=MaxLogLevelToShow):
#         if(lvl==0): print('')
#         printAtLvl(lvl, mesg, '|    ')
# 
# def cdErr(mesg):
#     global lastLogMesgs
#     global highestLvl
#     highestLvl+=1
#     lastLogMesgs[highestLvl]="\n\nError: "+mesg
#     exit(1)


import progSpec
import os
import subprocess
import buildAndroid
import buildMac
import errno
import shutil
import checkSys
import environmentMngr as emgr
    import urllib.request
from progSpec import cdlog, cdErr
from pathlib import Path
    from git import Repo

            if 'buildCmd' in buildCmdMap:
                actualBuildCmd = buildCmdMap['buildCmd'][1:-1]
                for folderKey,folderVal in importantFolders.items():
                    actualBuildCmd = actualBuildCmd.replace('$'+folderKey,folderVal)
                #print("BUILDCOMMAND:", actualBuildCmd)#, "  INSTALL:", buildCmdsMap[platform][1])

                for toolName in tools:
                    if emgr.checkToolLinux('go' if toolName=='golang-go' else toolName):
                        runCmdStreaming(actualBuildCmd, downloadedFolder)
                    else:
                        packageManager = emgr.findPackageManager()
                        if not packageManager:
                            print(f"Unable to find Package Manager.\nPlease install manually : {packageName}")
                        else:
                            emgr.getPackageManagerCMD(toolName, packageManager)
                        runCmdStreaming(actualBuildCmd, downloadedFolder)

            if 'installFiles' in buildCmdMap:
                installfileList = buildCmdMap['installFiles'][1]
                # ~ installFiles = progSpec.extractListFromTagList(installfileList)
                # ~ print("    DATA:", str(installFiles)[:100])
                LibsFolder = os.path.join(packageDirectory, packageName, 'INSTALL').replace("\\","/")
                makeDirs(LibsFolder)
                importantFolders[packageName+'@Install'] = LibsFolder
                importantFolders[packageName] = packageDirectory + '/' + packageName + '/' + packageName
                includeFolders += "     '"+LibsFolder+"',\n"
                libFolders     += "     '"+LibsFolder+"',\n"
                for filenameX in installfileList:
                    filename = downloadedFolder+'/'+filenameX[0][0][1:-1]

# Path: progSpec.py
# def cdlog(lvl, mesg):
#     global MaxLogLevelToShow
#     global lastLogMesgs
#     global highestLvl
#     highestLvl=lvl
#     resizeLogArray(lvl)
#     lastLogMesgs[lvl]=mesg
#     for i in range(highestLvl+1, len(lastLogMesgs)):
#         lastLogMesgs[i]=''
#     if(lvl<=MaxLogLevelToShow):
#         if(lvl==0): print('')
#         printAtLvl(lvl, mesg, '|    ')
# 
# def cdErr(mesg):
#     global lastLogMesgs
#     global highestLvl
#     highestLvl+=1
#     lastLogMesgs[highestLvl]="\n\nError: "+mesg
#     exit(1)


# Path: buildDog.py
import progSpec
import os
import subprocess
import buildAndroid
import buildMac
import errno
import shutil
import checkSys
import environmentMngr as emgr
    import urllib.request
from progSpec import cdlog, cdErr
from pathlib import Path
    from git import Repo


            if 'buildCmd' in buildCmdMap:
                actualBuildCmd = buildCmdMap['buildCmd'][1:-1]
                for folderKey,folderVal in importantFolders.items():
                    actualBuildCmd = actualBuildCmd.replace('$'+folderKey,folderVal)
                #print("BUILDCOMMAND:", actualBuildCmd)#, "  INSTALL:", buildCmdsMap[platform][1])

                for toolName in tools:
                    if emgr.checkToolLinux('go' if toolName=='golang-go' else toolName):
                        runCmdStreaming(actualBuildCmd, downloadedFolder)
                    else:
                        packageManager = emgr.findPackageManager()
                        if not packageManager:
                            print(f"Unable to find Package Manager.\nPlease install manually : {packageName}")
                        else:
                            emgr.getPackageManagerCMD(toolName, packageManager)
                        runCmdStreaming(actualBuildCmd, downloadedFolder)

            if 'installFiles' in buildCmdMap:
                installfileList = buildCmdMap['installFiles'][1]
                # ~ installFiles = progSpec.extractListFromTagList(installfileList)
                # ~ print("    DATA:", str(installFiles)[:100])
                LibsFolder = os.path.join(packageDirectory, packageName, 'INSTALL').replace("\\","/")
                makeDirs(LibsFolder)
                importantFolders[packageName+'@Install'] = LibsFolder
                importantFolders[packageName] = packageDirectory + '/' + packageName + '/' + packageName
                includeFolders += "     '"+LibsFolder+"',\n"
                libFolders     += "     '"+LibsFolder+"',\n"
                for filenameX in installfileList:
                    filename = downloadedFolder+'/'+filenameX[0][0][1:-1]

                    cdlog(1, "Install: "+filename)