cangyeone commited on
Commit
a3f0ecd
·
verified ·
1 Parent(s): 25f4255

Sync canonical release scripts and config

Browse files
Files changed (1) hide show
  1. scripts/write_manifest.sh +15 -32
scripts/write_manifest.sh CHANGED
@@ -4,36 +4,19 @@ set -euo pipefail
4
  ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
5
 
6
  list_release_files() {
7
- find . -type f \
8
- ! -path './.git/*' \
9
- ! -path './.cache/*' \
10
- ! -path './__pycache__/*' \
11
- ! -path './*/__pycache__/*' \
12
- ! -path './.pytest_cache/*' \
13
- ! -path './.ipynb_checkpoints/*' \
14
- ! -path './*/.ipynb_checkpoints/*' \
15
- ! -path './data/hdf5_hour_subsets/*' \
16
- ! -path './data/picks/*' \
17
- ! -path './eval_picks/*' \
18
- ! -path './figures/*' \
19
- ! -path './essd/*' \
20
- ! -path './overleaf-*/*' \
21
- ! -path './publish_mini/*' \
22
- ! -path './temp/*' \
23
- ! -path './paired_eval*/*' \
24
- ! -path './essd_scripts/outputs/*' \
25
- ! -path './SeismicX-Cont-mini.zip' \
26
- ! -path './essd_scripts.zip' \
27
- ! -path './pickers/seismicxm.01.jit' \
28
- ! -path './upload_4files_to_ms.py' \
29
- ! -name 'manifest_sha256.txt' \
30
- ! -name 'manifest_filesizes.tsv' \
31
- ! -name '._*' \
32
- ! -path './*/._*' \
33
- ! -name '.DS_Store' \
34
- ! -path './*/.DS_Store' \
35
- ! -name '*.docx' \
36
- | LC_ALL=C sort
37
  }
38
 
39
  file_size_bytes() {
@@ -47,7 +30,7 @@ file_size_bytes() {
47
  (
48
  cd "$ROOT"
49
  list_release_files | while read -r path; do
50
- shasum -a 256 "$path"
51
  done
52
  ) > "$ROOT/manifest_sha256.txt"
53
 
@@ -55,7 +38,7 @@ file_size_bytes() {
55
  cd "$ROOT"
56
  printf "path\tsize_bytes\n"
57
  list_release_files | while read -r path; do
58
- printf "%s\t%s\n" "${path#./}" "$(file_size_bytes "$path")"
59
  done
60
  ) > "$ROOT/manifest_filesizes.tsv"
61
 
 
4
  ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
5
 
6
  list_release_files() {
7
+ PYTHONPATH="$ROOT/scripts" python3 - "$ROOT" <<'PY'
8
+ from pathlib import Path
9
+ import sys
10
+
11
+ from release import load_config, manifest_paths
12
+
13
+ root = Path(sys.argv[1])
14
+ _, config = load_config(root / "release_config.json")
15
+ paths = set(manifest_paths(root, config, code_only=True))
16
+ paths.difference_update(config.get("integrity_manifests", []))
17
+ for path in sorted(paths):
18
+ print(path)
19
+ PY
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  }
21
 
22
  file_size_bytes() {
 
30
  (
31
  cd "$ROOT"
32
  list_release_files | while read -r path; do
33
+ openssl dgst -r -sha256 "$path" | sed 's/ \*/ /'
34
  done
35
  ) > "$ROOT/manifest_sha256.txt"
36
 
 
38
  cd "$ROOT"
39
  printf "path\tsize_bytes\n"
40
  list_release_files | while read -r path; do
41
+ printf "%s\t%s\n" "$path" "$(file_size_bytes "$path")"
42
  done
43
  ) > "$ROOT/manifest_filesizes.tsv"
44