http://www.mediawiki.org/wiki/Special:Code/pywikipedia/9737
Revision: 9737 Author: xqt Date: 2011-11-10 07:10:40 +0000 (Thu, 10 Nov 2011) Log Message: ----------- skip project namespaces from -upmain
Modified Paths: -------------- trunk/pywikipedia/maintenance/update_namespaces.py
Modified: trunk/pywikipedia/maintenance/update_namespaces.py =================================================================== --- trunk/pywikipedia/maintenance/update_namespaces.py 2011-11-10 07:07:29 UTC (rev 9736) +++ trunk/pywikipedia/maintenance/update_namespaces.py 2011-11-10 07:10:40 UTC (rev 9737) @@ -32,6 +32,7 @@ r_string = '[u]?[r]?['"].*?['"]' r_list = '\[.*?\]' r_namespace_def = re.compile(r'['"]([a-z_-]*)['"]\s*:\s*((?:%s)|(?:%s))\s*,' % (r_string, r_list)) + def update_family(family, changes): global namespace_section_text, namespace_defs, new_defs if family: @@ -39,17 +40,21 @@ family_file_name = '../families/%s_family.py' % family.name r_namespace_section = r_namespace_section_sub base_indent = 8 + skip_namespace = [] else: output(u'\nUpdating family.py') family_file_name = '../family.py' r_namespace_section = r_namespace_section_main base_indent = 12 + skip_namespace = [4, 5] family_file = open(family_file_name, 'r') old_family_text = family_text = family_file.read() family_file.close()
for lang, namespaces in changes.iteritems(): for namespace_id, namespace_list, predefined_namespace in namespaces: + if namespace_id in skip_namespace: + continue msg = u'Setting namespace[%s] for %s to ' \ + (u'[%s]' if len(namespace_list) > 1 else u'%s') output(msg % (namespace_id, lang, ', '.join(namespace_list)))