You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by iv...@apache.org on 2021/04/12 10:16:17 UTC
[ignite-python-thin-client] branch master updated: IGNITE-14518 Add
proper license and long description to package info - Fixes #31.
This is an automated email from the ASF dual-hosted git repository.
ivandasch pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite-python-thin-client.git
The following commit(s) were added to refs/heads/master by this push:
new fb400f1 IGNITE-14518 Add proper license and long description to package info - Fixes #31.
fb400f1 is described below
commit fb400f17b455c6d0228124e86e85da23f56c7846
Author: Ivan Daschinsky <iv...@apache.org>
AuthorDate: Mon Apr 12 13:14:45 2021 +0300
IGNITE-14518 Add proper license and long description to package info - Fixes #31.
---
scripts/apply_pull_request.sh | 239 +++++++++++++++++++++++++++++++++++++++++
scripts/git_patch_functions.sh | 129 ++++++++++++++++++++++
setup.py | 4 +-
3 files changed, 371 insertions(+), 1 deletion(-)
diff --git a/scripts/apply_pull_request.sh b/scripts/apply_pull_request.sh
new file mode 100755
index 0000000..ba05a82
--- /dev/null
+++ b/scripts/apply_pull_request.sh
@@ -0,0 +1,239 @@
+#!/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.
+#
+
+#
+# Pull request applier.
+#
+
+#
+# Start of Functions.
+#
+
+#
+# Prints usage.
+#
+usage () {
+ echo 'Usage: scripts/apply-pull-request.sh <pull-request-id> [-tb|--targetbranch <branch-name>] [--with-gpg] [-s|--sign-off]'
+ echo 'The script takes pull-request by given id and merges (with squash) all changes to target branch (master by default).'
+ echo "Argument 'pull-request-id' is mandatory."
+ echo "Target branch can be overwritten by using [-tb|--targetbranch <branch-name>] argument paramethers."
+}
+
+#
+# End of Functions.
+#
+
+if [ "${GIT_HOME}" = "" ]; then
+ GIT_HOME="$(dirname "$(cd "$(dirname "$0")"; "pwd")")";
+fi
+
+cd "${GIT_HOME}" || { echo "failed to change director ${GIT_HOME}"; exit 1; }
+
+if [ "${SCRIPTS_HOME}" = "" ]; then
+ SCRIPTS_HOME="${GIT_HOME}/scripts/"
+fi
+
+. "${SCRIPTS_HOME}"/git_patch_functions.sh # Import patch functions.
+
+PR_ID=$1
+
+#
+# Start reading of command line params.
+#
+if [ "${PR_ID}" = "" ]; then
+ echo "$0, ERROR:"
+ echo >&2 "You have to specify 'pull-request-id'."
+ echo
+ usage
+ exit 1
+fi
+
+if [ "${PR_ID}" = "-h" ]; then
+ usage
+ exit 0
+fi
+
+if [ "${PR_ID}" = "--help" ]; then
+ usage
+ exit 0
+fi
+
+
+while [[ $# -ge 2 ]]
+do
+ key="$2"
+
+ case $key in
+ -tb|--targetbranch)
+ TARGET_BRANCH="$3"
+ shift 2
+ ;;
+
+ --with-gpg)
+ WITH_GPG="true"
+ shift
+ ;;
+
+ -s|--sign-off)
+ WITH_SIGN_OFF="true"
+ shift
+ ;;
+
+ *)
+ echo "Unknown parameter: ${key}"
+ echo
+ usage
+ exit 1
+ ;;
+ esac
+done
+#
+# Enf reading of command line params.
+#
+
+
+# Script variables.
+if [ "${APACHE_GIT}" = "" ]; then
+ APACHE_GIT="https://gitbox.apache.org/repos/asf/ignite-python-thin-client.git"
+fi
+
+if [ "${GITHUB_MIRROR}" = "" ]; then
+ GITHUB_MIRROR="git@github.com:apache/ignite-python-thin-client.git"
+fi
+
+if [ "${TARGET_BRANCH}" = "" ]; then
+ TARGET_BRANCH="master"
+fi
+
+requireCleanWorkTree "${GIT_HOME}"
+
+CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
+
+if [ "$CURRENT_BRANCH" != "${TARGET_BRANCH}" ]; then
+ echo "$0, ERROR:"
+ echo "You have to be on ${TARGET_BRANCH} branch."
+
+ exit 1
+fi
+
+# Check that target branch is up-to-date.
+APACHE_GIT_TARGET_BRANCH="apache-git-target-br-tmp"
+
+git fetch ${APACHE_GIT} ${TARGET_BRANCH}:${APACHE_GIT_TARGET_BRANCH} &> /dev/null
+if test $? != 0; then
+ echo "$0, ERROR:"
+ echo >&2 "Couldn't fetch '${TARGET_BRANCH}' branch from ${APACHE_GIT}."
+ exit 1
+fi
+
+LOCAL_TARGET_BR_HASH=$(git rev-parse @)
+REMOTE_TARGET_BR_HASH=$(git rev-parse ${APACHE_GIT_TARGET_BRANCH})
+BASE_HASH=$(git merge-base @ ${APACHE_GIT_TARGET_BRANCH})
+
+git branch -D ${APACHE_GIT_TARGET_BRANCH} &> /dev/null
+
+if [ "$LOCAL_TARGET_BR_HASH" != "$REMOTE_TARGET_BR_HASH" ]; then
+ echo "$0, ERROR:"
+
+ if [ "$LOCAL_TARGET_BR_HASH" = "$BASE_HASH" ]; then
+ echo "Your local ${TARGET_BRANCH} branch is not up-to-date. You need to pull."
+ elif [ "$REMOTE_TARGET_BR_HASH" = "$BASE_HASH" ]; then
+ echo "Your local ${TARGET_BRANCH} branch is ahead of ${TARGET_BRANCH} branch at Apache git. You need to push."
+ else
+ echo "Your local ${TARGET_BRANCH} and Apache git ${TARGET_BRANCH} branches diverged. You need to pull, merge and pull."
+ fi
+
+ exit 1
+fi
+
+echo "Local ${TARGET_BRANCH} is Up-to-date."
+echo
+
+# Checkout pull-request branch.
+PR_BRANCH_NAME="pull-${PR_ID}-head"
+
+git fetch "${GITHUB_MIRROR}" "pull/${PR_ID}/head:${PR_BRANCH_NAME}" &> /dev/null
+if test $? != 0; then
+ echo "$0, ERROR:"
+ echo >&2 "There was not found pull request by ID = '${PR_ID}'."
+ exit 1
+fi
+
+# Get author name number.
+git checkout "${PR_BRANCH_NAME}" &> /dev/null
+if test $? != 0; then
+ echo "$0, ERROR:"
+ echo >&2 "Failed to checkout '${PR_BRANCH_NAME}' branch (the branch not found or already exists)."
+ exit 1
+fi
+
+AUTHOR="$(git --no-pager show -s --format="%aN <%aE>" HEAD)"
+ORIG_COMMENT="$(git log -1 --pretty=%B)"
+
+echo "Author of pull-request: '$AUTHOR'."
+echo
+
+# Update local target branch.
+git checkout ${TARGET_BRANCH} &> /dev/null
+
+# Take changes.
+git merge --squash "${PR_BRANCH_NAME}" &> /dev/null
+if test $? != 0; then
+ git reset --hard &> /dev/null
+
+ echo "$0, ERROR:"
+ echo >&2 "Could not merge the pull-request to ${TARGET_BRANCH} without conflicts. All local changes have been discarded. You're on ${TARGET_BRANCH} branch."
+ exit 1
+fi
+
+echo "Original comment is"
+echo "\"${ORIG_COMMENT}\""
+echo "Press [ENTER] if you're agree with the comment or type your comment and press [ENTER]:"
+read -r COMMENT
+echo
+
+if [ "${COMMENT}" == "" ]; then
+ COMMENT=${ORIG_COMMENT}
+fi
+
+COMMENT="${COMMENT} - Fixes #${PR_ID}."
+
+if [ "${EXCLUDE_SPECIAL_FILE}" = "true" ]; then
+ git checkout HEAD ignite-pull-request-id
+fi
+
+SIGN_OPTION=""
+if [ -n "${WITH_GPG}" ]; then
+ SIGN_OPTION="-S"
+fi
+
+if [ -n "${WITH_SIGN_OFF}" ]; then
+ SIGN_OPTION="${SIGN_OPTION} -s"
+fi
+
+git commit --author "${AUTHOR}" -a ${SIGN_OPTION} -m "${COMMENT}" &> /dev/null
+
+echo "Squash commit for pull request with id='${PR_ID}' has been added. The commit has been added with comment '${COMMENT}'."
+echo "Now you can review changes of the last commit at ${TARGET_BRANCH} and push it into ${APACHE_GIT} git after."
+echo "If you want to decline changes, you can remove the last commit from your repo by 'git reset --hard HEAD^'."
+echo
+
+# Clean-up.
+git branch -D "${PR_BRANCH_NAME}" &> /dev/null
+
+echo 'Successfully completed.'
diff --git a/scripts/git_patch_functions.sh b/scripts/git_patch_functions.sh
new file mode 100644
index 0000000..cc3aac3
--- /dev/null
+++ b/scripts/git_patch_functions.sh
@@ -0,0 +1,129 @@
+#!/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.
+#
+
+#
+# Git patch functions.
+#
+
+#
+# Define functions.
+#
+
+#
+# Formats patch. Create patch in one commit from user who run script and with default comment.
+#
+# Params:
+# - Git home.
+# - Default branch.
+# - Patch with patch.
+# - Suffix for created patch-file.
+#
+formatPatch () {
+ GIT_HOME=$1
+ DEFAULT_BRANCH=$2
+ PATCHED_BRANCH=$3
+ PATCH_SUFFIX=$4
+
+ if [ "${IGNITE_CURRENT_BRANCH}" = "${IGNITE_DEFAULT_BRANCH}" ]
+ then
+ echo "$0, ERROR:"
+ echo "You are on Default branch. Please, checkout branch with changes."
+
+ exit 1
+ fi
+
+ cd "${GIT_HOME}" || { echo "failed to change directory to ${GIT_HOME}"; exit 1; }
+
+ git checkout "${DEFAULT_BRANCH}"
+
+ DEF_BRANCH_REV="$(git rev-parse --short HEAD)"
+
+ git checkout -b tmppatch
+
+ # Merge to make only one commit.
+ git merge --squash ${PATCHED_BRANCH}
+ git commit -a -m "# ${PATCHED_BRANCH}"
+
+ PATCH_FILE=${PATCHES_HOME}'/'${DEFAULT_BRANCH}_${DEF_BRANCH_REV}_${PATCHED_BRANCH}${PATCH_SUFFIX}
+
+ git format-patch ${DEFAULT_BRANCH} --stdout > ${PATCH_FILE}
+ echo "Patch file created."
+
+ git checkout ${PATCHED_BRANCH}
+
+ git branch -D tmppatch # Delete tmp branch.
+
+ echo
+ echo "Patch created: ${PATCH_FILE}"
+}
+
+#
+# Determines Current branch.
+#
+# Params:
+# - Git home.
+# Return - Current branch.
+#
+determineCurrentBranch () {
+ GIT_HOME=$1
+
+ cd ${GIT_HOME} || { echo "failed to change directory to $1"; exit 1; }
+
+ CURRENT_BRANCH=`git rev-parse --abbrev-ref HEAD`
+
+ echo "$CURRENT_BRANCH"
+}
+
+#
+# Checks that given git repository has clean work tree (there is no uncommited changes).
+# Exit with code 1 in error case.
+#
+# Params:
+# - Git home.
+#
+requireCleanWorkTree () {
+ cd "$1" || { echo "failed to change directory to $1"; exit 1; } # At git home.
+
+ # Update the index
+ git update-index -q --ignore-submodules --refresh
+ err=0
+
+ # Disallow unstaged changes in the working tree
+ if ! git diff-files --quiet --ignore-submodules --
+ then
+ echo "$0, ERROR:"
+ echo >&2 "You have unstaged changes."
+ git diff-files --name-status -r --ignore-submodules -- >&2
+ err=1
+ fi
+
+ # Disallow uncommitted changes in the index
+ if ! git diff-index --cached --quiet HEAD --ignore-submodules --
+ then
+ echo "$0, ERROR:"
+ echo >&2 "Your index contains uncommitted changes."
+ git diff-index --cached --name-status -r --ignore-submodules HEAD -- >&2
+ err=1
+ fi
+
+ if [ $err = 1 ]
+ then
+ echo >&2 "Please commit or stash them."
+ exit 1
+ fi
+}
diff --git a/setup.py b/setup.py
index 5db3aed..4c2ab22 100644
--- a/setup.py
+++ b/setup.py
@@ -86,7 +86,6 @@ for section in requirement_sections:
with open('README.md', 'r', encoding='utf-8') as readme_file:
long_description = readme_file.read()
-version = ''
with open('pyignite/__init__.py', 'r') as fd:
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
fd.read(), re.MULTILINE).group(1)
@@ -111,6 +110,8 @@ def run_setup(with_binary=True):
author='The Apache Software Foundation',
author_email='dev@ignite.apache.org',
description='Apache Ignite binary client Python API',
+ long_description=long_description,
+ long_description_content_type='text/markdown',
url='https://github.com/apache/ignite-python-thin-client',
packages=setuptools.find_packages(),
install_requires=requirements['install'],
@@ -119,6 +120,7 @@ def run_setup(with_binary=True):
extras_require={
'docs': requirements['docs'],
},
+ license="Apache License 2.0",
classifiers=[
'Programming Language :: Python',
'Programming Language :: Python :: 3',