[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-i18n-doc
Subject:    l10n-kde4/scripts/lokalize
From:       Alexander Potashev <aspotashev () gmail ! com>
Date:       2010-05-30 16:50:00
Message-ID: 20100530165000.B414BAC8C3 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1132439 by aspotashev:

There is a script for Lokalize called "Open source file" (opensrc.py).
But it has a poor source lookup algorithm. For me, in most cases it
finally calls slocate/find which is bad, because files like "main.cpp"
are very common, and the script doesn't distinguish such files from
different applications and packages.

This commit implements another solution for the problem of locating
source files. The opensrc.py script uses a pre-generated map from
package names to paths to the sources. The map is generated by
another script which walks through all Messages.sh files and extracts
the package names from them.

Instead of using the given opensrc_list.py, you might want to run:
	./opensrc_generate_list.rb kde-trunk global-home
in order to make the opensrc.py script working for applications not
from the KDE SVN repository like Amarok, rekonq, ...
(you need `locate'/`slocate' and the sources of those applications)

CCMAIL: kde-i18n-doc@kde.org


 M  +5 -1      opensrc.py  
 AM            opensrc_generate_list.rb  
 AM            opensrc_list.py  


--- trunk/l10n-kde4/scripts/lokalize/opensrc.py #1132438:1132439
@@ -2,6 +2,7 @@
 import os,sys
 import Editor
 import Lokalize
+from opensrc_list import mapSrc
 
 print Editor.currentFile()
 editor=Editor
@@ -42,7 +43,10 @@
             try: package=package[package.index('_')+1:]
             except: break
     KdeTrunkPath=os.path.normpath(ourPath+'/../../../')
-    tryList=[KdeTrunkPath+'/KDE/'+module+'/'+package+'/'+filename,
+    mapSrcSuggest = mapSrc[package]
+    tryList=[KdeTrunkPath+'/'+mapSrcSuggest+'/'+filename,
+                mapSrcSuggest+'/'+filename, # for suggestions providing full path
+                KdeTrunkPath+'/KDE/'+module+'/'+package+'/'+filename,
                 KdeTrunkPath+'/KDE/'+module+'/'+package+'/src/'+filename,
                 KdeTrunkPath+'/KDE/'+module+'/'+package+'/'+package+'/'+filename]
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic