mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 08:11:00 +00:00
automatically delete old snapshots
This commit is contained in:
parent
c75951d1cb
commit
16433ccb0c
6
rtool.py
6
rtool.py
@ -13,6 +13,7 @@ import tarfile
|
|||||||
import platform
|
import platform
|
||||||
import click
|
import click
|
||||||
import pysftp
|
import pysftp
|
||||||
|
import fnmatch
|
||||||
from six.moves import shlex_quote
|
from six.moves import shlex_quote
|
||||||
|
|
||||||
# https://virtualenv.pypa.io/en/latest/userguide.html#windows-notes
|
# https://virtualenv.pypa.io/en/latest/userguide.html#windows-notes
|
||||||
@ -362,6 +363,11 @@ def upload_snapshot(host, port, user, private_key, private_key_password, sdist,
|
|||||||
remote_filename = f.replace(get_version(project), get_snapshot_version(project))
|
remote_filename = f.replace(get_version(project), get_snapshot_version(project))
|
||||||
symlink_path = "../{}".format(f.replace(get_version(project), "latest"))
|
symlink_path = "../{}".format(f.replace(get_version(project), "latest"))
|
||||||
|
|
||||||
|
old_version = f.replace(get_version(project), "*")
|
||||||
|
for f in sftp.listdir():
|
||||||
|
if fnmatch.fnmatch(f, old_version):
|
||||||
|
sftp.remove(f)
|
||||||
|
|
||||||
print("Uploading {} as {}...".format(f, remote_filename))
|
print("Uploading {} as {}...".format(f, remote_filename))
|
||||||
with click.progressbar(length=os.stat(local_path).st_size) as bar:
|
with click.progressbar(length=os.stat(local_path).st_size) as bar:
|
||||||
sftp.put(
|
sftp.put(
|
||||||
|
Loading…
Reference in New Issue
Block a user