You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ga...@apache.org on 2021/12/24 08:26:27 UTC

[flink-ml] 02/02: [hotfix] Add scripts to build and release python artifacts

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

gaoyunhaii pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-ml.git

commit d3d2ea21f05b55f9d3c5e58f1337d661ec55b05c
Author: Dong Lin <li...@gmail.com>
AuthorDate: Fri Dec 24 12:32:32 2021 +0800

    [hotfix] Add scripts to build and release python artifacts
    
    This closes #44.
---
 flink-ml-python/build-distribution.sh        | 46 ++++++++++++++++
 tools/releasing/create_python_sdk_release.sh | 80 ++++++++++++++++++++++++++++
 2 files changed, 126 insertions(+)

diff --git a/flink-ml-python/build-distribution.sh b/flink-ml-python/build-distribution.sh
new file mode 100755
index 0000000..424326a
--- /dev/null
+++ b/flink-ml-python/build-distribution.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+CURR_DIR=`pwd`
+BASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
+
+
+###########################
+
+cd ${BASE_DIR}
+
+# create a target/ directory like in MAVEN.
+# this directory will contain a temporary copy of the source
+# eventually the built artifact will be copied to ${BASE_DIR}/dist and this target
+# directory will be deleted.
+rm -rf dist/
+rm -rf ../target/
+mkdir -p ../target/
+
+# copy all the sources into target
+rsync -a * ../target/
+
+cd ../target/
+
+# built the Python SDK
+python3 setup.py sdist
+
+cp -r dist ${BASE_DIR}/dist
+
+echo "Built Python SDK wheels and packages at ${BASE_DIR}/dist."
+
+cd ${CURR_DIR}
diff --git a/tools/releasing/create_python_sdk_release.sh b/tools/releasing/create_python_sdk_release.sh
new file mode 100755
index 0000000..937cc4d
--- /dev/null
+++ b/tools/releasing/create_python_sdk_release.sh
@@ -0,0 +1,80 @@
+#!/usr/bin/env bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+##
+## Variables with defaults (if not overwritten by environment)
+##
+SKIP_GPG=${SKIP_GPG:-false}
+MVN=${MVN:-mvn}
+
+##
+## Required variables
+##
+RELEASE_VERSION=${RELEASE_VERSION}
+
+if [ -z "${RELEASE_VERSION}" ]; then
+    echo "RELEASE_VERSION was not set."
+    exit 1
+fi
+
+# fail immediately
+set -o errexit
+set -o nounset
+
+if [ "$(uname)" == "Darwin" ]; then
+    SHASUM="shasum -a 512"
+else
+    SHASUM="sha512sum"
+fi
+
+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
+
+###########################
+
+RELEASE_DIR=${PROJECT_ROOT}/release/
+mkdir -p ${RELEASE_DIR}
+
+cd ${PROJECT_ROOT}/flink-ml-python/
+./build-distribution.sh
+
+mv dist/* ${RELEASE_DIR}
+
+SOURCE_DIST="apache-flink-ml-$RELEASE_VERSION.tar.gz"
+WHL_VERSION=`echo "$RELEASE_VERSION" | tr - _`
+WHL_DIST="apache_flink_ml-$WHL_VERSION-py3-none-any.whl"
+
+cd ${RELEASE_DIR}
+# Sign sha the files
+if [ "$SKIP_GPG" == "false" ] ; then
+    gpg --armor --detach-sig ${SOURCE_DIST}
+    gpg --armor --detach-sig ${WHL_DIST}
+fi
+${SHASUM} "${SOURCE_DIST}" > "${SOURCE_DIST}.sha512"
+${SHASUM} "${WHL_DIST}" > "${WHL_DIST}.sha512"
+
+echo "Created Python SDK distribution files at $RELEASE_DIR."
+
+cd ${CURR_DIR}