[MediaWiki-commits] [Gerrit] Delete read_wfMsgCalls.py (obsolete) - change (mediawiki...code-utils)
jenkins-bot has submitted this change and it was merged. Change subject: Delete read_wfMsgCalls.py (obsolete) .. Delete read_wfMsgCalls.py (obsolete) I was the original author in 2011, but dedicated tools as code analysers are probably better suited and more reliable. See also discussion in change I620b97431f228a10d21501b1ec849984a3209240. Change-Id: I3e88c545313dfcfa14982005ac47f0264702c334 --- D read_wfMsgCalls.py 1 file changed, 0 insertions(+), 311 deletions(-) Approvals: Hashar: Looks good to me, approved jenkins-bot: Verified diff --git a/read_wfMsgCalls.py b/read_wfMsgCalls.py deleted file mode 100755 index 5f546fb..000 --- a/read_wfMsgCalls.py +++ /dev/null @@ -1,311 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# vim: set noexpandtab: - -# -# Two small tools to analyse the keys of the i18n messages of MediaWiki -# 1/ Get the current keys (and corresponding language and message) from their -#definition -# 2/ Get the calls of the wfMsg functions (and corresponding file, line, type -#(wfMsg, wfMsgForContent, etc.), message key (when possible)) -# -# -# Some details: -# * this program calls a PHP interpreter, so you need it -# * the occurences of wfMsg functions in block comments are removed (about 30 -# occurences), I didn’t check for single-line comments -# * I assumed the key of the messages are '([a-zA-Z0-9_-]+?)', it seems quite -# correct after tests (anyway no wfMsg call is forgotten, even if the key is -# not recognized) -# * hence the key with a variable are never computed since you must have a -# deeper program analysis, the cases are wfMsg( $wgLogNames[$type] ) or -# (easier?) wfMessage( 'block-log-flags-' . $flag ) -# * some calls are missed when called by call_user_func_array, but in these -# case you probably have no chance to get the associated message key because -# it is probably a variable) -# * the results are CSV -# * the format of the messageStrings file is: -# 1/ language code (from the name of the file when available); -# 2/ message key; -# 3/ content of the message -# * the format of the wfMsgCalls file is: -# 1/ path of the file; -# 2/ line number; -# 3/ wfMsg type (wfMsg, wfMessage, etc.); -# 4/ message key (when possible); -# 5/ complete call of the function -# -# Author: Seb35 on Wikimedia projects -# -# License: WTFPL 2.0 http://sam.zoy.org/wtfpl/ -# - - -# # # # # # # # -# Parameters # -# # # # # # # # - -# BASE PARAMETERS - -# Folder containing a tree of MediaWiki -baseFolder = mediawiki/trunk/phase3 - -# Name of the CSV result file (in the current folder) containing the calls to -# the functions wfMsg* (specified thereafter in a parameter) obtained by -# analysing the code -wfMsgCallsResultFile = wfMsgCalls.csv - -# Name of the CSV result file (in the current folder) containing the -# associations lang-msgkey-message by retrieving the content of the PHP -# $messages variable in the 'languages' and i18n folders -messageStringsResultFile = messageStrings.csv - -# Save also the content of the messages (count 10Mio without and 30Mio with) -lightMessageStrings = False - -# Name of the wfMsg functions to search in the code -messageFunctions = [ wfMsg, wfMessage, wfMessageFallback, wfMsgExt, wfMsgForContent, wfMsgNoTrans, wfMsgForContentNoTrans, wfMsgReal, wfMsgHtml, wfMsgWikiHtml, wfEmptyMsg, wfMsgReplaceArgs, wfMsgGetKey, addWikiMsg, wrapWikiMsg, addWikiMsgArray ] - - -# MESSAGES FOLDERS AND FILES - -# Folders (let the # to include messagesIndividualFiles) -messagesFolders = { 'phase3': [ 'languages/messages' ], 'extensions': [ ], '#': '#' } - -# Exclude these files -messagesExcludeFiles = [] - -# Include these files (must not be in the previous folders else it would be -# duplicated) -messagesIndividualFiles = [] - - -# CODE FOLDERS AND FILES - -# Folders (let the # to include codeIndividualFiles) -codeFolders = [ includes, extensions, skins, languages/classes, # ] - -# Exclude these files -codeExcludeFiles = [] - -# Include these files (must not be in the previous folders else it would be -# duplicated) -codeIndividualFiles = [ languages/Language.php, languages/LanguageConverter.php, languages/Names.php, resources/Resources.php ] - - -# # # # # # # # # # # # -# Read the i18n files # -# # # # # # # # # # # # - -import os -import os.path -import re -import csv -import subprocess - -currentFolder = os.getcwd() -os.chdir( baseFolder ) - -i18nMessages = [] - -# Iterate over folders and files -for messagesFolderType in messagesFolders: - - directories = [] - if messagesFolderType == 'extensions': - for directory in messagesFolders[messagesFolderType]: - l = os.walk( directory ) - for j in l: - if '.svn' in j[0]: - continue - directories.append( j[0] ) -
[MediaWiki-commits] [Gerrit] Delete read_wfMsgCalls.py (obsolete) - change (mediawiki...code-utils)
Seb35 has uploaded a new change for review. https://gerrit.wikimedia.org/r/162205 Change subject: Delete read_wfMsgCalls.py (obsolete) .. Delete read_wfMsgCalls.py (obsolete) I was the original author in 2011, but dedicated tools as code analysers are probably better suited and more reliable. See also discussion in change I620b97431f228a10d21501b1ec849984a3209240. Change-Id: I3e88c545313dfcfa14982005ac47f0264702c334 --- D read_wfMsgCalls.py 1 file changed, 0 insertions(+), 311 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/tools/code-utils refs/changes/05/162205/1 diff --git a/read_wfMsgCalls.py b/read_wfMsgCalls.py deleted file mode 100755 index 5f546fb..000 --- a/read_wfMsgCalls.py +++ /dev/null @@ -1,311 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# vim: set noexpandtab: - -# -# Two small tools to analyse the keys of the i18n messages of MediaWiki -# 1/ Get the current keys (and corresponding language and message) from their -#definition -# 2/ Get the calls of the wfMsg functions (and corresponding file, line, type -#(wfMsg, wfMsgForContent, etc.), message key (when possible)) -# -# -# Some details: -# * this program calls a PHP interpreter, so you need it -# * the occurences of wfMsg functions in block comments are removed (about 30 -# occurences), I didn’t check for single-line comments -# * I assumed the key of the messages are '([a-zA-Z0-9_-]+?)', it seems quite -# correct after tests (anyway no wfMsg call is forgotten, even if the key is -# not recognized) -# * hence the key with a variable are never computed since you must have a -# deeper program analysis, the cases are wfMsg( $wgLogNames[$type] ) or -# (easier?) wfMessage( 'block-log-flags-' . $flag ) -# * some calls are missed when called by call_user_func_array, but in these -# case you probably have no chance to get the associated message key because -# it is probably a variable) -# * the results are CSV -# * the format of the messageStrings file is: -# 1/ language code (from the name of the file when available); -# 2/ message key; -# 3/ content of the message -# * the format of the wfMsgCalls file is: -# 1/ path of the file; -# 2/ line number; -# 3/ wfMsg type (wfMsg, wfMessage, etc.); -# 4/ message key (when possible); -# 5/ complete call of the function -# -# Author: Seb35 on Wikimedia projects -# -# License: WTFPL 2.0 http://sam.zoy.org/wtfpl/ -# - - -# # # # # # # # -# Parameters # -# # # # # # # # - -# BASE PARAMETERS - -# Folder containing a tree of MediaWiki -baseFolder = mediawiki/trunk/phase3 - -# Name of the CSV result file (in the current folder) containing the calls to -# the functions wfMsg* (specified thereafter in a parameter) obtained by -# analysing the code -wfMsgCallsResultFile = wfMsgCalls.csv - -# Name of the CSV result file (in the current folder) containing the -# associations lang-msgkey-message by retrieving the content of the PHP -# $messages variable in the 'languages' and i18n folders -messageStringsResultFile = messageStrings.csv - -# Save also the content of the messages (count 10Mio without and 30Mio with) -lightMessageStrings = False - -# Name of the wfMsg functions to search in the code -messageFunctions = [ wfMsg, wfMessage, wfMessageFallback, wfMsgExt, wfMsgForContent, wfMsgNoTrans, wfMsgForContentNoTrans, wfMsgReal, wfMsgHtml, wfMsgWikiHtml, wfEmptyMsg, wfMsgReplaceArgs, wfMsgGetKey, addWikiMsg, wrapWikiMsg, addWikiMsgArray ] - - -# MESSAGES FOLDERS AND FILES - -# Folders (let the # to include messagesIndividualFiles) -messagesFolders = { 'phase3': [ 'languages/messages' ], 'extensions': [ ], '#': '#' } - -# Exclude these files -messagesExcludeFiles = [] - -# Include these files (must not be in the previous folders else it would be -# duplicated) -messagesIndividualFiles = [] - - -# CODE FOLDERS AND FILES - -# Folders (let the # to include codeIndividualFiles) -codeFolders = [ includes, extensions, skins, languages/classes, # ] - -# Exclude these files -codeExcludeFiles = [] - -# Include these files (must not be in the previous folders else it would be -# duplicated) -codeIndividualFiles = [ languages/Language.php, languages/LanguageConverter.php, languages/Names.php, resources/Resources.php ] - - -# # # # # # # # # # # # -# Read the i18n files # -# # # # # # # # # # # # - -import os -import os.path -import re -import csv -import subprocess - -currentFolder = os.getcwd() -os.chdir( baseFolder ) - -i18nMessages = [] - -# Iterate over folders and files -for messagesFolderType in messagesFolders: - - directories = [] - if messagesFolderType == 'extensions': - for directory in messagesFolders[messagesFolderType]: - l = os.walk( directory ) - for j in l: - if '.svn' in j[0]: - continue -