Mercurial > public > mercurial-scm > hg-stable
annotate contrib/automation/hgautomation/pypi.py @ 42913:92593d72e10b
automation: implement "publish-windows-artifacts" command
The new command and associated functionality can be used to
automate the publishing of Windows release artifacts. It
supports uploading wheels to PyPI (using twine) and copying
the artifacts to mercurial-scm.org and updating the latest.dat
file to advertise them via the website.
I ran `automation.py publish-windows-artifacts 5.1.1` and it
appeared to "just work." But the real test will be to do this
on the next release...
Differential Revision: https://phab.mercurial-scm.org/D6786
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Thu, 05 Sep 2019 21:09:58 -0700 |
parents | |
children | 2372284d9457 |
rev | line source |
---|---|
42913
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
1 # pypi.py - Automation around PyPI |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
2 # |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
3 # Copyright 2019 Gregory Szorc <gregory.szorc@gmail.com> |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
4 # |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
5 # This software may be used and distributed according to the terms of the |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
6 # GNU General Public License version 2 or any later version. |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
7 |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
8 # no-check-code because Python 3 native. |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
9 |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
10 from twine.commands.upload import ( |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
11 upload as twine_upload, |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
12 ) |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
13 from twine.settings import ( |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
14 Settings, |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
15 ) |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
16 |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
17 |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
18 def upload(paths): |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
19 """Upload files to PyPI. |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
20 |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
21 `paths` is an iterable of `pathlib.Path`. |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
22 """ |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
23 settings = Settings() |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
24 |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
25 twine_upload(settings, [str(p) for p in paths]) |