mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-04-08 00:20:59 +00:00
Merge pull request #103 from linkcheck/fix-mo-file-installation
Install .mo files correctly
This commit is contained in:
commit
4f35861d72
1 changed files with 28 additions and 0 deletions
28
setup.py
28
setup.py
|
|
@ -173,9 +173,37 @@ class MyInstallData (install_data, object):
|
|||
|
||||
def run (self):
|
||||
"""Adjust permissions on POSIX systems."""
|
||||
self.install_translations()
|
||||
super(MyInstallData, self).run()
|
||||
self.fix_permissions()
|
||||
|
||||
def install_translations (self):
|
||||
"""Install compiled gettext catalogs."""
|
||||
# A hack to fix https://github.com/linkcheck/linkchecker/issues/102
|
||||
i18n_files = []
|
||||
data_files = []
|
||||
for dir, files in self.data_files:
|
||||
if 'LC_MESSAGES' in dir:
|
||||
i18n_files.append((dir, files))
|
||||
else:
|
||||
data_files.append((dir, files))
|
||||
self.data_files = data_files
|
||||
# We do almost the same thing that install_data.run() does, except
|
||||
# we can assume everything in self.data_files is a (dir, files) tuple,
|
||||
# and all files lists are non-empty. And for i18n files, instead of
|
||||
# specifying the directory we instead specify the destination filename.
|
||||
for dest, files in i18n_files:
|
||||
dest = util.convert_path(dest)
|
||||
if not os.path.isabs(dest):
|
||||
dest = os.path.join(self.install_dir, dest)
|
||||
elif self.root:
|
||||
dest = util.change_root(self.root, dest)
|
||||
self.mkpath(os.path.dirname(dest))
|
||||
for data in files:
|
||||
data = util.convert_path(data)
|
||||
(out, _) = self.copy_file(data, dest)
|
||||
self.outfiles.append(out)
|
||||
|
||||
def fix_permissions (self):
|
||||
"""Set correct read permissions on POSIX systems. Might also
|
||||
be possible by setting umask?"""
|
||||
|
|
|
|||
Loading…
Reference in a new issue