-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrename.py
More file actions
56 lines (47 loc) · 1.88 KB
/
rename.py
File metadata and controls
56 lines (47 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import os
import shutil
# ==========================================
# ⚙️ CONFIGURATION
# ==========================================
OLD_NAME = "codeseer"
NEW_NAME = "n3mo"
# Files that contain the word "codeseer" in strings or logic
FILES_TO_PATCH = [
"setup.py",
"docker-compose.yml",
"MANIFEST.in",
f"{OLD_NAME}/wrapper.py",
f"{OLD_NAME}/src/cli.py",
f"{OLD_NAME}/src/database.py"
]
def perform_surgery():
print(f"🌊 Starting N3MO Transformation...")
# 1. Update Content inside files
for file_path in FILES_TO_PATCH:
if os.path.exists(file_path):
print(f"📝 Patching strings in: {file_path}")
with open(file_path, 'r', encoding='utf-8') as f:
content = f.read()
# Replace lowercase, uppercase, and capitalized versions
content = content.replace(OLD_NAME, NEW_NAME)
content = content.replace(OLD_NAME.upper(), NEW_NAME.upper())
content = content.replace(OLD_NAME.capitalize(), NEW_NAME.capitalize())
with open(file_path, 'w', encoding='utf-8') as f:
f.write(content)
else:
print(f"⚠️ Skipping (File not found): {file_path}")
# 2. Rename the actual folder
if os.path.exists(OLD_NAME):
print(f"📂 Renaming folder '{OLD_NAME}' -> '{NEW_NAME}'")
try:
# We use shutil.move to handle any cross-device issues
shutil.move(OLD_NAME, NEW_NAME)
print("✅ Folder rename successful.")
except Exception as e:
print(f"❌ Error renaming folder: {e}")
else:
print(f"ℹ️ Folder '{OLD_NAME}' already renamed or not found.")
print(f"\n✨ Surgery Complete! Project is now N3MO.")
print(f"👉 Next Step: Run 'pip install -e .' to activate the new command.")
if __name__ == "__main__":
perform_surgery()