Пример #1
0
    def __exit__(self, type, value, traceback):

        for path in self.builtSpellCheckers.iterkeys():
            os.remove(path + u".aff")
            os.remove(path + u".dic")

        try:
            os.rmdir(common.getBuildPath())
        except:
            pass
Пример #2
0
    def __exit__(self, type, value, traceback):

        for path in self.builtSpellCheckers.iterkeys():
            os.remove(path + u".aff")
            os.remove(path + u".dic")

        try:
            os.rmdir(common.getBuildPath())
        except:
            pass
Пример #3
0
    def getUnusedCode(self):

        buildPath = common.getBuildPath()

        if not os.path.exists(buildPath):
            return 1

        index = 2
        while os.path.exists(os.path.join(buildPath, u"{}.aff".format(index))):
            index += 1
        return index
Пример #4
0
    def getUnusedCode(self):

        buildPath = common.getBuildPath()

        if not os.path.exists(buildPath):
            return 1

        index = 2
        while os.path.exists(os.path.join(buildPath, u"{}.aff".format(index))):
            index += 1
        return index
Пример #5
0
    def create(self, config):

        for builtPath, builtConfig in self.builtSpellCheckers.iteritems():
            if config == builtConfig:
                return builtPath

        module_paths = module_paths_from_filters(config,
                                                 language=config["language"])
        file_name = unicode(self.getUnusedCode())
        folder_path = common.getBuildPath()
        build_files(module_paths=module_paths,
                    language=config["language"],
                    output_file_name=file_name,
                    output_folder=folder_path)
        path = os.path.join(folder_path, file_name)
        self.builtSpellCheckers[path] = config
        return path
Пример #6
0
    def create(self, config):

        for builtPath, builtConfig in self.builtSpellCheckers.iteritems():
            if config == builtConfig:
                return builtPath

        args = [u"scons",]

        for fileExtension in [u"aff", u"dic", u"rep"]:
            if fileExtension in config:
                args.append(u"{}={}".format(fileExtension, u",".join(config[fileExtension])))

        code = self.getUnusedCode()
        args.append(u"code={}".format(code))

        devNull = open(os.devnull, 'w')
        subprocess.call(args, cwd=common.getRootPath(), stdout=devNull, stderr=subprocess.STDOUT)

        path = os.path.join(common.getBuildPath(), u"{}".format(code))
        self.builtSpellCheckers[path] = config
        return path
Пример #7
0
    def create(self, config):

        for builtPath, builtConfig in self.builtSpellCheckers.iteritems():
            if config == builtConfig:
                return builtPath

        args = [u"scons"]

        for fileExtension in [u"aff", u"dic", u"rep"]:
            if fileExtension in config:
                args.append(u"{}={}".format(fileExtension, u",".join(config[fileExtension])))

        code = self.getUnusedCode()
        args.append(u"code={}".format(code))

        devNull = open(os.devnull, "w")
        subprocess.call(args, cwd=common.getRootPath(), stdout=devNull, stderr=subprocess.STDOUT)

        path = os.path.join(common.getBuildPath(), u"{}".format(code))
        self.builtSpellCheckers[path] = config
        return path