delete unneeded files

This commit is contained in:
2025-01-24 08:23:30 +01:00
parent c929739210
commit 05c76d49fd
6 changed files with 0 additions and 394 deletions

View File

@@ -1,61 +0,0 @@
{
"version": "auto-py-to-exe-configuration_v1",
"pyinstallerOptions": [
{
"optionDest": "noconfirm",
"value": true
},
{
"optionDest": "onefile",
"value": false
},
{
"optionDest": "console",
"value": false
},
{
"optionDest": "name",
"value": "LibrarySystem"
},
{
"optionDest": "contents_directory",
"value": "."
},
{
"optionDest": "clean_build",
"value": true
},
{
"optionDest": "strip",
"value": false
},
{
"optionDest": "noupx",
"value": false
},
{
"optionDest": "disable_windowed_traceback",
"value": false
},
{
"optionDest": "uac_admin",
"value": false
},
{
"optionDest": "uac_uiaccess",
"value": false
},
{
"optionDest": "argv_emulation",
"value": false
},
{
"optionDest": "bootloader_ignore_signals",
"value": false
}
],
"nonPyinstallerOptions": {
"increaseRecursionLimit": true,
"manualArguments": ""
}
}

View File

@@ -1,77 +0,0 @@
{
"version": "auto-py-to-exe-configuration_v1",
"pyinstallerOptions": [
{
"optionDest": "noconfirm",
"value": true
},
{
"optionDest": "filenames",
"value": "C:/Users/aky547/GitHub/LibrarySystem/main_dev.py"
},
{
"optionDest": "onefile",
"value": false
},
{
"optionDest": "console",
"value": true
},
{
"optionDest": "icon_file",
"value": "C:/Users/aky547/Downloads/1490971308-map-icons-7_82746.ico"
},
{
"optionDest": "name",
"value": "LibrarySystem-debug"
},
{
"optionDest": "contents_directory",
"value": "."
},
{
"optionDest": "clean_build",
"value": true
},
{
"optionDest": "strip",
"value": false
},
{
"optionDest": "noupx",
"value": false
},
{
"optionDest": "disable_windowed_traceback",
"value": false
},
{
"optionDest": "uac_admin",
"value": false
},
{
"optionDest": "uac_uiaccess",
"value": false
},
{
"optionDest": "argv_emulation",
"value": false
},
{
"optionDest": "bootloader_ignore_signals",
"value": false
},
{
"optionDest": "datas",
"value": "C:/Users/aky547/GitHub/LibrarySystem/config;config/"
},
{
"optionDest": "datas",
"value": "C:/Users/aky547/GitHub/LibrarySystem/icons;icons/"
}
],
"nonPyinstallerOptions": {
"increaseRecursionLimit": true,
"manualArguments": ""
}
}

View File

@@ -1,77 +0,0 @@
{
"version": "auto-py-to-exe-configuration_v1",
"pyinstallerOptions": [
{
"optionDest": "noconfirm",
"value": true
},
{
"optionDest": "filenames",
"value": "C:/Users/aky547/GitHub/LibrarySystem/main.py"
},
{
"optionDest": "onefile",
"value": false
},
{
"optionDest": "console",
"value": false
},
{
"optionDest": "icon_file",
"value": "C:/Users/aky547/Downloads/1490971308-map-icons-7_82746.ico"
},
{
"optionDest": "name",
"value": "LibrarySystem"
},
{
"optionDest": "contents_directory",
"value": "."
},
{
"optionDest": "clean_build",
"value": true
},
{
"optionDest": "strip",
"value": false
},
{
"optionDest": "noupx",
"value": false
},
{
"optionDest": "disable_windowed_traceback",
"value": false
},
{
"optionDest": "uac_admin",
"value": false
},
{
"optionDest": "uac_uiaccess",
"value": false
},
{
"optionDest": "argv_emulation",
"value": false
},
{
"optionDest": "bootloader_ignore_signals",
"value": false
},
{
"optionDest": "datas",
"value": "C:/Users/aky547/GitHub/LibrarySystem/config;config/"
},
{
"optionDest": "datas",
"value": "C:/Users/aky547/GitHub/LibrarySystem/icons;icons/"
}
],
"nonPyinstallerOptions": {
"increaseRecursionLimit": true,
"manualArguments": ""
}
}

View File

@@ -1,103 +0,0 @@
import os
import shutil
from pathlib import Path
ORIGIN = "C:/testing/source_2"
BACKUP = "C:/Databasebackup"
FILE = "database.db"
def handle_file():
"""
Handles file creation, movement, and backup based on path and backup existence.
Args:
path (str): The desired path for the file.
filename (str): The name of the file.
backup_location (str): The location for backups.
Returns:
str: The final path of the file.
"""
full = Path(ORIGIN) / FILE
full_path = str(full)
backup = Path(BACKUP) / FILE
backup_path = str(backup)
origin_reachable = os.path.exists(full_path)
backup_reachable = os.path.exists(backup_path)
print(origin_reachable, backup_reachable)
if not origin_reachable and not backup_reachable:
make_dirs(ORIGIN, BACKUP)
# if not os.path.exists(full_path):
# print("File does not exist, creating file")
# create_file(full_path)
if os.path.exists(backup_path) and ".backup" in os.listdir(BACKUP):
print("Used backup previously, overwriting file")
#overwrite file at source with backup
shutil.copy(backup_path, full_path)
os.remove(BACKUP + "/.backup")
def make_dirs(full_path, backup_path):
"""
Creates directories if they do not exist and moves the file to the desired location.
Args:
full_path (str): The full path of the file.
backup_path (str): The backup path of the file.
"""
if not os.path.exists(full_path):
os.makedirs(full_path)
if not os.path.exists(backup_path):
os.makedirs(backup_path)
def create_file(full_path):
"""
Creates a file at the desired location.
Args:
full_path (str): The full path of the file.
"""
with open(full_path, "w") as f:
f.write("")
def handle_folder_reachability(original_path, backup_path):
"""
Checks if the original folder is reachable. If not, creates a backup.
If the original folder becomes reachable again, restores the backup.
Args:
original_path (str): Path to the original folder.
backup_path (str): Path to the backup folder.
Returns:
str: Path to the current accessible folder.
"""
backup_file = os.path.join(backup_path, ".backup")
try:
os.makedirs(original_path)
except FileExistsError:
pass
if not os.path.exists(original_path):
#original folder not reachable, use backup path and create .backup file
if not os.path.exists(backup_path):
os.makedirs(backup_path)
with open(backup_file, "w") as f:
f.write("")
# Create an empty backup file as a marker
return backup_path +"/" + FILE
else:
# Original folder is reachable, check for backup
if os.path.exists(backup_file):
# Restore backup
shutil.rmtree(original_path) # Remove original folder to avoid conflicts
shutil.move(backup_path, original_path)
#os.remove(backup_file)
#remove backup file from original path
os.remove(original_path + "/.backup")
os.makedirs(backup_path)
return original_path +"/" + FILE
if __name__=="__main__":
print(handle_folder_reachability(ORIGIN, BACKUP)) # should create a new file at C:/newdatabase/database.db)

View File

@@ -1,76 +0,0 @@
@echo off
echo print Installing Python 3.12.7
echo downloading..... please wait
curl -o python-3.12.7-amd64.exe https://www.python.org/ftp/python/3.12.7/python-3.12.7-amd64.exe
echo Installing Python 3.12.7
python-3.12.7-amd64.exe /quiet InstallAllUsers=0 PrependPath=1 Include_test=0
echo Python 3.12.7 installed
echo Please confirm the installation by opening a new terminal and typing python --version
echo If the version is 3.12.7, then the installation was successful
pause
echo downloading the repository
curl -o LibrarySystem.zip https://git.theprivateserver.de/WorldTeacher/LibrarySystem/archive/main.zip
echo Extracting the repository
tar -xf LibrarySystem.zip
cd into the extracted folder
cd librarysystem
echo Installing the required packages
python -m venv venv
call venv\Scripts\activate.bat
echo Activated the virtual environment
echo Cleaning up the environment
@echo off
echo Uninstalling all Python packages...
@REM Uninstall all packages in the virtual environment
pip freeze > temp_requirements.txt
for /F "delims=" %%i in (temp_requirements.txt) do pip uninstall -y %%i
@REM Clean up the temporary file
del temp_requirements.txt
echo All packages uninstalled.
echo Installing the required packages
pip install -r requirements.txt
echo Installation completed
echo Building the application
call pyinstaller --noconfirm --onedir --windowed --icon "icons/icon.ico" --name "LibrarySystem" --clean --add-data "config;config/" --add-data "icons;icons/" "main.py"
echo compiling done, please confirm the build by checking the dist folder
echo If the build is successful, you can run the application by running the LibrarySystem.exe file in the folder
pause
set /p compile="Build successful? (y/n) "
if %compile% == y (
echo Build successful
exit
) else (
echo Build failed
echo switching over to manual mode using auto-py-to-exe
echo installing auto-py-to-exe
pip install auto-py-to-exe
echo auto-py-to-exe installed
echo running auto-py-to-exe
echo --------------------
echo Please go to settings > Import config.json
echo Select the build.app.json
echo Change / Set these values:
echo - Script Location: main.py
echo - Icon: icons/icon.ico
echo - Additional Files:
echo - config: config/
echo - icons: icons/
echo - site: site/
echo Click on the Convert .py to .exe button
echo the completed build will be in the output folder
echo --------------------
call auto-py-to-exe
pause
)

Binary file not shown.