diff options
author | Maximilian Hils <git@maximilianhils.com> | 2016-02-12 21:57:48 +0100 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2016-02-12 21:57:48 +0100 |
commit | 16433ccb0ce3bfaf54294893ef32adec6359c2f6 (patch) | |
tree | 6f6632154bb89d3163c2cbfd0edac0cebddc798f | |
parent | c75951d1cb2916a65235d0e5be5e5ea096ce33e9 (diff) | |
download | mitmproxy-16433ccb0ce3bfaf54294893ef32adec6359c2f6.tar.gz mitmproxy-16433ccb0ce3bfaf54294893ef32adec6359c2f6.tar.bz2 mitmproxy-16433ccb0ce3bfaf54294893ef32adec6359c2f6.zip |
automatically delete old snapshots
-rw-r--r-- | rtool.py | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -13,6 +13,7 @@ import tarfile import platform import click import pysftp +import fnmatch from six.moves import shlex_quote # 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)) 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)) with click.progressbar(length=os.stat(local_path).st_size) as bar: sftp.put( |