blob: 016ee18aa046d250154b99504465735251a6f6c1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#!/usr/bin/env python3
#
# List our crates as they appear in Cargo.toml. Useful for scripting.
#
# NB you may want list_crates_publish instead
# *This* script excludes crates according to an ad-hoc criterion
import toml.decoder
import sys
import os.path
TOPDIR = os.path.split(os.path.dirname(sys.argv[0]))[0]
WORKSPACE_TOML = os.path.join(TOPDIR, "Cargo.toml")
def strip_prefix(s, prefixes):
for prefix in prefixes:
if s.startswith(prefix):
return s[len(prefix):]
return s
def crate_list():
t = toml.decoder.load(WORKSPACE_TOML)
return list(strip_prefix(name, ["crates/", "maint/", "examples/gsoc2023/", "examples/hyper/"]) for name in t['workspace']['members'])
if __name__ == '__main__':
for item in crate_list():
print(item)
|