This repository has been archived by the owner on Sep 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
/
setup.py
63 lines (51 loc) · 2 KB
/
setup.py
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import datetime
import os
import subprocess
from pathlib import Path
import setuptools
this_dir = os.path.dirname(os.path.abspath(__file__))
def get_local_version_suffix() -> str:
date_suffix = datetime.datetime.now().strftime("%Y%m%d")
git_hash = subprocess.check_output(
["git", "rev-parse", "--short", "HEAD"], cwd=Path(__file__).parent
).decode("ascii")[:-1]
return f"+{git_hash}.d{date_suffix}"
def write_version_file():
version_path = os.path.join(this_dir, "version.py")
with open(version_path, "w") as f:
f.write("# noqa: C801\n")
f.write(f'__version__ = "{version}"\n')
tag = os.getenv("GIT_TAG")
if tag is not None:
f.write(f'git_tag = "{tag}"\n')
def get_install_requires():
with open(Path(this_dir) / 'requirements.txt', 'r') as f:
return f.readlines()
if __name__ == "__main__":
version_txt = os.path.join(this_dir, "version.txt")
with open(version_txt) as f:
version = f.readline().strip()
version += get_local_version_suffix()
write_version_file()
setuptools.setup(
name="model_opt",
description="Optimizing the Lifetime and Location of Arrays",
version=version,
license='MIT',
packages=setuptools.find_packages(exclude=("tests", "tests.*")),
install_requires=get_install_requires(),
python_requires=">=3.6",
author="Facebook AI Research",
classifiers=[
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Operating System :: OS Independent",
],
project_urls={"Source": "https://github.com/facebookresearch/MODeL_opt"},
)