-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add script to generate zip files suitable for releases
- Loading branch information
1 parent
eb7f0f6
commit eeada25
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import os | ||
from pathlib import Path | ||
import argparse | ||
import zipfile | ||
import glob | ||
|
||
def zip_package(): | ||
# Get all files which should be included | ||
typst_files = glob.glob("./*.typ") | ||
typst_files.append("./typst.toml") | ||
typst_files.append("./LICENSE") | ||
|
||
# Open new zip file | ||
zip_file = zipfile.ZipFile(Path("package.zip"), mode='w') | ||
for p in typst_files: | ||
zip_file.write(p) | ||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser( | ||
prog="Releaser", | ||
description="Generate release files for the package and templates", | ||
) | ||
parser.add_argument('-p', '--package', action='store_true') | ||
parser.add_argument('-t', '--template') | ||
|
||
args = parser.parse_args() | ||
|
||
if args.package: | ||
zip_package() | ||
|