Skip to content

Commit

Permalink
rewrite the new dir name back
Browse files Browse the repository at this point in the history
Signed-off-by: Frost Ming <[email protected]>
  • Loading branch information
frostming committed Jun 27, 2023
1 parent 9854a9e commit 3339e8b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/pdm/cli/templates/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ def replace_all(path: str, old: str, new: str) -> None:
import_name = normalize_name(original_name).replace("-", "_")
encoding = "utf-8"
for root, dirs, filenames in os.walk(self._path):
for d in dirs:
for i, d in enumerate(dirs):
if d == import_name:
os.rename(os.path.join(root, d), os.path.join(root, new_import_name))
dirs[i] = new_import_name
for f in filenames:
if f.endswith(".py"):
replace_all(os.path.join(root, f), import_name, new_import_name)
Expand Down

0 comments on commit 3339e8b

Please sign in to comment.