Skip to content

Commit 567dc97

Browse files
committed
Add disting to pypi to release steps
1 parent e6c63ab commit 567dc97

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

litex_setup.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@
44
import sys
55
import time
66
import subprocess
7-
import shutil
87
import hashlib
98
import argparse
109

11-
import urllib.request
1210

1311
start_time = time.time()
1412
current_path = os.path.abspath(os.curdir)
@@ -207,6 +205,14 @@ def git_tag(tag=None):
207205
os.system(f"git tag {tag}")
208206
os.system(f"git push --tags")
209207

208+
# Python Build helpers -----------------------------------------------------------------------------
209+
def build_repo():
210+
os.system(f"python -m build --sdist --wheel")
211+
os.system(f"python -m twine check dist/*")
212+
213+
def push_to_pypi():
214+
os.system(f"python -m twine upload dist/*")
215+
210216
# Git repositories initialization ------------------------------------------------------------------
211217

212218
def litex_setup_init_repos(config="standard", tag=None, dev_mode=False):
@@ -330,11 +336,23 @@ def litex_setup_release_repos(tag):
330336
for name in install_configs["full"]:
331337
if name in ["migen"]:
332338
continue
333-
repo = git_repos[name]
339+
334340
os.chdir(os.path.join(current_path, name))
341+
335342
# Tag Repo.
336343
print_status(f"Tagging {name} Git repository as {tag}...")
337344
git_tag(tag=tag)
345+
346+
# TODO: Not all repos have been uplifted for redistribution.
347+
# Eventually, this "if" check should be removed
348+
if name in ("litex",):
349+
# Make sure the repo builds for distribution
350+
print_status(f"Building {name} python package...")
351+
build_repo()
352+
353+
# Push disted artifacts to pypi
354+
print_status(f"Publishing {name} to pypi...")
355+
push_to_pypi()
338356
else:
339357
print_status(f"Not confirmed, exiting.")
340358

0 commit comments

Comments
 (0)