Skip to content

Commit

Permalink
Adds a script that builds release sources
Browse files Browse the repository at this point in the history
  • Loading branch information
dgasmith committed Sep 19, 2019
1 parent f04aef4 commit 8c9bf1a
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,4 @@ input.py.dat
*.cube
dfh.*
*.npz
*.zip
41 changes: 41 additions & 0 deletions scripts/make_release_sources.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import gau2grid as gg
from pathlib import Path
import os
import zipfile
import tempfile
import shutil

am_list = [6, 8]

for am in am_list:

folder = f"gau2grid-am{am}-{gg.__version__}"
zip_filename = folder + '.zip'
zipf = zipfile.ZipFile(zip_filename, 'w', zipfile.ZIP_DEFLATED)

path = Path(folder)
path.mkdir(parents=True)
gg.c_gen.generate_c_gau2grid(am, path=path.resolve())

for filename in path.iterdir():
zipf.write(filename)

shutil.rmtree(path.resolve())

# with tempfile.TemporaryDirectory() as tmp:
# os.chdir(tmp)
#
# folder = f"gau2grid-am{am}-{gg.__version__}"
# zip_filename = folder + '.zip'
# zip_path = os.path.join(tmp, zip_filename)
# zipf = zipfile.ZipFile(zip_path, 'w', zipfile.ZIP_DEFLATED)
#
# path = Path(tmp) / folder
# path.mkdir(parents=True)
# gg.c_gen.generate_c_gau2grid(am, path=path.resolve())
#
# for filename in path.iterdir():
# arcname = os.path.join(*str(filename).split(os.path.sep)[-2:])
# print(filename, arcname)
# zipf.write(filename, arcname=arcname)
#

0 comments on commit 8c9bf1a

Please sign in to comment.