55import zipfile
66from pathlib import Path
77
8+
89PYTHON_VERSION = "3.8.10"
910
11+
1012DO_NOT_ADD = [
1113 "__pycache__" ,
1214 "_distutils_hack" ,
2426
2527ENV_PATH = Path (".venv" )
2628LIB_PATH = Path (ENV_PATH , "Lib" , "site-packages" )
29+
2730OUT_PATH = Path ("Lib" , "site-packages" )
2831ZIP_PATH = Path ("Lib" , "site-packages.zip" )
2932REL_PATH = Path ("Data" , "Python" , OUT_PATH )
@@ -55,7 +58,7 @@ def main():
5558 "subfolder in the Open Note Block Studio root directory."
5659 )
5760
58- if not os .path .exists (".venv" ):
61+ if not os .path .exists (ENV_PATH ):
5962 raise FileNotFoundError (
6063 "The .venv directory was not found. Have you ran"
6164 "poetry install before running this script?"
@@ -71,7 +74,7 @@ def main():
7174
7275 # Package dependencies
7376 package_count = 0
74- with zipfile .PyZipFile (ZIP_PATH , mode = "w" ) as zip_module :
77+ with zipfile .PyZipFile (ZIP_PATH , mode = "w" ) as zip_file :
7578 for path in os .listdir (LIB_PATH ):
7679 lib_name = os .path .basename (path )
7780 lib_path = Path (LIB_PATH , lib_name )
@@ -87,8 +90,9 @@ def main():
8790 str (lib_path ), ddir = path_prefix , force = True , quiet = 2 , legacy = True
8891 )
8992
93+ # Write to ZIP
9094 try :
91- zip_module .writepy (lib_path , filterfunc = pack_filter )
95+ zip_file .writepy (lib_path , filterfunc = pack_filter )
9296 except RuntimeError : # only directories or .py files accepted
9397 continue
9498 else :
0 commit comments