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
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
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
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
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
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")
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')
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')
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}), ]
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}), ]
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)
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)
def find_desktop(self): files = [] files.extend(list(Utils.find_files_of_type('etc-conf', '*.desktop.in'))) return files
def has_glade_files(self): try: next(Utils.find_files_of_type('src', '*.glade')) return True except StopIteration: return False
def run(self): for f in Utils.find_files_of_type('src', '*.glade'): self.scan_xml(f, [".//property[@name='orientation']", ".//*[@swapped='no']"])
def find_js(self): files = [] files.extend( list(Utils.find_files_of_type("cockpit/src", "*.js", "*.jsx"))) return files
def find_glade(self): files = [] files.extend(list(Utils.find_files_of_type('src', '*.ui', '*.glade'))) return files
def find_js(self): files = [] files.extend( list(Utils.find_files_of_type('cockpit/src', '*.js', '*.jsx'))) return files
def run(self): for po_file in Utils.find_files_of_type('po', '*.po'): self.merge(po_file, self.key_file)
def run(self): for po_file in Utils.find_files_of_type("po", "*.po"): cmd = ["msguniq", po_file, "-o", po_file] spawn(cmd)
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
def has_po_files(self): try: next(Utils.find_files_of_type('po', '*.po')) return True except StopIteration: return False
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
def run(self): for f in Utils.find_files_of_type('.', '*.spec'): spawn(['rpmlint', '--file=rpmlint.config', f])
def run(self): for po_file in Utils.find_files_of_type("po", "*.po"): self.merge(po_file, self.key_file)
def has_spec_file(self): try: next(Utils.find_files_of_type('.', '*.spec')) return True except StopIteration: return False
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)
def run(self): for po_file in Utils.find_files_of_type('po', '*.po'): cmd = ['msguniq', po_file, '-o', po_file] spawn(cmd)
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)
def find_desktop(self): files = [] files.extend(list(Utils.find_files_of_type("etc-conf", "*.desktop.in"))) return files
def find_js(self): files = [] files.extend(list(Utils.find_files_of_type('cockpit/src', '*.js', '*.jsx'))) return files