# Path: md/git.py
# def isGitInstalled():
# def isGitRepo(location):
# def gitCheckout(repoLocation, outPath):
# 
# Path: md/hg.py
# def isHgInstalled():
# def isHgRepo(location):
# def hgCheckout(repoLocation, outPath):
# 
# Path: md/logger.py
# def secondsToHMS(seconds=0):
# def Logger():
# def setLogger(loggerName="", logOutputDir=""):
# def close():
# def writeMessage(message, targetName="", targetStep="", forceStdOut=False):
# def writeError(message, targetName="", targetStep="", filePath="", lineNumber=0, exitProgram=False):
# def reportSkipped(targetName="", targetStep="", reason=""):
# def reportStart(targetName="", targetStep=""):
# def reportSuccess(targetName="", targetStep="", timeInSeconds=0):
# def reportFailure(targetName="", targetStep="", timeInSeconds=0, returnCode=0, exitProgram=False):
# def getOutFd(targetName="", targetStep=""):
# def getErrorFd(targetName="", targetStep=""):
#     def _writeStdOut(self, message):
#     def _writeStdErr(self, message):
#     def close(self):
#     def writeMessage(self, message, targetName="", targetStep=""):
#     def writeError(self, message, targetName="", targetStep="", filePath="", lineNumber=0, exitProgram=False):
#     def reportSkipped(self, targetName="", targetStep="", reason=""):
#     def reportStart(self, targetName="", targetStep=""):
#     def reportSuccess(self, targetName="", targetStep="", timeInSeconds=0):
#     def reportFailure(self, targetName="", targetStep="", timeInSeconds=0, returnCode=0, exitProgram=False):
#     def getOutFd(self, targetName="", targetStep=""):
#     def getErrorFd(self, targetName="", targetStep=""):
# class LoggerBase(object):
# 
# Path: md/python.py
# def parsePythonCommand(command):
# def callPythonCommand(namespace, function, target, options, project):
#     def __init__(self):
# class PythonCallInfo(object):
# 
# Path: md/steps.py
# def fetch(pythonCallInfo):
# def unpack(pythonCallInfo):
# 
# Path: md/svn.py
# def isSvnInstalled():
# def isSvnRepo(location):
# def svnCheckout(repoLocation, outPath, outfd=None):
# 
# Path: md/utilityFunctions.py
# def boolToStr(s):
# def downloadFile(URL, downloadDir):
# def executeCommand(command, args="", workingDirectory="", verbose=False, exitOnError=False):
# def executeSubProcess(command, workingDirectory=tempfile.gettempdir(), outFileHandle=1, verbose=False, exitOnError=False):
# def findFilesWithExtension(path, extension):
# def findShallowestFile(startPath, fileList):
# def getBasename(path):
# def haveWriteAccess(path):
# def isURL(url):
# def __pathExists(directory, basename):
# def pathExists(path, forceCaseSensitive=False):
# def prettyPrintList(list, header="", headerIndent="", itemIndent=""):
# def printErrorAndExit(errorStr, filePath="", lineNumber=0):
# def removeDir(path):
# def removeDuplicatesFromList(myList):
# def splitFileName(fileName):
# def stripItemsInList(value):
# def untar(tarPath, outPath="", stripDir=False):
# def unzip(zipPath, outPath="", stripDir=False):
# def URLToFilename(url):
# def hasTarFileExtension(path):
# def validateCompressedFile(path, logger=None):
# def setVariables(filename, variableList):
# def is_exe(fpath):
# def isInstalled(program):


import os, sys, tarfile, unittest, zipfile, mdTestUtilities
from md import git, hg, logger, python, steps, svn, utilityFunctions
            pci = steps.fetch(pci)
            testFilePath = os.path.join(pci.outputPath, mdTestUtilities.testFileName)
            self.assertEqual(pci.success, True, "Cvs repository failed to fetch.")
            self.assertEqual(os.path.exists(testFilePath), True, "'" + mdTestUtilities.testFileName + "' did not exist after fetching a Cvs repository.")
            pci = steps.unpack(pci)
            self.assertEqual(pci.success, True, "Cvs repository failed to unpack.")
            self.assertEqual(os.path.isdir(pci.currentPath), True, "Cvs repository was not a directory after unpacking.")
            self.assertEqual(os.path.exists(os.path.join(pci.currentPath, mdTestUtilities.testFileName)), True, "testFile did not exist after unpacking.")
        finally:
            utilityFunctions.removeDir(tempDir)

    def test_unpackGit(self):
        if not git.isGitInstalled():
            self.fail("Git is not installed on your system.  All Git tests will fail.")
        try:
            tempDir = mdTestUtilities.makeTempDir()
            repoPath = mdTestUtilities.createGitRepository(tempDir)
            pci = createPythonCallInfo(repoPath, os.path.join(tempDir, "output"), os.path.join(tempDir, "download"))
            pci = steps.fetch(pci)
            testFilePath = os.path.join(pci.outputPath, mdTestUtilities.testFileName)
            self.assertEqual(pci.success, True, "Git repository failed to fetch.")
            self.assertEqual(os.path.exists(testFilePath), True, "'" + mdTestUtilities.testFileName + "' did not exist after fetching a Git repository.")
            pci = steps.unpack(pci)
            self.assertEqual(pci.success, True, "Git repository failed to unpack.")
            self.assertEqual(os.path.isdir(pci.currentPath), True, "Git repository was not a directory after unpacking.")
            self.assertEqual(os.path.exists(os.path.join(pci.currentPath, mdTestUtilities.testFileName)), True, "testFile did not exist after unpacking.")
        finally:
            utilityFunctions.removeDir(tempDir)

    def test_unpackHg(self):

# Path: md/git.py
# def isGitInstalled():
# def isGitRepo(location):
# def gitCheckout(repoLocation, outPath):
# 
# Path: md/hg.py
# def isHgInstalled():
# def isHgRepo(location):
# def hgCheckout(repoLocation, outPath):
# 
# Path: md/logger.py
# def secondsToHMS(seconds=0):
# def Logger():
# def setLogger(loggerName="", logOutputDir=""):
# def close():
# def writeMessage(message, targetName="", targetStep="", forceStdOut=False):
# def writeError(message, targetName="", targetStep="", filePath="", lineNumber=0, exitProgram=False):
# def reportSkipped(targetName="", targetStep="", reason=""):
# def reportStart(targetName="", targetStep=""):
# def reportSuccess(targetName="", targetStep="", timeInSeconds=0):
# def reportFailure(targetName="", targetStep="", timeInSeconds=0, returnCode=0, exitProgram=False):
# def getOutFd(targetName="", targetStep=""):
# def getErrorFd(targetName="", targetStep=""):
#     def _writeStdOut(self, message):
#     def _writeStdErr(self, message):
#     def close(self):
#     def writeMessage(self, message, targetName="", targetStep=""):
#     def writeError(self, message, targetName="", targetStep="", filePath="", lineNumber=0, exitProgram=False):
#     def reportSkipped(self, targetName="", targetStep="", reason=""):
#     def reportStart(self, targetName="", targetStep=""):
#     def reportSuccess(self, targetName="", targetStep="", timeInSeconds=0):
#     def reportFailure(self, targetName="", targetStep="", timeInSeconds=0, returnCode=0, exitProgram=False):
#     def getOutFd(self, targetName="", targetStep=""):
#     def getErrorFd(self, targetName="", targetStep=""):
# class LoggerBase(object):
# 
# Path: md/python.py
# def parsePythonCommand(command):
# def callPythonCommand(namespace, function, target, options, project):
#     def __init__(self):
# class PythonCallInfo(object):
# 
# Path: md/steps.py
# def fetch(pythonCallInfo):
# def unpack(pythonCallInfo):
# 
# Path: md/svn.py
# def isSvnInstalled():
# def isSvnRepo(location):
# def svnCheckout(repoLocation, outPath, outfd=None):
# 
# Path: md/utilityFunctions.py
# def boolToStr(s):
# def downloadFile(URL, downloadDir):
# def executeCommand(command, args="", workingDirectory="", verbose=False, exitOnError=False):
# def executeSubProcess(command, workingDirectory=tempfile.gettempdir(), outFileHandle=1, verbose=False, exitOnError=False):
# def findFilesWithExtension(path, extension):
# def findShallowestFile(startPath, fileList):
# def getBasename(path):
# def haveWriteAccess(path):
# def isURL(url):
# def __pathExists(directory, basename):
# def pathExists(path, forceCaseSensitive=False):
# def prettyPrintList(list, header="", headerIndent="", itemIndent=""):
# def printErrorAndExit(errorStr, filePath="", lineNumber=0):
# def removeDir(path):
# def removeDuplicatesFromList(myList):
# def splitFileName(fileName):
# def stripItemsInList(value):
# def untar(tarPath, outPath="", stripDir=False):
# def unzip(zipPath, outPath="", stripDir=False):
# def URLToFilename(url):
# def hasTarFileExtension(path):
# def validateCompressedFile(path, logger=None):
# def setVariables(filename, variableList):
# def is_exe(fpath):
# def isInstalled(program):


# Path: test/test_steps.py
import os, sys, tarfile, unittest, zipfile, mdTestUtilities
from md import git, hg, logger, python, steps, svn, utilityFunctions

            pci = steps.fetch(pci)
            testFilePath = os.path.join(pci.outputPath, mdTestUtilities.testFileName)
            self.assertEqual(pci.success, True, "Cvs repository failed to fetch.")
            self.assertEqual(os.path.exists(testFilePath), True, "'" + mdTestUtilities.testFileName + "' did not exist after fetching a Cvs repository.")
            pci = steps.unpack(pci)
            self.assertEqual(pci.success, True, "Cvs repository failed to unpack.")
            self.assertEqual(os.path.isdir(pci.currentPath), True, "Cvs repository was not a directory after unpacking.")
            self.assertEqual(os.path.exists(os.path.join(pci.currentPath, mdTestUtilities.testFileName)), True, "testFile did not exist after unpacking.")
        finally:
            utilityFunctions.removeDir(tempDir)

    def test_unpackGit(self):
        if not git.isGitInstalled():
            self.fail("Git is not installed on your system.  All Git tests will fail.")
        try:
            tempDir = mdTestUtilities.makeTempDir()
            repoPath = mdTestUtilities.createGitRepository(tempDir)
            pci = createPythonCallInfo(repoPath, os.path.join(tempDir, "output"), os.path.join(tempDir, "download"))
            pci = steps.fetch(pci)
            testFilePath = os.path.join(pci.outputPath, mdTestUtilities.testFileName)
            self.assertEqual(pci.success, True, "Git repository failed to fetch.")
            self.assertEqual(os.path.exists(testFilePath), True, "'" + mdTestUtilities.testFileName + "' did not exist after fetching a Git repository.")
            pci = steps.unpack(pci)
            self.assertEqual(pci.success, True, "Git repository failed to unpack.")
            self.assertEqual(os.path.isdir(pci.currentPath), True, "Git repository was not a directory after unpacking.")
            self.assertEqual(os.path.exists(os.path.join(pci.currentPath, mdTestUtilities.testFileName)), True, "testFile did not exist after unpacking.")
        finally:
            utilityFunctions.removeDir(tempDir)

    def test_unpackHg(self):

        if not hg.isHgInstalled():