]>
git.proxmox.com Git - cargo.git/blob - publish.py
3 # This script is used to publish Cargo to crates.io.
9 from urllib
.error
import HTTPError
13 'crates/cargo-platform',
19 def already_published(name
, version
):
21 urllib
.request
.urlopen('https://crates.io/api/v1/crates/%s/%s/download' % (name
, version
))
22 except HTTPError
as e
:
29 def maybe_publish(path
):
30 content
= open(os
.path
.join(path
, 'Cargo.toml')).read()
31 name
= re
.search('^name = "([^"]+)"', content
, re
.M
).group(1)
32 version
= re
.search('^version = "([^"]+)"', content
, re
.M
).group(1)
33 if already_published(name
, version
):
34 print('%s %s is already published, skipping' % (name
, version
))
36 subprocess
.check_call(['cargo', 'publish', '--no-verify'], cwd
=path
)
40 print('Doing dry run first...')
41 for path
in TO_PUBLISH
:
42 subprocess
.check_call(['cargo', 'publish', '--no-verify', '--dry-run'], cwd
=path
)
43 print('Starting publish...')
44 for path
in TO_PUBLISH
:
46 print('Publish complete!')
49 if __name__
== '__main__':