2008-04-17 04:52:37 +02:00
|
|
|
# vim:sw=4:et
|
|
|
|
#---------------------------------------------------------------
|
|
|
|
# Module : rpmlint
|
|
|
|
# File : DesktopTranslationCheck.py
|
|
|
|
# Author : Dirk Mueller
|
|
|
|
# Purpose : Check for untranslated desktop files
|
|
|
|
#---------------------------------------------------------------
|
|
|
|
|
|
|
|
from Filter import *
|
|
|
|
import AbstractCheck
|
|
|
|
import rpm
|
|
|
|
import re
|
|
|
|
import commands
|
|
|
|
import Config
|
|
|
|
|
|
|
|
desktop_re=re.compile('(services|applets)/.*\.desktop$')
|
|
|
|
|
|
|
|
class DesktopCheck(AbstractCheck.AbstractFilesCheck):
|
|
|
|
def __init__(self):
|
2009-08-21 18:19:06 +02:00
|
|
|
AbstractCheck.AbstractFilesCheck.__init__(self, "DesktopTranslationCheck", ".*\.desktop$")
|
2008-04-17 04:52:37 +02:00
|
|
|
|
|
|
|
def check_file(self, pkg, filename):
|
|
|
|
if pkg.isSource() or filename in pkg.ghostFiles():
|
|
|
|
return
|
|
|
|
|
|
|
|
try:
|
|
|
|
f = open(pkg.dirName() + '/' + filename)
|
|
|
|
except Exception, e:
|
|
|
|
printWarning(pkg, "read-error", e)
|
|
|
|
return 0
|
|
|
|
|
2008-11-18 13:33:47 +01:00
|
|
|
found_desktop_group=False
|
2008-04-17 04:52:37 +02:00
|
|
|
for line in f:
|
|
|
|
if line.startswith('X-SuSE-translate='):
|
|
|
|
return
|
2008-11-18 13:33:47 +01:00
|
|
|
if line.startswith('[Desktop Entry]'):
|
|
|
|
found_desktop_group=True
|
|
|
|
if found_desktop_group:
|
|
|
|
printWarning(pkg, "untranslated-desktop-file", filename)
|
2008-04-17 04:52:37 +02:00
|
|
|
|
|
|
|
check=DesktopCheck()
|
|
|
|
|
|
|
|
if Config.info:
|
|
|
|
addDetails(
|
|
|
|
'untranslated-desktop-file',
|
2008-11-18 13:33:47 +01:00
|
|
|
"""Your desktop file hasn't been handled by %suse_update_desktop_file
|
2008-04-17 04:52:37 +02:00
|
|
|
Please use it to make the desktop file translate-able by Novell translations."""
|
|
|
|
)
|