You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by tz...@apache.org on 2020/03/29 06:30:47 UTC

[flink-statefun] 02/04: [FLINK-16730] [docs] Make create_python_walkthrough.sh return to user dir

This is an automated email from the ASF dual-hosted git repository.

tzulitai pushed a commit to branch release-2.0
in repository https://gitbox.apache.org/repos/asf/flink-statefun.git

commit 6b514d2f03938c3d80768fe2d527398a902681b6
Author: Tzu-Li (Gordon) Tai <tz...@apache.org>
AuthorDate: Sun Mar 29 12:15:01 2020 +0800

    [FLINK-16730] [docs] Make create_python_walkthrough.sh return to user dir
    
    This closes #79.
---
 tools/docs/create_python_walkthrough.sh | 30 ++++++++++++++++++++++++------
 1 file changed, 24 insertions(+), 6 deletions(-)

diff --git a/tools/docs/create_python_walkthrough.sh b/tools/docs/create_python_walkthrough.sh
index 284ac99..f9c9274 100755
--- a/tools/docs/create_python_walkthrough.sh
+++ b/tools/docs/create_python_walkthrough.sh
@@ -15,16 +15,30 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-cd $(dirname $0)
+# fail immediately
+set -o errexit
+set -o nounset
 
-rm -rf ../../docs/downloads/walkthrough.zip
+CURR_DIR=`pwd`
+BASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
+PROJECT_ROOT="${BASE_DIR}/../../"
+
+# Sanity check to ensure that resolved paths are valid; a LICENSE file should aways exist in project root
+if [ ! -f ${PROJECT_ROOT}/LICENSE ]; then
+    echo "Project root path ${PROJECT_ROOT} is not valid; script may be in the wrong directory."
+    exit 1
+fi
+
+###########################
+
+rm -rf ${PROJECT_ROOT}/docs/downloads/walkthrough.zip
+
+cd ${BASE_DIR}
 
 rm -rf statefun-walkthrough
-cp -r ../../statefun-examples/statefun-python-greeter statefun-walkthrough
+cp -r ${PROJECT_ROOT}/statefun-examples/statefun-python-greeter statefun-walkthrough
 
 rm statefun-walkthrough/build-example.sh
-rm statefun-walkthrough/pom.xml
-rm -rf statefun-walkthrough/target
 
 rm statefun-walkthrough/greeter/greeter.py
 cp greeter.py statefun-walkthrough/greeter/greeter.py
@@ -36,4 +50,8 @@ mv Dockerfile statefun-walkthrough/greeter/Dockerfile
 
 zip -r walkthrough.zip statefun-walkthrough
 rm -rf statefun-walkthrough
-mv walkthrough.zip ../../docs/downloads/walkthrough.zip
+
+mkdir -p ${PROJECT_ROOT}/docs/downloads/
+mv walkthrough.zip ${PROJECT_ROOT}/docs/downloads/walkthrough.zip
+
+cd ${CURR_DIR}