import os libtkpath = os.path.join('Lib', 'lib-tk') tkinterpath = os.path.join('Lib', 'tkinter') os.system('svn mkdir %s' % tkinterpath) for f in os.listdir(libtkpath): if not f.endswith('.py'): continue if f == "Tkinter.py": newname = "__init__.py" elif f == "FixTk.py": newname = "_fix.py" elif f in ["Canvas.py", "tkFileDialog.py", "tkSimpleDialog.py"]: # Canvas has been removed in py3k. # tkFileDialog and tkSimpleDialog will be merged with FileDialog # and SimpleDialog respectively. continue elif f.startswith("tk") or f.startswith("Tk"): newname = f[2:].lower() else: newname = f.lower() cmd = "svn mv %s %s" % (os.path.join(libtkpath, f), os.path.join(tkinterpath, newname)) print cmd os.system(cmd)