Пример #1
0
    def find_c(self):
        files = []

        for src in self.src_dirs.values():
            files.extend(list(Utils.find_files_of_type(src, '*.c', '*.h')))

        files.extend(list(Utils.find_files_of_type('tmp', '*.h')))
        return files
Пример #2
0
    def find_c(self):
        files = []

        for src in self.src_dirs.values():
            files.extend(list(Utils.find_files_of_type(src, '*.c', '*.h')))

        files.extend(list(Utils.find_files_of_type('tmp', '*.h')))
        return files
Пример #3
0
    def find_c(self):
        files = []

        for src in self.src_dirs.values():
            files.extend(list(Utils.find_files_of_type(src, "*.c", "*.h")))

        files.extend(list(Utils.find_files_of_type("tmp", "*.h")))
        return files
Пример #4
0
    def find_py(self):
        files = []

        for src in self.src_dirs.values():
            print(src)
            files.extend(list(Utils.find_files_of_type(src, '*.py')))

        files.extend(list(Utils.find_files_of_type('bin', '*')))
        return files
Пример #5
0
    def find_py(self):
        files = []

        for src in self.src_dirs.values():
            print(src)
            files.extend(list(Utils.find_files_of_type(src, '*.py')))

        files.extend(list(Utils.find_files_of_type('bin', '*')))
        return files
Пример #6
0
    def find_py(self):
        files = []

        for src in self.src_dirs.values():
            print(src)
            files.extend(list(Utils.find_files_of_type(src, "*.py")))

        files.extend(list(Utils.find_files_of_type("bin", "*")))
        return files
Пример #7
0
    def find_py(self):
        files = []
        files.extend(list(Utils.find_files_of_type('src', '*.py')))
        files.extend(list(Utils.find_files_of_type('bin', '*')))

        # We need to grab some strings out of optparse for translation
        import optparse
        optparse_source = "%s.py" % os.path.splitext(optparse.__file__)[0]
        if not os.path.exists(optparse_source):
            raise RuntimeError("Could not find optparse.py at %s" % optparse_source)
        files.append(optparse_source)

        return files
Пример #8
0
    def find_py(self):
        files = []
        files.extend(list(Utils.find_files_of_type('src', '*.py')))
        files.extend(list(Utils.find_files_of_type('bin', '*')))

        # We need to grab some strings out of optparse for translation
        import optparse
        optparse_source = "%s.py" % os.path.splitext(optparse.__file__)[0]
        if not os.path.exists(optparse_source):
            raise RuntimeError("Could not find optparse.py at %s" %
                               optparse_source)
        files.append(optparse_source)

        return files
Пример #9
0
    def run(self):
        manifest_prefix = os.path.join(os.curdir, "po", "POTFILES")

        # Begin with a fresh key file
        dir_util.mkpath("tmp")
        if self.lint:
            tmp_key_file = self.key_file
        else:
            tmp_key_file = os.path.join("tmp", os.path.basename(self.key_file))

        # Create xgettext friendly header files from the desktop files.
        # See http://stackoverflow.com/a/23643848/6124862
        cmd = ["intltool-extract", "-l", "--type=gettext/ini"]
        for desktop_file in Utils.find_files_of_type("etc-conf",
                                                     "*.desktop.in"):
            spawn(cmd + [desktop_file])

        cmd = [
            "xgettext",
            "--from-code=utf-8",
            "--add-comments=TRANSLATORS:",
            "--sort-by-file",
            "-o",
            tmp_key_file,
            "--package-name=rhsm",
        ]

        # These tuples contain a template for the file name that will contain a list of
        # all source files of a given type to translate, a function that finds all the
        # source files of a given type, the source language to send to xgettext, and a
        # list of any additional arguments.
        #
        # ProTip: Use extensions that won't be confused with source files.
        trans_types = [
            # The C source files require that we inform xgettext to extract strings from the
            # _() and N_() functions.
            ("%s.c_files", self.find_c, "C", ["-k_", "-kN_"]),
            ("%s.py_files", self.find_py, "Python", []),
            ("%s.js_files", self.find_js, "JavaScript", []),
        ]

        for manifest_template, search_func, language, other_options in trans_types:
            manifest = manifest_template % manifest_prefix
            self._write_sources(manifest, search_func)

            specific_opts = ["-f", manifest, "--language", language]
            specific_opts.extend(other_options)
            if os.path.exists(tmp_key_file):
                specific_opts.append("--join-existing")
            log.debug("Running %s" % " ".join(cmd + specific_opts))
            spawn(cmd + specific_opts)

        if not self.lint:
            shutil.copy2(tmp_key_file, self.key_file)

        # Delete the directory holding the temporary files created by intltool-extract
        # and the temporary keys.pot
        shutil.rmtree("tmp")
Пример #10
0
    def run(self):
        manifest_prefix = os.path.join(os.curdir, 'po', 'POTFILES')

        # Begin with a fresh key file
        dir_util.mkpath('tmp')
        if self.lint:
            tmp_key_file = self.key_file
        else:
            tmp_key_file = os.path.join('tmp', os.path.basename(self.key_file))

        # Create xgettext friendly header files from the desktop files.
        # See http://stackoverflow.com/a/23643848/6124862
        cmd = ['intltool-extract', '-l', '--type=gettext/ini']
        for desktop_file in Utils.find_files_of_type('etc-conf',
                                                     '*.desktop.in'):
            spawn(cmd + [desktop_file])

        cmd = [
            'xgettext', '--from-code=utf-8', '--add-comments=TRANSLATORS:',
            '--sort-by-file', '-o', tmp_key_file
        ]

        # These tuples contain a template for the file name that will contain a list of
        # all source files of a given type to translate, a function that finds all the
        # source files of a given type, the source language to send to xgettext, and a
        # list of any additional arguments.
        #
        # ProTip: Use extensions that won't be confused with source files.
        trans_types = [
            # The C source files require that we inform xgettext to extract strings from the
            # _() and N_() functions.
            ('%s.c_files', self.find_c, 'C', ['-k_', '-kN_']),
            ('%s.py_files', self.find_py, 'Python', []),
            ('%s.glade_files', self.find_glade, 'Glade', []),
            ('%s.js_files', self.find_js, 'JavaScript', []),
        ]

        for manifest_template, search_func, language, other_options in trans_types:
            manifest = manifest_template % manifest_prefix
            self._write_sources(manifest, search_func)

            specific_opts = ['-f', manifest, '--language', language]
            specific_opts.extend(other_options)
            if os.path.exists(tmp_key_file):
                specific_opts.append('--join-existing')
            log.debug("Running %s" % ' '.join(cmd + specific_opts))
            spawn(cmd + specific_opts)

        if not self.lint:
            shutil.copy2(tmp_key_file, self.key_file)

        # Delete the directory holding the temporary files created by intltool-extract
        # and the temporary keys.pot
        shutil.rmtree('tmp')
Пример #11
0
    def run(self):
        manifest_prefix = os.path.join(os.curdir, 'po', 'POTFILES')

        # Begin with a fresh key file
        dir_util.mkpath('tmp')
        if self.lint:
            tmp_key_file = self.key_file
        else:
            tmp_key_file = os.path.join('tmp', os.path.basename(self.key_file))

        # Create xgettext friendly header files from the desktop files.
        # See http://stackoverflow.com/a/23643848/6124862
        cmd = ['intltool-extract', '-l', '--type=gettext/ini']
        for desktop_file in Utils.find_files_of_type('etc-conf', '*.desktop.in'):
            spawn(cmd + [desktop_file])

        cmd = ['xgettext', '--from-code=utf-8', '--add-comments=TRANSLATORS:', '--sort-by-file', '-o', tmp_key_file]

        # These tuples contain a template for the file name that will contain a list of
        # all source files of a given type to translate, a function that finds all the
        # source files of a given type, the source language to send to xgettext, and a
        # list of any additional arguments.
        #
        # ProTip: Use extensions that won't be confused with source files.
        trans_types = [
            # The C source files require that we inform xgettext to extract strings from the
            # _() and N_() functions.
            ('%s.c_files', self.find_c, 'C', ['-k_', '-kN_']),
            ('%s.py_files', self.find_py, 'Python', []),
            ('%s.glade_files', self.find_glade, 'Glade', []),
            ('%s.js_files', self.find_js, 'JavaScript', []),
        ]

        for manifest_template, search_func, language, other_options in trans_types:
            manifest = manifest_template % manifest_prefix
            self._write_sources(manifest, search_func)

            specific_opts = ['-f', manifest, '--language', language]
            specific_opts.extend(other_options)
            if os.path.exists(tmp_key_file):
                specific_opts.append('--join-existing')
            log.debug("Running %s" % ' '.join(cmd + specific_opts))
            spawn(cmd + specific_opts)

        if not self.lint:
            shutil.copy2(tmp_key_file, self.key_file)

        # Delete the directory holding the temporary files created by intltool-extract
        # and the temporary keys.pot
        shutil.rmtree('tmp')
Пример #12
0
    def __init__(self, tree, filename):
        self.tree = tree
        self.filename = filename

        widgets = []
        handlers = []
        for f in Utils.find_files_of_type('src', '*.glade', '*.ui'):
            # Note that we are sending in the file name rather than a file handle.  By using
            # the file name, we can take advantage of memoizing on the name instead of on an
            # instance of a file handle
            widgets.extend(self.scan_widgets(f))
            handlers.extend(self.scan_handlers(f))

        self.visitors = [
            (GettextVisitor, {}),
            (DebugImportVisitor, {}),
            (WidgetVisitor, {'defined_widgets': widgets}),
            (SignalVisitor, {'defined_handlers': handlers}),
        ]
Пример #13
0
    def __init__(self, tree, filename):
        self.tree = tree
        self.filename = filename

        widgets = []
        handlers = []
        for f in Utils.find_files_of_type('src', '*.glade', '*.ui'):
            # Note that we are sending in the file name rather than a file handle.  By using
            # the file name, we can take advantage of memoizing on the name instead of on an
            # instance of a file handle
            widgets.extend(self.scan_widgets(f))
            handlers.extend(self.scan_handlers(f))

        self.visitors = [
            (GettextVisitor, {}),
            (DebugImportVisitor, {}),
            (FutureVisitor, {}),
            (WidgetVisitor, {'defined_widgets': widgets}),
            (SignalVisitor, {'defined_handlers': handlers}),
        ]
Пример #14
0
    def run(self):
        for po_file in Utils.find_files_of_type('po', '*.po'):
            lang = os.path.basename(po_file)[:-3]
            dest_path = os.path.join(self.build_base, 'locale', lang, 'LC_MESSAGES')
            dest = os.path.join(dest_path, 'rhsm.mo')
            Utils.run_if_new(po_file, dest, self.compile)

        for desktop_file in Utils.find_files_of_type('etc-conf', '*.desktop.in'):
            output_file = os.path.basename("%s" % os.path.splitext(desktop_file)[0])

            dest_path = os.path.join(self.build_base, 'applications')
            if output_file == 'rhsm-icon.desktop':
                dest_path = os.path.join(self.build_base, 'autostart')
            dest = os.path.join(dest_path, output_file)
            Utils.run_if_new(desktop_file, dest, self.merge_desktop)
Пример #15
0
    def run(self):
        for po_file in Utils.find_files_of_type("po", "*.po"):
            lang = os.path.basename(po_file)[:-3]
            dest_path = os.path.join(self.build_base, "locale", lang,
                                     "LC_MESSAGES")
            dest = os.path.join(dest_path, self.app_name + ".mo")
            Utils.run_if_new(po_file, dest, self.compile)

        for desktop_file in Utils.find_files_of_type("etc-conf",
                                                     "*.desktop.in"):
            output_file = os.path.basename("%s" %
                                           os.path.splitext(desktop_file)[0])

            dest_path = os.path.join(self.build_base, "applications")
            dest = os.path.join(dest_path, output_file)
            Utils.run_if_new(desktop_file, dest, self.merge_desktop)
Пример #16
0
    def run(self):
        for po_file in Utils.find_files_of_type('po', '*.po'):
            lang = os.path.basename(po_file)[:-3]
            dest_path = os.path.join(self.build_base, 'locale', lang,
                                     'LC_MESSAGES')
            dest = os.path.join(dest_path, 'rhsm.mo')
            Utils.run_if_new(po_file, dest, self.compile)

        for desktop_file in Utils.find_files_of_type('etc-conf',
                                                     '*.desktop.in'):
            output_file = os.path.basename("%s" %
                                           os.path.splitext(desktop_file)[0])

            dest_path = os.path.join(self.build_base, 'applications')
            if output_file == 'rhsm-icon.desktop':
                dest_path = os.path.join(self.build_base, 'autostart')
            dest = os.path.join(dest_path, output_file)
            Utils.run_if_new(desktop_file, dest, self.merge_desktop)
Пример #17
0
 def find_desktop(self):
     files = []
     files.extend(list(Utils.find_files_of_type('etc-conf', '*.desktop.in')))
     return files
Пример #18
0
 def has_glade_files(self):
     try:
         next(Utils.find_files_of_type('src', '*.glade'))
         return True
     except StopIteration:
         return False
Пример #19
0
 def run(self):
     for f in Utils.find_files_of_type('src', '*.glade'):
         self.scan_xml(f, [".//property[@name='orientation']", ".//*[@swapped='no']"])
Пример #20
0
 def find_js(self):
     files = []
     files.extend(
         list(Utils.find_files_of_type("cockpit/src", "*.js", "*.jsx")))
     return files
Пример #21
0
 def find_glade(self):
     files = []
     files.extend(list(Utils.find_files_of_type('src', '*.ui', '*.glade')))
     return files
Пример #22
0
 def find_js(self):
     files = []
     files.extend(
         list(Utils.find_files_of_type('cockpit/src', '*.js', '*.jsx')))
     return files
Пример #23
0
 def run(self):
     for po_file in Utils.find_files_of_type('po', '*.po'):
         self.merge(po_file, self.key_file)
Пример #24
0
 def run(self):
     for po_file in Utils.find_files_of_type("po", "*.po"):
         cmd = ["msguniq", po_file, "-o", po_file]
         spawn(cmd)
Пример #25
0
 def find_glade(self):
     files = []
     for src in self.src_dirs.values():
         files.extend(list(Utils.find_files_of_type(src, '*.ui',
                                                    '*.glade')))
     return files
Пример #26
0
 def has_po_files(self):
     try:
         next(Utils.find_files_of_type('po', '*.po'))
         return True
     except StopIteration:
         return False
Пример #27
0
 def find_glade(self):
     files = []
     files.extend(list(Utils.find_files_of_type('src', '*.ui', '*.glade')))
     return files
Пример #28
0
 def find_c(self):
     files = []
     files.extend(list(Utils.find_files_of_type('src', '*.c', '*.h')))
     files.extend(list(Utils.find_files_of_type('tmp', '*.h')))
     return files
Пример #29
0
 def run(self):
     for f in Utils.find_files_of_type('.', '*.spec'):
         spawn(['rpmlint', '--file=rpmlint.config', f])
Пример #30
0
 def run(self):
     for po_file in Utils.find_files_of_type("po", "*.po"):
         self.merge(po_file, self.key_file)
Пример #31
0
 def has_spec_file(self):
     try:
         next(Utils.find_files_of_type('.', '*.spec'))
         return True
     except StopIteration:
         return False
Пример #32
0
 def run(self):
     for template in Utils.find_files_of_type('etc-conf', '*.template'):
         dest_rel_path = os.path.relpath(
             "%s" % os.path.splitext(template)[0], 'etc-conf')
         dest = os.path.join(self.build_base, dest_rel_path)
         Utils.run_if_new(template, dest, self.template)
Пример #33
0
 def run(self):
     for po_file in Utils.find_files_of_type('po', '*.po'):
         cmd = ['msguniq', po_file, '-o', po_file]
         spawn(cmd)
Пример #34
0
 def run(self):
     for po_file in Utils.find_files_of_type('po', '*.po'):
         cmd = ['msguniq', po_file, '-o', po_file]
         spawn(cmd)
Пример #35
0
 def find_c(self):
     files = []
     files.extend(list(Utils.find_files_of_type('src', '*.c', '*.h')))
     files.extend(list(Utils.find_files_of_type('tmp', '*.h')))
     return files
Пример #36
0
 def run(self):
     for f in Utils.find_files_of_type('src', '*.glade'):
         self.scan_xml(f, [".//property[@name='orientation']", ".//*[@swapped='no']"])
Пример #37
0
 def find_desktop(self):
     files = []
     files.extend(list(Utils.find_files_of_type('etc-conf',
                                                '*.desktop.in')))
     return files
Пример #38
0
 def has_spec_file(self):
     try:
         next(Utils.find_files_of_type('.', '*.spec'))
         return True
     except StopIteration:
         return False
Пример #39
0
 def run(self):
     for po_file in Utils.find_files_of_type('po', '*.po'):
         self.merge(po_file, self.key_file)
Пример #40
0
 def run(self):
     for template in Utils.find_files_of_type('etc-conf', '*.template'):
         dest_rel_path = os.path.relpath("%s" % os.path.splitext(template)[0], 'etc-conf')
         dest = os.path.join(self.build_base, dest_rel_path)
         Utils.run_if_new(template, dest, self.template)
Пример #41
0
 def has_po_files(self):
     try:
         next(Utils.find_files_of_type('po', '*.po'))
         return True
     except StopIteration:
         return False
Пример #42
0
 def find_desktop(self):
     files = []
     files.extend(list(Utils.find_files_of_type("etc-conf",
                                                "*.desktop.in")))
     return files
Пример #43
0
 def has_glade_files(self):
     try:
         next(Utils.find_files_of_type('src', '*.glade'))
         return True
     except StopIteration:
         return False
Пример #44
0
 def find_glade(self):
     files = []
     for src in self.src_dirs.values():
         files.extend(list(Utils.find_files_of_type(src, '*.ui', '*.glade')))
     return files
Пример #45
0
 def run(self):
     for f in Utils.find_files_of_type('.', '*.spec'):
         spawn(['rpmlint', '--file=rpmlint.config', f])
Пример #46
0
 def find_js(self):
     files = []
     files.extend(list(Utils.find_files_of_type('cockpit/src', '*.js', '*.jsx')))
     return files