2023-04-04 06:48:18 +08:00
|
|
|
import json
|
2022-09-07 04:49:49 +08:00
|
|
|
import sys
|
2023-04-04 06:48:18 +08:00
|
|
|
import urllib.request
|
2022-09-07 04:49:49 +08:00
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
root_directory = Path(__file__).parent.parent
|
|
|
|
version = (root_directory / "gradio" / "version.txt").read_text(
|
|
|
|
encoding='utf8').strip()
|
|
|
|
|
|
|
|
with urllib.request.urlopen("https://pypi.org/pypi/gradio/json") as url:
|
|
|
|
releases = json.load(url)["releases"]
|
|
|
|
|
|
|
|
if version in releases:
|
|
|
|
print(f"Version {version} already exists on PyPI")
|
|
|
|
sys.exit(1)
|
|
|
|
else:
|
|
|
|
print(f"Version {version} does not exist on PyPI")
|