Skip to content

Commit

Permalink
Compress before sending
Browse files Browse the repository at this point in the history
  • Loading branch information
toamutiltech committed Jul 9, 2023
1 parent 6a6577b commit e35e55c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions 1-pack_web_static.py
Original file line number Diff line number Diff line change
@@ -0,0 1,24 @@
#!/usr/bin/python3
"""
Fabric script that Generates a .tgz archive
"""
from fabric.api import local
from datetime import datetime
import os


def do_pack():
'''
Generates a tgz archive from the
contents of the web_static folder
'''
try:
local('mkdir -p versions')
datetime_format = '%Y%m%d%H%M%S'
archive_path = 'versions/web_static_{}.tgz'.format(
datetime.now().strftime(datetime_format))
local('tar -cvzf {} web_static'.format(archive_path))
print('web_static packed: {} -> {}'.format(archive_path,
os.path.getsize(archive_path)))
except:
return None
Binary file added __pycache__/1-pack_web_static.cpython-38.pyc
Binary file not shown.
Binary file added versions/web_static_20230709142556.tgz
Binary file not shown.

0 comments on commit e35e55c

Please sign in to comment.