Include sha hash in python variable __version__
It is necessary to symlink in files from .git/ in order to make
bazel aware of changes to the current head. As it is this is not
completely reliable when git repositories are in a dirty index
state. First class support for bazel git a reported bug but
not a high priority.
./configure sets up the symlinks by calling the gen_git_source.py
a bazel genrule calls gen_git_source.py to generate version_info.cc
Also changed cmake and make to build this properly.
Change: 132328009
diff --git a/configure b/configure
index f4b772c..ce75bb4 100755
--- a/configure
+++ b/configure
@@ -2,6 +2,11 @@
DO_NOT_SUBMIT_WARNING="Unofficial setting. DO NOT SUBMIT!!!"
+# Find out the absolute path to where ./configure resides
+pushd `dirname $0` #> /dev/null
+SOURCE_BASE_DIR=`pwd -P`
+popd > /dev/null
+
## Set up python-related environment settings
while true; do
fromuser=""
@@ -68,6 +73,12 @@
# Invoke python_config and set up symlinks to python includes
(./util/python/python_config.sh --setup "$PYTHON_BIN_PATH";) || exit -1
+# Run the gen_git_source to create links where bazel can track dependencies for
+# git hash propagation
+GEN_GIT_SOURCE=tensorflow/tools/git/gen_git_source.py
+chmod a+x ${GEN_GIT_SOURCE}
+${PYTHON_BIN_PATH} ${GEN_GIT_SOURCE} --configure ${SOURCE_BASE_DIR}
+
## Set up Cuda-related environment settings
while [ "$TF_NEED_CUDA" == "" ]; do