mirror of
https://github.com/c9moser/sgbackup.git
synced 2026-01-19 11:30:13 +00:00
2025.03.03 07:03:26 (desktop)
This commit is contained in:
parent
741c0d7ad2
commit
2fe13e7da3
@ -3,6 +3,10 @@
|
||||
|
||||
SELF="$( realpath "$0" )"
|
||||
PROJECT_DIR="$( dirname "$SELF")"
|
||||
: ${PYTHON_VENV_DIR:=$(cygpath "$USERPROFILE")/python-venv}
|
||||
venv="${PYTHON_VENV_DIR}/sgbackup"
|
||||
venv_bin="${venv}/bin"
|
||||
wvenv_bin="$(cygpath -w "$venv_bin")"
|
||||
|
||||
PACKAGES="gtk4 gobject-introspection python-pip python-gobject python-rapidfuzz"
|
||||
|
||||
@ -14,38 +18,59 @@ done
|
||||
pacman -Sy
|
||||
pacman -S --noconfirm $_install_pkg
|
||||
|
||||
cd $PROJECT_DIR
|
||||
pip install --break-system-packages --verbose --user .
|
||||
|
||||
bindir=$( realpath ~/bin )
|
||||
wbindir=$( cygpath -w "$bindir" )
|
||||
if [ ! -d "$bindir" ]; then
|
||||
mkdir -p "$bindir"
|
||||
if [ ! -f "$venv/bin/activate" ]; then
|
||||
python -m venv --system-site-packages "$venv"
|
||||
fi
|
||||
|
||||
pythonpath="$( python -c 'import sys; print(sys.executable)' )"
|
||||
pythonwpath="$( pythonw -c 'import sys; print(sys.executable)' )"
|
||||
cat > "${bindir}/sgbackup" << EOF
|
||||
. "$venv/bin/activate"
|
||||
|
||||
cd $PROJECT_DIR
|
||||
pip install --verbose --user .
|
||||
|
||||
bindir=$( realpath "$venv/bin" )
|
||||
wbindir=$( cygpath -w "$bindir" )
|
||||
|
||||
pythonpath="$( python -c 'import sys; print(sys.executable.replace("/","\\"))' )"
|
||||
pythonwpath="$( pythonw -c 'import sys; print(sys.executable.replace("/","\\"))' )"
|
||||
cat > "${venv_bin}/sgbackup" << EOF
|
||||
#!/bin/bash
|
||||
|
||||
. "$venv_bin/activate"
|
||||
|
||||
python -m sgbackup "\$@"
|
||||
EOF
|
||||
|
||||
cat > "${bindir}/sgbackup.cmd" << EOF
|
||||
cat > "${venv_bin}/sgbackup.cmd" << EOF
|
||||
@ECHO OFF
|
||||
"$pythonpath" -m sgbackup %*
|
||||
powershell -File "$wvenv_bin\\sgbackup.ps1" %*
|
||||
EOF
|
||||
unix2dos "${bindir}/sgbackup.cmd"
|
||||
unix2dos "${venv_bin}/sgbackup.cmd"
|
||||
|
||||
cat > "${bindir}/gsgbackup" << EOF
|
||||
cat > "${venv_bin}/sgbackup.ps1" << EOF
|
||||
Set-ExecutionPolicy Unrestricted -Scope Process -Force
|
||||
|
||||
$wvenv_bin\\activate.ps1
|
||||
|
||||
$pythonpath -m sgbackup $args
|
||||
EOF
|
||||
unix2dos "$venv_bin/sgbackup.ps1"
|
||||
|
||||
cat > "${venv_bin}/gsgbackup.ps1" << EOF
|
||||
$wvenv_bin\\activate.ps1
|
||||
$pythonpath -m sgbackup.gui $args
|
||||
EOF
|
||||
unix2dos "$venv_bin/gsgbackup.ps1"
|
||||
|
||||
cat > "${venv_bin}/gsgbackup" << EOF
|
||||
#!/bin/bash
|
||||
|
||||
python -m sgbackup.gui "\$@"
|
||||
EOF
|
||||
|
||||
cat > "${bindir}/gsgbackup.cmd" << EOF
|
||||
cat > "${venv_bin}/gsgbackup.cmd" << EOF
|
||||
@ECHO OFF
|
||||
"$pythonpath" -m sgbackup.gui %*
|
||||
cd $Env:userprofile
|
||||
"$wvenv_bin\\gsgbackup.ps1" %*
|
||||
EOF
|
||||
unix2dos "${bindir}/gsgbackup.cmd"
|
||||
|
||||
@ -64,8 +89,8 @@ Copy-Item -Path "$wproject_dir\\sgbackup\\icons\\sgbackup.ico" -Destination "\$p
|
||||
foreach (\$dir in \$desktop_dir,\$startmenu_dir) {
|
||||
\$shell=New-Object -ComObject WScript.Shell
|
||||
\$shortcut=\$shell.CreateShortcut("\$dir\\sgbackup.lnk")
|
||||
\$shortcut.TargetPath='$pythonpath'
|
||||
\$shortcut.Arguments='-m sgbackup.gui'
|
||||
\$shortcut.TargetPath='powershell'
|
||||
\$shortcut.Arguments='-WindowStyle hidden -File "$wvenv_bin\\gsgbackup.ps1"'
|
||||
\$shortcut.IconLocation="\$picture_dir\\sgbackup.ico"
|
||||
\$shortcut.Save()
|
||||
}
|
||||
|
||||
@ -173,10 +173,11 @@ class ArchiverManager(GObject):
|
||||
game.savegame_name,
|
||||
game.savegame_type.value,
|
||||
game.savegame_subdir)
|
||||
files=list(sorted(os.listdir(directory),reverse=True))
|
||||
if len(files) > settings.backup_versions:
|
||||
for backup_file in files[settings.backup_versions:]:
|
||||
self.remove_backup(game,backup_file)
|
||||
if os.path.isdir(directory):
|
||||
files=list(sorted(os.listdir(directory),reverse=True))
|
||||
if len(files) > settings.backup_versions:
|
||||
for backup_file in files[settings.backup_versions:]:
|
||||
self.remove_backup(game,backup_file)
|
||||
|
||||
@Signal(name="backup-progress",return_type=None,arg_types=(float,),flags=SignalFlags.RUN_FIRST)
|
||||
def do_backup_progress(self,fraction):
|
||||
|
||||
@ -1129,7 +1129,7 @@ class GameDialog(Gtk.Dialog):
|
||||
if self.get_is_valid_savegame_type(SavegameType.STEAM_MACOS):
|
||||
data = get_steam_data(self.__steam.macos)
|
||||
if self.__game.steam.macos:
|
||||
g = self.__game.steam_macos
|
||||
g = self.__game.steam.macos
|
||||
g.savegame_root = data['sgroot']
|
||||
g.savegame_dir = data['sgdir']
|
||||
g.variables = data['variables']
|
||||
|
||||
@ -2,25 +2,26 @@
|
||||
keys=root
|
||||
|
||||
[handlers]
|
||||
keys=consoleHandler,fileHandler
|
||||
|
||||
keys=consoleHandler
|
||||
#keys=consoleHanlder,fileHandler
|
||||
[formatters]
|
||||
keys=consoleFormatter,fileFormatter
|
||||
|
||||
[logger_root]
|
||||
level=DEBUG
|
||||
handlers=consoleHandler,fileHandler
|
||||
handlers=consoleHandler
|
||||
#handlers=consoleHandler,fileHandler
|
||||
|
||||
[handler_consoleHandler]
|
||||
class=StreamHandler
|
||||
formatter=consoleFormatter
|
||||
level=INFO
|
||||
|
||||
[handler_fileHandler]
|
||||
class=handlers.RotatingFileHandler
|
||||
args=('sgbackup.log','a',10485760,10,'UTF-8',False,)
|
||||
formatter=fileFormatter
|
||||
level=DEBUG
|
||||
#[handler_fileHandler]
|
||||
#class=handlers.RotatingFileHandler
|
||||
#args=('sgbackup.log','a',10485760,10,'UTF-8',False)
|
||||
#formatter=fileFormatter
|
||||
#level=DEBUG
|
||||
|
||||
[formatter_consoleFormatter]
|
||||
format=[%(levelname)s:%(name)s] %(message)s
|
||||
|
||||
Loading…
Reference in New Issue
Block a user