You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.1 KiB

#!/usr/bin/env python3
import glob
import os
from zipfile import ZipFile
dir_path = os.path.dirname(os.path.realpath(__file__))
def get_version():
path = os.path.join(
with open(path, 'r') as file:
lines ='\n')
for line in lines:
line_ = line.lower().strip()
if line_.startswith('version = '):
parts = line_[10:].lstrip('(').rstrip(')').split(',')
numbers = [int(part) for part in parts]
return '{}.{}.{}'.format(*numbers)
def release():
version = get_version()
tgt_fn = f'theanarchistlibrary_store_v{version}.zip'
tgt_path = os.path.join(dir_path, 'releases', tgt_fn)
src_glob = os.path.join(
with ZipFile(tgt_path, 'w') as zip:
for path in glob.glob(src_glob, recursive=True):
arcname = path[(len(src_glob) - 2):]
if arcname:
zip.write(path, arcname=arcname)
if __name__ == '__main__':