2013-12-11 08:49:59 +01:00
|
|
|
#!/usr/bin/env python
|
|
|
|
import os
|
|
|
|
import re
|
|
|
|
import sys
|
2013-12-10 22:48:45 +01:00
|
|
|
|
2013-12-11 08:49:59 +01:00
|
|
|
def replace_one(txt, dst, src=None):
|
|
|
|
if src is None:
|
|
|
|
src = "K" + dst
|
2013-12-11 14:26:18 +01:00
|
|
|
word_src = r"%s\b" % src
|
2013-12-10 22:48:45 +01:00
|
|
|
|
2013-12-11 14:26:18 +01:00
|
|
|
txt = re.sub(r"find_dependency *\(" + word_src, "find_dependency(KF5" + dst, txt)
|
|
|
|
txt = re.sub(r"find_package *\(" + word_src, "find_package(KF5" + dst, txt)
|
|
|
|
txt = re.sub(r"(find_package *\( *KF5 [A-Za-z0-9\n ]*\s*)" + word_src, r"\1" + dst, txt, re.M)
|
|
|
|
txt = re.sub(r"include *\(" + src + r"Macros", "include(KF5" + dst + "Macros", txt)
|
|
|
|
txt = re.sub(r"KF5::" + src + r"\b", "KF5::" + dst, txt)
|
|
|
|
return txt
|
2013-12-11 08:49:59 +01:00
|
|
|
|
|
|
|
|
|
|
|
def replace_all(path):
|
|
|
|
with open(path) as f:
|
|
|
|
txt = f.read()
|
2013-12-10 22:48:45 +01:00
|
|
|
# tier1
|
2013-12-11 08:49:59 +01:00
|
|
|
txt = replace_one(txt, "Archive")
|
|
|
|
txt = replace_one(txt, "Codecs")
|
2013-12-11 14:26:38 +01:00
|
|
|
txt = replace_one(txt, "ConfigCore")
|
|
|
|
txt = replace_one(txt, "ConfigGui")
|
2013-12-11 08:49:59 +01:00
|
|
|
txt = replace_one(txt, "Config")
|
|
|
|
txt = replace_one(txt, "CoreAddons")
|
|
|
|
txt = replace_one(txt, "DBusAddons")
|
|
|
|
txt = replace_one(txt, "GuiAddons")
|
|
|
|
txt = replace_one(txt, "IdleTime")
|
|
|
|
txt = replace_one(txt, "ItemModels", "ItemModels")
|
|
|
|
txt = replace_one(txt, "ItemViews", "ItemViews")
|
|
|
|
txt = replace_one(txt, "JS")
|
|
|
|
txt = replace_one(txt, "JobWidgets")
|
|
|
|
txt = replace_one(txt, "Plotting")
|
2013-12-11 14:26:38 +01:00
|
|
|
txt = replace_one(txt, "Solid", "Solid")
|
|
|
|
txt = replace_one(txt, "Sonnet", "Sonnet")
|
2013-12-11 08:49:59 +01:00
|
|
|
txt = replace_one(txt, "ThreadWeaver", "ThreadWeaver")
|
|
|
|
txt = replace_one(txt, "WidgetsAddons")
|
|
|
|
txt = replace_one(txt, "WindowSystem")
|
2013-12-11 14:26:38 +01:00
|
|
|
txt = replace_one(txt, "GlobalAccel", "KF5GlobalAccel")
|
2013-12-10 22:48:45 +01:00
|
|
|
# tier2
|
2013-12-11 08:49:59 +01:00
|
|
|
txt = replace_one(txt, "DNSSD")
|
|
|
|
txt = replace_one(txt, "Auth")
|
|
|
|
txt = replace_one(txt, "Completion")
|
|
|
|
txt = replace_one(txt, "Crash")
|
2013-12-11 17:08:31 +01:00
|
|
|
txt = replace_one(txt, "DocTools")
|
2013-12-11 08:49:59 +01:00
|
|
|
txt = replace_one(txt, "XsltKde")
|
|
|
|
txt = replace_one(txt, "I18n")
|
|
|
|
txt = replace_one(txt, "JobWidgets")
|
|
|
|
txt = replace_one(txt, "Notifications")
|
|
|
|
txt = replace_one(txt, "Wallet")
|
2013-12-10 22:48:45 +01:00
|
|
|
# tier3
|
2013-12-11 08:49:59 +01:00
|
|
|
txt = replace_one(txt, "Bookmarks")
|
|
|
|
txt = replace_one(txt, "ConfigWidgets")
|
|
|
|
txt = replace_one(txt, "Declarative")
|
|
|
|
txt = replace_one(txt, "KCMUtils", "KCMUtils")
|
|
|
|
txt = replace_one(txt, "KIOCore", "KIOCore")
|
|
|
|
txt = replace_one(txt, "KIOFileWidgets", "KIOFileWidgets")
|
|
|
|
txt = replace_one(txt, "KIOWidgets", "KIOWidgets")
|
2013-12-11 14:26:38 +01:00
|
|
|
txt = replace_one(txt, "KIO", "KIO")
|
2013-12-11 08:49:59 +01:00
|
|
|
txt = replace_one(txt, "Kross", "Kross")
|
2013-12-11 17:08:31 +01:00
|
|
|
txt = replace_one(txt, "Su", "KDESu")
|
2013-12-11 08:49:59 +01:00
|
|
|
txt = replace_one(txt, "WebKit")
|
|
|
|
txt = replace_one(txt, "Emoticons")
|
|
|
|
txt = replace_one(txt, "IconThemes")
|
2013-12-11 16:22:47 +01:00
|
|
|
txt = replace_one(txt, "Init")
|
2013-12-11 08:49:59 +01:00
|
|
|
txt = replace_one(txt, "JsEmbed")
|
|
|
|
txt = replace_one(txt, "MediaPlayer")
|
|
|
|
txt = replace_one(txt, "NewStuff")
|
|
|
|
txt = replace_one(txt, "NotifyConfig")
|
|
|
|
txt = replace_one(txt, "Parts")
|
|
|
|
txt = replace_one(txt, "PrintUtils")
|
|
|
|
txt = replace_one(txt, "Pty")
|
|
|
|
txt = replace_one(txt, "Service")
|
|
|
|
txt = replace_one(txt, "TextWidgets")
|
|
|
|
txt = replace_one(txt, "UnitConversion")
|
|
|
|
txt = replace_one(txt, "XmlGui", "XmlGui")
|
2013-12-11 16:22:47 +01:00
|
|
|
# tier4
|
|
|
|
txt = replace_one(txt, "Style")
|
|
|
|
txt = replace_one(txt, "KDE4Support", "KDE4Support")
|
2013-12-11 08:49:59 +01:00
|
|
|
# plasma
|
|
|
|
txt = replace_one(txt, "Plasma", "Plasma")
|
2013-12-11 17:39:38 +01:00
|
|
|
txt = replace_one(txt, "PlasmaQuick", "PlasmaQuick")
|
2013-12-11 08:49:59 +01:00
|
|
|
|
|
|
|
with open(path, "w") as f:
|
|
|
|
f.write(txt)
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
if len(sys.argv) == 2:
|
|
|
|
return replace_all(sys.argv[1])
|
|
|
|
|
|
|
|
for root, dirs, names in os.walk('.'):
|
|
|
|
for name in names:
|
2013-12-11 23:12:48 +01:00
|
|
|
if name == "CMakeLists.txt" or name.endswith("Config.cmake.in") or name.endswith("Config.cmake"):
|
2013-12-11 08:49:59 +01:00
|
|
|
path = os.path.join(root, name)
|
|
|
|
print(path)
|
|
|
|
replace_all(path)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
sys.exit(main())
|
|
|
|
|