Exemplo n.º 1
0
    def hasMainProgram(self, files=None):
        """
            Searches in the package for main program source code files,
            typically located in 'bin/', 'examples/', and 'test/'.

            Provide 'files' with absolute paths to skip (repetitive)
            searching in the filesystem.
        """
        dirs = (self.binDir, self.examplesDir, self.testDir)

        if Any.isIterable(files):

            for filePath in files:

                if filePath.endswith('.c') or filePath.endswith('.cpp'):

                    if filePath.startswith(dirs):
                        logging.debug('found main program: %s', filePath)
                        return True

            return False

        else:
            logging.info('searching in filesystem')

            for directory in dirs:
                hasCFile = self._search(directory, '.c')
                hasCppFile = self._search(directory, '.cpp')

                if hasCFile or hasCppFile:
                    return True

            return False
Exemplo n.º 2
0
    def setup(self, packageList=None):
        if packageList is not None:
            Any.requireIsList(packageList)

        cwd = os.getcwd()
        logging.info('setting up ToolBOS workspace in: %s', cwd)

        if Any.isIterable(packageList):
            self.addPackages(packageList)
Exemplo n.º 3
0
    def remove(self, fileList, output=None):
        """
            Flags the given files and/or directories to be removed with
            the next commit.

            If 'output' is a StringIO object, the command's output will be
            redirected there (otherwise printed on screen).
        """
        if not Any.isIterable(fileList):
            fileList = [fileList]

        for item in fileList:
            cmd = 'svn rm %s' % item
            FastScript.execProgram(cmd, stdout=output, stderr=output)