Skip to content

Commit 741de71

Browse files
authored
Update Compile_Build_Executable_PyInstaller.py
1 parent cd3de72 commit 741de71

File tree

1 file changed

+0
-8
lines changed

1 file changed

+0
-8
lines changed

Diff for: Compile_Build_Executable_PyInstaller.py

-8
Original file line numberDiff line numberDiff line change
@@ -7,37 +7,29 @@
77
import platform
88

99
def delete_older_directories(directory):
10-
# Delete the specified directory if it exists
1110
if os.path.exists(directory):
1211
shutil.rmtree(directory)
1312
print(f"Deleted directory: {directory}")
1413
else:
1514
print(f"Directory not found: {directory}")
1615

1716
def find_and_delete_dist_and_build(cwd):
18-
# Delete 'dist' and 'build' directories
1917
delete_older_directories(os.path.join(cwd, 'dist'))
2018
delete_older_directories(os.path.join(cwd, 'build'))
2119

2220
def find_and_activate_venv():
23-
# Get the current working directory
2421
cwd = os.getcwd()
2522

26-
# Delete 'dist' and 'build' directories
2723
find_and_delete_dist_and_build(cwd)
2824

29-
# Walk through the current directory and its subdirectories
3025
for root, dirs, files in os.walk(cwd):
31-
# Check if the directory contains a virtual environment
3226
if 'Scripts' in dirs or 'bin' in dirs:
3327
scripts_path = os.path.join(root, 'Scripts' if platform.system() == 'Windows' else 'bin')
3428
required_files = {'activate.bat' if platform.system() == 'Windows' else 'activate'}
3529

36-
# Check if the required activation file is present in the Scripts/bin directory
3730
if required_files.issubset(set(os.listdir(scripts_path))):
3831
print(f"Virtual environment found and activated at: {root}")
3932

40-
# Activate the virtual environment, upgrade pip, and check pip version
4133
if platform.system() == 'Windows':
4234
activate_command = f'cmd /k ""{os.path.join(scripts_path, "activate.bat")}" && python.exe -m pip install --upgrade pip && pyinstaller -F -c main.py"'
4335
else:

0 commit comments

Comments
 (0)