def migrate_repository(apt_file, old_repo, new_repo): try: sed(old_repo, new_repo, apt_file, use_regexp=False) except IOError as exc: logger.warn("Changing repository URL failed ({})".format(exc)) return # TODO: track progress of this apt_handle.clear_cache() apt_handle.update(DummyProgress())
def install_locale(locale): locale = ensure_utf_locale(locale) if not is_locale_valid(locale): print 'locale not valid', locale return False enforce_root(_('You need to be root to change install a locale')) genfile_locale = standard_locale_to_genfile_entry(locale) sed(r'^# ({})'.format(genfile_locale), r'\1', LOCALE_GEN_FILE) run_cmd('locale-gen')