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
|
|
|
|
|
2023-09-16 07:23:52 +08:00
|
|
|
version_file = Path(__file__).parent.parent / "gradio" / "package.json"
|
|
|
|
with version_file.open() as f:
|
|
|
|
version = json.load(f)["version"]
|
2022-09-07 04:49:49 +08:00
|
|
|
|
|
|
|
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")
|