@sentry/cli 2.13.0 → 2.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/checksums.txt CHANGED
@@ -1,9 +1,9 @@
1
- sentry-cli-Darwin-arm64=5c3234a27ffde95ef3abe344b8ec48d0233d582029816c6b37a74581a189d431
2
- sentry-cli-Darwin-universal=549400349cddc29122373c2a166f3ea3723e309eac3690c66543924d9d638bd3
3
- sentry-cli-Darwin-x86_64=2f597027d36035beca9b4cad79e65370bf0dd4d6aa20842c907a8cae4c8d528a
4
- sentry-cli-Linux-aarch64=01b39b3dd502d532846b741e612a1796ce727b79bb69cbab45b23126507717f8
5
- sentry-cli-Linux-armv7=85750995d28f7a0771f6f6a9fe23197dc35512047afc3c78bb042613d41aea8f
6
- sentry-cli-Linux-i686=05e52e80408ad1e513cdc2e6732486331bfdc122951478a91f44c6652b282cf7
7
- sentry-cli-Linux-x86_64=217bcb4e5fd74b189be5a834ba835828eb6f7d97d3f676ef2da26f4de3df1729
8
- sentry-cli-Windows-i686.exe=5d0a4c3c6a49ca7cd65b685aff0d56a2e79a29e841380ca493c6bc3656ebd8cb
9
- sentry-cli-Windows-x86_64.exe=753d0f2cb65bfb5ab95d74d034c2d58451d5dcae1136e16b3e1aa0683ee1af95
1
+ sentry-cli-Darwin-arm64=909f2142841a63ad8e8a40329535287cf01ca952a9a3e9202e901a338df88dea
2
+ sentry-cli-Darwin-universal=eece9ea16d69cb99c9e2a2e797207ae0c4e5db9aaf6a5beaad0c364c56ae4cc6
3
+ sentry-cli-Darwin-x86_64=01c9a0a5795ec845cd814fc1d74c58b33759523d1d4f14277399e2c1f20f79ae
4
+ sentry-cli-Linux-aarch64=f475f9c778d48d1676dc3785aa9fa81301fed95498297eb893d114f3ad49b008
5
+ sentry-cli-Linux-armv7=f7ff875dec5cd2e34ff628321a53b79a9228c6f6145f7bc73cc4b2fff01ee05a
6
+ sentry-cli-Linux-i686=4b3e5229236deacbb7d338d97c06f75412ed72995aa4af7f08d8ba2bc80c4304
7
+ sentry-cli-Linux-x86_64=473df54936d111d9864ca20c34a746174d7c9cb069e0387165d5ffa713f7f124
8
+ sentry-cli-Windows-i686.exe=d84a44d7657bc21385ba7c9d9fb982991b4378174b61b8e0306da31dbf8b116a
9
+ sentry-cli-Windows-x86_64.exe=291d6e66e3563833bf1e577ada9e9e1f0c54bbc288b5bdf1a409221f7f1b76e3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/cli",
3
- "version": "2.13.0",
3
+ "version": "2.14.1",
4
4
  "description": "A command line utility to work with Sentry. https://docs.sentry.io/hosted/learn/cli/",
5
5
  "repository": "git://github.com/getsentry/sentry-cli.git",
6
6
  "homepage": "https://docs.sentry.io/hosted/learn/cli/",
@@ -123,13 +123,17 @@ function createProgressBar(name, total) {
123
123
  }
124
124
 
125
125
  function npmCache() {
126
- const env = process.env;
127
- return (
128
- env.npm_config_cache ||
129
- env.npm_config_cache_folder ||
130
- env.npm_config_yarn_offline_mirror ||
131
- (env.APPDATA ? path.join(env.APPDATA, 'npm-cache') : path.join(os.homedir(), '.npm'))
132
- );
126
+ const keys = ['npm_config_cache', 'npm_config_cache_folder', 'npm_config_yarn_offline_mirror'];
127
+
128
+ for (let key of [...keys, ...keys.map((k) => k.toUpperCase())]) {
129
+ if (process.env[key]) return process.env[key];
130
+ }
131
+
132
+ if (process.env.APPDATA) {
133
+ return path.join(process.env.APPDATA, 'npm-cache');
134
+ }
135
+
136
+ return path.join(os.homedir(), '.npm');
133
137
  }
134
138
 
135
139
  function getCachedPath(url) {
package/scripts/wheels ADDED
@@ -0,0 +1,174 @@
1
+ #!/usr/bin/env python3
2
+ import argparse
3
+ import base64
4
+ import hashlib
5
+ import os.path
6
+ import shutil
7
+ import tempfile
8
+ import zipfile
9
+ from typing import NamedTuple
10
+
11
+
12
+ class Wheel(NamedTuple):
13
+ src: str
14
+ plat: str
15
+ exe: str = 'sentry-cli'
16
+
17
+
18
+ WHEELS = (
19
+ Wheel(
20
+ src='sentry-cli-Darwin-arm64',
21
+ plat='macos_11_0_arm64',
22
+ ),
23
+ Wheel(
24
+ src='sentry-cli-Darwin-universal',
25
+ plat='macos_11_0_universal2',
26
+ ),
27
+ Wheel(
28
+ src='sentry-cli-Darwin-x86_64',
29
+ plat='macos_10_15_x86_64',
30
+ ),
31
+ Wheel(
32
+ src='sentry-cli-Linux-aarch64',
33
+ plat='manylinux_2_17_aarch64.manylinux2014_aarch64',
34
+ ),
35
+ Wheel(
36
+ src='sentry-cli-Linux-armv7',
37
+ plat='manylinux_2_17_armv7l.manylinux2014_armv7l',
38
+ ),
39
+ Wheel(
40
+ src='sentry-cli-Linux-i686',
41
+ plat='manylinux_2_17_i686.manylinux2014_i686',
42
+ ),
43
+ Wheel(
44
+ src='sentry-cli-Linux-x86_64',
45
+ plat='manylinux_2_17_x86_64.manylinux2014_x86_64',
46
+ ),
47
+ Wheel(
48
+ src='sentry-cli-Windows-i686.exe',
49
+ plat='win32',
50
+ exe='sentry-cli.exe',
51
+ ),
52
+ Wheel(
53
+ src='sentry-cli-Windows-x86_64.exe',
54
+ plat='win_amd64',
55
+ exe='sentry-cli.exe',
56
+ ),
57
+ )
58
+
59
+
60
+ def main() -> int:
61
+ parser = argparse.ArgumentParser()
62
+ parser.add_argument('--binaries', required=True)
63
+ parser.add_argument('--base', required=True)
64
+ parser.add_argument('--dest', required=True)
65
+ args = parser.parse_args()
66
+
67
+ expected = {wheel.src for wheel in WHEELS}
68
+ received = set(os.listdir(args.binaries))
69
+ if expected != received:
70
+ raise SystemExit(
71
+ f'Unexpected binaries:\n\n'
72
+ f'- extra: {", ".join(sorted(received - expected))}\n'
73
+ f'- missing: {", ".join(sorted(expected - received))}'
74
+ )
75
+
76
+ sdist_path = wheel_path = None
77
+ for fname in os.listdir(args.base):
78
+ if fname.endswith('.tar.gz'):
79
+ sdist_path = os.path.join(args.base, fname)
80
+ elif fname.endswith('.whl'):
81
+ wheel_path = os.path.join(args.base, fname)
82
+ else:
83
+ raise SystemExit(f'unexpected file in `--base`: {fname}')
84
+
85
+ if sdist_path is None or wheel_path is None:
86
+ raise SystemExit('expected wheel and sdist in `--base`')
87
+
88
+ os.makedirs(args.dest, exist_ok=True)
89
+ shutil.copy(sdist_path, args.dest)
90
+
91
+ for wheel in WHEELS:
92
+ binary_src = os.path.join(args.binaries, wheel.src)
93
+ binary_size = os.stat(binary_src).st_size
94
+ with open(binary_src, 'rb') as bf:
95
+ digest = hashlib.sha256(bf.read()).digest()
96
+ digest_b64 = base64.urlsafe_b64encode(digest).rstrip(b'=').decode()
97
+
98
+ basename = os.path.basename(wheel_path)
99
+ wheelname, _ = os.path.splitext(basename)
100
+ name, version, py, abi, plat = wheelname.split('-')
101
+
102
+ with tempfile.TemporaryDirectory() as tmp:
103
+ with zipfile.ZipFile(wheel_path) as zipf:
104
+ zipf.extractall(tmp)
105
+
106
+ distinfo = os.path.join(tmp, f'{name}-{version}.dist-info')
107
+ scripts = os.path.join(tmp, f'{name}-{version}.data', 'scripts')
108
+
109
+ # replace the script binary with our copy
110
+ os.remove(os.path.join(scripts, 'sentry-cli'))
111
+ shutil.copy(binary_src, os.path.join(scripts, wheel.exe))
112
+
113
+ # rewrite RECORD to include the new file
114
+ record_fname = os.path.join(distinfo, 'RECORD')
115
+ with open(record_fname) as f:
116
+ record_lines = list(f)
117
+
118
+ record = f'{name}-{version}.data/scripts/sentry-cli,'
119
+ for i, line in enumerate(record_lines):
120
+ if line.startswith(record):
121
+ record_lines[i] = (
122
+ f'{name}-{version}.data/scripts/{wheel.exe},'
123
+ f'sha256={digest_b64},'
124
+ f'{binary_size}\n'
125
+ )
126
+ break
127
+ else:
128
+ raise SystemExit(f'could not find {record!r} in RECORD')
129
+
130
+ with open(record_fname, 'w') as f:
131
+ f.writelines(record_lines)
132
+
133
+ # rewrite WHEEL to have the new tags
134
+ wheel_fname = os.path.join(distinfo, 'WHEEL')
135
+ with open(wheel_fname) as f:
136
+ wheel_lines = list(f)
137
+
138
+ for i, line in enumerate(wheel_lines):
139
+ if line.startswith('Tag: '):
140
+ wheel_lines[i:i + 1] = [
141
+ f'Tag: {py}-{abi}-{plat}\n'
142
+ for plat in wheel.plat.split('.')
143
+ ]
144
+ break
145
+ else:
146
+ raise SystemExit("could not find 'Tag: ' in WHEEL")
147
+
148
+ with open(wheel_fname, 'w') as f:
149
+ f.writelines(wheel_lines)
150
+
151
+ # write out the final zip
152
+ new_basename = f'{name}-{version}-{py}-{abi}-{wheel.plat}.whl'
153
+ tmp_new_wheel = os.path.join(tmp, new_basename)
154
+ fnames = sorted(
155
+ os.path.join(root, fname)
156
+ for root, _, fnames in os.walk(tmp)
157
+ for fname in fnames
158
+ )
159
+ with zipfile.ZipFile(tmp_new_wheel, 'w') as zipf:
160
+ for fname in fnames:
161
+ zinfo = zipfile.ZipInfo(os.path.relpath(fname, tmp))
162
+ if '/scripts/' in zinfo.filename:
163
+ zinfo.external_attr = 0o100755 << 16
164
+ with open(fname, 'rb') as fb:
165
+ zipf.writestr(zinfo, fb.read())
166
+
167
+ # move into dest
168
+ shutil.move(tmp_new_wheel, args.dest)
169
+
170
+ return 0
171
+
172
+
173
+ if __name__ == '__main__':
174
+ raise SystemExit(main())