-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3feb1a5
commit fdd5518
Showing
4 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,13 +4,43 @@ | |
# GNU Lesser General Public License version 2. | ||
|
||
import os | ||
import subprocess | ||
import sys | ||
from pathlib import Path | ||
|
||
from setuptools import find_packages, setup | ||
|
||
from torch.utils.cpp_extension import BuildExtension, CppExtension | ||
|
||
ROOT_DIR = Path(__file__).absolute().parent | ||
|
||
|
||
# Same version logic as in torchvision | ||
def get_and_write_version(): | ||
with open(ROOT_DIR / "version.txt") as f: | ||
version = f.readline().strip() | ||
sha = "Unknown" | ||
|
||
try: | ||
sha = ( | ||
subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=str(ROOT_DIR)) | ||
.decode("ascii") | ||
.strip() | ||
) | ||
except Exception: | ||
pass | ||
|
||
if os.getenv("BUILD_VERSION"): | ||
version = os.getenv("BUILD_VERSION") | ||
elif sha != "Unknown": | ||
version += "+" + sha[:7] | ||
|
||
with open(ROOT_DIR / "torchvision_extra_decoders/version.py", "w") as f: | ||
f.write(f"__version__ = '{version}'\n") | ||
f.write(f"git_version = {repr(sha)}\n") | ||
|
||
return version | ||
|
||
|
||
def find_library(header): | ||
# returns (found, include dir, library dir) | ||
|
@@ -92,7 +122,7 @@ def get_requirements(): | |
|
||
setup( | ||
name=PACKAGE_NAME, | ||
version="0.0.1.dev", | ||
version=get_and_write_version(), | ||
author="PyTorch Team", | ||
author_email="[email protected]", | ||
url="TODO", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.0.1.dev |