|
4 | 4 |
|
5 | 5 | import tempfile |
6 | 6 | from pathlib import Path |
7 | | -from empack.pack import pack_env, pack_directory |
| 7 | +from empack.pack import pack_env, pack_directory,add_tarfile_to_env_meta |
8 | 8 | from empack.pack import DEFAULT_CONFIG_PATH as EMPACK_DEFAULT_CONFIG_PATH |
9 | 9 | from empack.file_patterns import pkg_file_filter_from_yaml |
10 | 10 |
|
@@ -36,6 +36,7 @@ def pack_mounts(mounts, host_work_dir, backend_type): |
36 | 36 | ) |
37 | 37 | with open(Path(host_work_dir) / "mounts.json", "w") as f: |
38 | 38 | json.dump(mount_js_files, f, indent=4) |
| 39 | + return mount_js_files |
39 | 40 |
|
40 | 41 |
|
41 | 42 | def conda_env_to_cache_name(conda_env, backend_type): |
@@ -124,14 +125,26 @@ def run( |
124 | 125 | cache_dir=cache_dir, |
125 | 126 | outdir=host_work_dir, |
126 | 127 | compresslevel=9, |
127 | | - ) |
| 128 | + ) |
| 129 | + env_meta_filename = Path(host_work_dir) / "empack_env_meta.json" |
| 130 | + |
| 131 | + |
128 | 132 |
|
| 133 | + #raise RuntimeError("stop here") |
129 | 134 | # pack all the mounts |
130 | | - pack_mounts( |
| 135 | + mount_files = pack_mounts( |
131 | 136 | mounts=mounts, |
132 | 137 | backend_type=backend_type, |
133 | 138 | host_work_dir=host_work_dir, |
134 | 139 | ) |
| 140 | + for mount_file in mount_files: |
| 141 | + print(f"mount_file: {mount_file}") |
| 142 | + try: |
| 143 | + add_tarfile_to_env_meta( |
| 144 | + env_meta_filename=env_meta_filename, tarfile=mount_file |
| 145 | + ) |
| 146 | + except shutil.SameFileError: |
| 147 | + pass |
135 | 148 |
|
136 | 149 | # get the backend where the wasm code runs (ie node/browser-main/browser-worker) |
137 | 150 | backend = get_backend_cls(backend_type=backend_type)( |
|
0 commit comments