[devscripts/i18n] Fix rename for Windows
This commit is contained in:
parent
bf8c5886ed
commit
ef95dc7816
@ -15,6 +15,15 @@ def mkdir_p(path):
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
||||||
|
def rename_file(old_path, new_path):
|
||||||
|
if sys.platform == 'win32':
|
||||||
|
try:
|
||||||
|
os.unlink(new_path)
|
||||||
|
except OSError:
|
||||||
|
pass
|
||||||
|
os.rename(old_path, new_path)
|
||||||
|
|
||||||
|
|
||||||
class I18N_Utils(object):
|
class I18N_Utils(object):
|
||||||
GETTEXT_DOMAIN = 'youtube_dl'
|
GETTEXT_DOMAIN = 'youtube_dl'
|
||||||
|
|
||||||
@ -39,7 +48,7 @@ class I18N_Utils(object):
|
|||||||
|
|
||||||
def update_po_internal(self, lang, po_file):
|
def update_po_internal(self, lang, po_file):
|
||||||
old_po_file = po_file + '.old'
|
old_po_file = po_file + '.old'
|
||||||
os.rename(po_file, old_po_file)
|
rename_file(po_file, old_po_file)
|
||||||
self._run_subprocess([
|
self._run_subprocess([
|
||||||
'msgmerge', '-N', old_po_file, '-o', po_file, self.get_pot_filename()])
|
'msgmerge', '-N', old_po_file, '-o', po_file, self.get_pot_filename()])
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user