]>
git.proxmox.com Git - rustc.git/blob - src/tools/cargo/publish.py
3 # This script is used to publish Cargo to crates.io.
5 # This is run automatically every 6 weeks by the Release team's automation
6 # whose source is at https://github.com/rust-lang/simpleinfra/.
8 # See https://doc.crates.io/contrib/process/release.html for more about
9 # Cargo's release process.
15 from urllib
.error
import HTTPError
19 'credential/cargo-credential',
20 'credential/cargo-credential-libsecret',
21 'credential/cargo-credential-wincred',
22 'credential/cargo-credential-1password',
23 'credential/cargo-credential-macos-keychain',
24 'crates/cargo-platform',
31 def already_published(name
, version
):
33 urllib
.request
.urlopen('https://crates.io/api/v1/crates/%s/%s/download' % (name
, version
))
34 except HTTPError
as e
:
41 def maybe_publish(path
):
42 content
= open(os
.path
.join(path
, 'Cargo.toml')).read()
43 name
= re
.search('^name = "([^"]+)"', content
, re
.M
).group(1)
44 version
= re
.search('^version = "([^"]+)"', content
, re
.M
).group(1)
45 if already_published(name
, version
):
46 print('%s %s is already published, skipping' % (name
, version
))
48 subprocess
.check_call(['cargo', 'publish', '--no-verify'], cwd
=path
)
53 print('Starting publish...')
54 for path
in TO_PUBLISH
:
57 print('Publish complete!')
60 if __name__
== '__main__':