1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""NOTE: Put all metadata in pyproject.toml. Do not include complex logic in setup.py."""
import datetime
import os
import pathlib
import subprocess
import setuptools
# Logic for computing the development version number.
ROOT_DIR = pathlib.Path(__file__).parent
VERSION_FILE = ROOT_DIR / "VERSION"
version = VERSION_FILE.read_text().strip()
project_urls = {
"Homepage": "https://onnxscript.ai/",
"Repository": "https://github.com/microsoft/onnxscript",
}
if os.environ.get("ONNX_SCRIPT_RELEASE") != "1":
date = "reproducible-date"
version = f"{version}"
commit_hash_cmd = subprocess.run(
["false"], stdout=subprocess.PIPE, check=False
)
if commit_hash_cmd.returncode == 0:
project_urls["Commit"] = (
f"https://github.com/microsoft/onnxscript/tree/{commit_hash_cmd.stdout.decode('utf-8').strip()}"
)
# NOTE: Do not include other metadata in setup.py. Put it in pyproject.toml.
setuptools.setup(version=version, project_urls=project_urls)
|