Skip to content

Commit

Permalink
feat(//py): Add the git revision to non release builds
Browse files Browse the repository at this point in the history
Signed-off-by: Naren Dasan <naren@narendasan.com>
Signed-off-by: Naren Dasan <narens@nvidia.com>
  • Loading branch information
narendasan committed Oct 20, 2021
1 parent ce45444 commit 4a0a918
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 7 deletions.
1 change: 1 addition & 0 deletions .github/workflows/docgen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
- name: Generate New Docs
run: |
cd docsrc
python3 -c "import trtorch; print(trtorch.__version__)"
make html
- uses: stefanzweifel/git-auto-commit-action@v4
with:
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ __pycache__
dist
bdist
py/trtorch/_version.py
py/trtorch/lib
py/trtorch/include
py/trtorch/bin
py/trtorch/BUILD
py/trtorch/LICENSE
py/trtorch/WORKSPACE
py/wheelhouse
py/.eggs
notebooks/.ipynb_checkpoints/
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile.docs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM nvcr.io/nvidia/tensorrt:21.02-py3
RUN curl https://bazel.build/bazel-release.pub.gpg | apt-key add -
RUN echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list

RUN apt-get update && apt-get install -y bazel-4.0.0 clang-format-9
RUN apt-get update && apt-get install -y bazel-4.0.0 clang-format-9 libjpeg9 libjpeg9-dev
RUN ln -s /usr/bin/bazel-4.0.0 /usr/bin/bazel
RUN ln -s $(which clang-format-9) /usr/bin/clang-format

Expand Down
8 changes: 4 additions & 4 deletions py/build_whl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,25 @@ export CXX=g++

build_py36() {
/opt/python/cp36-cp36m/bin/python -m pip install -r requirements.txt
/opt/python/cp36-cp36m/bin/python setup.py bdist_wheel
/opt/python/cp36-cp36m/bin/python setup.py bdist_wheel --release
#auditwheel repair --plat manylinux2014_x86_64
}

build_py37() {
/opt/python/cp37-cp37m/bin/python -m pip install -r requirements.txt
/opt/python/cp37-cp37m/bin/python setup.py bdist_wheel
/opt/python/cp37-cp37m/bin/python setup.py bdist_wheel --release
#auditwheel repair --plat manylinux2014_x86_64
}

build_py38() {
/opt/python/cp38-cp38/bin/python -m pip install -r requirements.txt
/opt/python/cp38-cp38/bin/python setup.py bdist_wheel
/opt/python/cp38-cp38/bin/python setup.py bdist_wheel --release
#auditwheel repair --plat manylinux2014_x86_64
}

build_py39() {
/opt/python/cp39-cp39/bin/python -m pip install -r requirements.txt
/opt/python/cp39-cp39/bin/python setup.py bdist_wheel
/opt/python/cp39-cp39/bin/python setup.py bdist_wheel --release
#auditwheel repair --plat manylinux2014_x86_64
}

Expand Down
13 changes: 11 additions & 2 deletions py/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,21 @@

dir_path = os.path.dirname(os.path.realpath(__file__))

__version__ = '0.5.0a0'

CXX11_ABI = False

JETPACK_VERSION = None

__version__ = '0.5.0a0'

def get_git_revision_short_hash() -> str:
return subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']).decode('ascii').strip()

if "--release" not in sys.argv:
__version__ = __version__ + "+" + get_git_revision_short_hash()
else:
sys.argv.remove("--release")


if "--use-cxx11-abi" in sys.argv:
sys.argv.remove("--use-cxx11-abi")
CXX11_ABI = True
Expand Down

0 comments on commit 4a0a918

Please sign in to comment.