Example #1
0
    def DoTask(self):
        sourceDir = self.buildSetup.sourceDir
        searchDirs = [
            join(sourceDir, "eg"),
            join(sourceDir, "tools"),
        ]
        for plugin in PLUGINS:
            searchDirs.append(join(sourceDir, "plugins", plugin))
        serialDir = join(sourceDir, "eg", "WinApi", "serial")
        client = pysvn.Client()
        svnRoot = builder.getSvnRoot(sourceDir)
        status = client.status(svnRoot, ignore = True)
        paths = [i.path for i in status]

        for searchDir in searchDirs:
            for root, dirs, files in os.walk(searchDir):
                for filename in files:
                    if splitext(filename)[1].lower() in (".py", ".pyw"):
                        path = join(root, filename)
                        if path.startswith(serialDir):
                            continue
                        self.CheckHeader(path)
                        self.CheckLineLength(path)
                        # don't fix files that are versioned but haven't changed
                        itemStatus = status[paths.index(path)]
                        if itemStatus.text_status == pysvn.wc_status_kind.normal:
                            continue
                        self.FixTrailingWhitespace(path)
    def DoTask(self):
        """
        Create a zip archive off all versioned files in the working copy.
        """
        import pysvn

        filename = join(
            self.buildSetup.outDir,
            "%(appName)s_%(appVersion)s_Source.zip" % self.buildSetup.__dict__
        )
        client = pysvn.Client()
        workingDir = self.buildSetup.sourceDir
        svnRoot = builder.getSvnRoot(workingDir)

        zipFile = zipfile.ZipFile(filename, "w", zipfile.ZIP_DEFLATED)
        #for status in client.status(workingDir, ignore=True):
        status = client.status(svnRoot, ignore=True)
        workingDirStatus = [i for i in status if workingDir in i.path]
        for status in workingDirStatus:
            if status.is_versioned:
                path = status.path
                if not isdir(path):
                    arcname = path[len(workingDir) + 1:]
                    zipFile.write(path, arcname)
        zipFile.close()
Example #3
0
    def GetSetupFiles(self):
        """
        Return all files needed by the installer.

        The code scans for all SVN versioned files in the working copy and adds
        them to the list, except if a "noinstall" property is set for the file
        or a parent directory of the file.

        Plugins with a "noinclude" file are also skipped.
        """
        import pysvn

        files = []
        client = pysvn.Client()
        workingDir = self.sourceDir
        svnRoot = builder.getSvnRoot(workingDir)
        #props = client.propget("noinstall", workingDir, recurse=True)
        props = client.propget("noinstall", svnRoot, recurse=True)
        # propget returns the pathes with forward slash as deliminator, but we
        # need backslashes. It also seems to be encoded in UTF-8.
        props = dict(
            (k.replace("/", "\\").decode("utf8"), v)
                for k, v in props.iteritems()
        )
        numPathParts = len(workingDir.split("\\"))
        #for status in client.status(workingDir, ignore=True):
        status = client.status(svnRoot, ignore=True)
        workingDirStatus = [i for i in status if workingDir in i.path]
        for status in workingDirStatus:
            # we only want versioned files
            if not status.is_versioned:
                continue
            if not os.path.exists(status.path):
                continue
            pathParts = status.path.split("\\")
            # don't include plugins that have a 'noinclude' file
            if len(pathParts) > numPathParts + 1:
                if pathParts[numPathParts].lower() == "plugins":
                    pluginDir = "\\".join(pathParts[:numPathParts + 2])
                    if exists(join(pluginDir, "noinclude")):
                        continue

            # make sure no parent directory has a noinstall property
            for i in range(numPathParts, len(pathParts)+1):
                path2 = "\\".join(pathParts[:i])
                if path2 in props:
                    break
            else:
                if not os.path.isdir(status.path):
                    relativePath = status.path[len(workingDir) + 1:]
                    files.append(relativePath)
        return files
Example #4
0
    def GetSetupFiles(self):
        """
        Return all files needed by the installer.

        The code scans for all SVN versioned files in the working copy and adds
        them to the list, except if a "noinstall" property is set for the file
        or a parent directory of the file.

        Plugins with a "noinclude" file are also skipped.
        """
        import pysvn

        files = []
        client = pysvn.Client()
        workingDir = self.sourceDir
        svnRoot = builder.getSvnRoot(workingDir)
        #props = client.propget("noinstall", workingDir, recurse=True)
        props = client.propget("noinstall", svnRoot, recurse=True)
        # propget returns the pathes with forward slash as deliminator, but we
        # need backslashes. It also seems to be encoded in UTF-8.
        props = dict((k.replace("/", "\\").decode("utf8"), v)
                     for k, v in props.iteritems())
        numPathParts = len(workingDir.split("\\"))
        #for status in client.status(workingDir, ignore=True):
        status = client.status(svnRoot, ignore=True)
        workingDirStatus = [i for i in status if workingDir in i.path]
        for status in workingDirStatus:
            # we only want versioned files
            if not status.is_versioned:
                continue
            if not os.path.exists(status.path):
                continue
            pathParts = status.path.split("\\")
            # don't include plugins that have a 'noinclude' file
            if len(pathParts) > numPathParts + 1:
                if pathParts[numPathParts].lower() == "plugins":
                    pluginDir = "\\".join(pathParts[:numPathParts + 2])
                    if exists(join(pluginDir, "noinclude")):
                        continue

            # make sure no parent directory has a noinstall property
            for i in range(numPathParts, len(pathParts) + 1):
                path2 = "\\".join(pathParts[:i])
                if path2 in props:
                    break
            else:
                if not os.path.isdir(status.path):
                    relativePath = status.path[len(workingDir) + 1:]
                    files.append(relativePath)
        return files
    def DoTask(self):
        """
        Create a zip archive off all versioned files in the working copy.
        """
        import pysvn

        filename = join(
            self.buildSetup.outDir,
            "%(appName)s_%(appVersion)s_Source.zip" % self.buildSetup.__dict__)
        client = pysvn.Client()
        workingDir = self.buildSetup.sourceDir
        svnRoot = builder.getSvnRoot(workingDir)

        zipFile = zipfile.ZipFile(filename, "w", zipfile.ZIP_DEFLATED)
        #for status in client.status(workingDir, ignore=True):
        status = client.status(svnRoot, ignore=True)
        workingDirStatus = [i for i in status if workingDir in i.path]
        for status in workingDirStatus:
            if status.is_versioned:
                path = status.path
                if not isdir(path):
                    arcname = path[len(workingDir) + 1:]
                    zipFile.write(path, arcname)
        zipFile.close()