Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
thinh-vu committed May 10, 2024
2 parents 00e27f5 + 81c73ed commit 0ade2c8
Show file tree
Hide file tree
Showing 8 changed files with 5,853 additions and 210 deletions.
42 changes: 23 additions & 19 deletions dev/cleanup.py
Original file line number Diff line number Diff line change
@@ -1,34 +1,38 @@
# Perform cleanup of the package directory prior to committing to GitHub
# Run from Github Codespace: python3 /workspaces/vnstock/dev/cleanup.py

import os
import shutil
import fnmatch

def delete_dirs(dirs):
for dir in dirs:
try:
shutil.rmtree(dir)
print(f"Deleted directory: {dir}")
except FileNotFoundError:
print(f"Directory not found: {dir}")
except Exception as e:
print(f"Error while deleting directory: {dir}. Error: {str(e)}")
for root, dirnames, filenames in os.walk('.'):
for dirname in fnmatch.filter(dirnames, dir):
dir_path = os.path.join(root, dirname)
try:
shutil.rmtree(dir_path)
print(f"Deleted directory: {dir_path}")
except FileNotFoundError:
print(f"Directory not found: {dir_path}")
except Exception as e:
print(f"Error while deleting directory: {dir_path}. Error: {str(e)}")

def delete_files(files):
for file in files:
try:
os.remove(file)
print(f"Deleted file: {file}")
except FileNotFoundError:
print(f"File not found: {file}")
except Exception as e:
print(f"Error while deleting file: {file}. Error: {str(e)}")
for root, dirnames, filenames in os.walk('.'):
for filename in fnmatch.filter(filenames, file):
file_path = os.path.join(root, filename)
try:
os.remove(file_path)
print(f"Deleted file: {file_path}")
except FileNotFoundError:
print(f"File not found: {file_path}")
except Exception as e:
print(f"Error while deleting file: {file_path}. Error: {str(e)}")

# List of directories to delete
dirs_to_delete = ["__pycache__", "build", "dist", "*.egg-info"]
dirs_to_delete = ["__pycache__", "build", "*.egg-info"]

# List of files to delete
files_to_delete = []
files_to_delete = ["*.tmp"]

# Delete directories
delete_dirs(dirs_to_delete)
Expand Down
Loading

0 comments on commit 0ade2c8

Please sign in to comment.