You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by pa...@apache.org on 2018/05/22 17:33:09 UTC
[beam] branch master updated: [BEAM-1755] Add a directory with
build-specific scripts to clear up the Python SDK dir (#5400)
This is an automated email from the ASF dual-hosted git repository.
pabloem pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push:
new bf35bd2 [BEAM-1755] Add a directory with build-specific scripts to clear up the Python SDK dir (#5400)
bf35bd2 is described below
commit bf35bd2cfad502e11941e7116a1be468504eeef3
Author: Pablo <pa...@users.noreply.github.com>
AuthorDate: Tue May 22 10:33:05 2018 -0700
[BEAM-1755] Add a directory with build-specific scripts to clear up the Python SDK dir (#5400)
* Moving Python Bash scripts to own directory
---
sdks/python/build.gradle | 4 ++--
sdks/python/{ => scripts}/generate_pydoc.sh | 11 +++++++++++
sdks/python/{ => scripts}/run_mini_py3lint.sh | 11 +++++++++++
sdks/python/{ => scripts}/run_postcommit.sh | 13 ++++++++++++-
sdks/python/{ => scripts}/run_pylint.sh | 11 +++++++++++
sdks/python/{ => scripts}/run_pylint_2to3.sh | 11 +++++++++++
sdks/python/{ => scripts}/run_tox_cleanup.sh | 11 +++++++++++
sdks/python/tox.ini | 22 +++++++++++-----------
8 files changed, 80 insertions(+), 14 deletions(-)
diff --git a/sdks/python/build.gradle b/sdks/python/build.gradle
index 0eea94d..ff7e6dd 100644
--- a/sdks/python/build.gradle
+++ b/sdks/python/build.gradle
@@ -201,7 +201,7 @@ task postCommitVRTests(dependsOn: 'installGcpTest') {
doLast {
exec {
executable 'sh'
- args '-c', ". ${envdir}/bin/activate && ./run_postcommit.sh IT"
+ args '-c', ". ${envdir}/bin/activate && ./scripts/run_postcommit.sh IT"
}
}
}
@@ -210,7 +210,7 @@ task validatesRunnerTests(dependsOn: 'installGcpTest') {
doLast {
exec {
executable 'sh'
- args '-c', ". ${envdir}/bin/activate && ./run_postcommit.sh ValidatesRunner"
+ args '-c', ". ${envdir}/bin/activate && ./scripts/run_postcommit.sh ValidatesRunner"
}
}
}
diff --git a/sdks/python/generate_pydoc.sh b/sdks/python/scripts/generate_pydoc.sh
similarity index 95%
rename from sdks/python/generate_pydoc.sh
rename to sdks/python/scripts/generate_pydoc.sh
index 68b7006..dfb87a1 100755
--- a/sdks/python/generate_pydoc.sh
+++ b/sdks/python/scripts/generate_pydoc.sh
@@ -22,6 +22,17 @@
#
# The exit-code of the script indicates success or a failure.
+# Check that the script is running in a known directory.
+if [[ $PWD != *sdks/python* ]]; then
+ echo 'Unable to locate Apache Beam Python SDK root directory'
+ exit 1
+fi
+
+# Go to the Apache Beam Python SDK root
+if [[ "*sdks/python" != $PWD ]]; then
+ cd $(pwd | sed 's/sdks\/python.*/sdks\/python/')
+fi
+
# Quit on any errors
set -e
diff --git a/sdks/python/run_mini_py3lint.sh b/sdks/python/scripts/run_mini_py3lint.sh
similarity index 82%
rename from sdks/python/run_mini_py3lint.sh
rename to sdks/python/scripts/run_mini_py3lint.sh
index 0fd9ef7..63e7177 100755
--- a/sdks/python/run_mini_py3lint.sh
+++ b/sdks/python/scripts/run_mini_py3lint.sh
@@ -22,6 +22,17 @@
#
# The exit-code of the script indicates success or a failure.
+# Check that the script is running in a known directory.
+if [[ $PWD != *sdks/python* ]]; then
+ echo 'Unable to locate Apache Beam Python SDK root directory'
+ exit 1
+fi
+
+# Go to the Apache Beam Python SDK root
+if [[ "*sdks/python" != $PWD ]]; then
+ cd $(pwd | sed 's/sdks\/python.*/sdks\/python/')
+fi
+
set -o errexit
set -o pipefail
diff --git a/sdks/python/run_postcommit.sh b/sdks/python/scripts/run_postcommit.sh
similarity index 85%
rename from sdks/python/run_postcommit.sh
rename to sdks/python/scripts/run_postcommit.sh
index afcdb3b..d6e31aa 100755
--- a/sdks/python/run_postcommit.sh
+++ b/sdks/python/scripts/run_postcommit.sh
@@ -23,8 +23,19 @@
# PROJECT -> Project name to use for service jobs.
#
+# Check that the script is running in a known directory.
+if [[ $PWD != *sdks/python* ]]; then
+ echo 'Unable to locate Apache Beam Python SDK root directory'
+ exit 1
+fi
+
+# Go to the Apache Beam Python SDK root
+if [[ "*sdks/python" != $PWD ]]; then
+ cd $(pwd | sed 's/sdks\/python.*/sdks\/python/')
+fi
+
if [ -z "$1" ]; then
- printf "Usage: \n$> ./run_postcommit.sh <test_type> [gcp_location] [gcp_project]"
+ printf "Usage: \n$> ./scripts/run_postcommit.sh <test_type> [gcp_location] [gcp_project]"
printf "\n\ttest_type: ValidatesRunner or IT"
printf "\n\tgcp_location: A gs:// path to stage artifacts and output results"
printf "\n\tgcp_project: A GCP project to run Dataflow pipelines\n"
diff --git a/sdks/python/run_pylint.sh b/sdks/python/scripts/run_pylint.sh
similarity index 92%
rename from sdks/python/run_pylint.sh
rename to sdks/python/scripts/run_pylint.sh
index 4e7dc9d..17f6aa7 100755
--- a/sdks/python/run_pylint.sh
+++ b/sdks/python/scripts/run_pylint.sh
@@ -23,6 +23,17 @@
#
# The exit-code of the script indicates success or a failure.
+# Check that the script is running in a known directory.
+if [[ $PWD != *sdks/python* ]]; then
+ echo 'Unable to locate Apache Beam Python SDK root directory'
+ exit 1
+fi
+
+# Go to the Apache Beam Python SDK root
+if [[ "*sdks/python" != $PWD ]]; then
+ cd $(pwd | sed 's/sdks\/python.*/sdks\/python/')
+fi
+
set -o errexit
set -o pipefail
diff --git a/sdks/python/run_pylint_2to3.sh b/sdks/python/scripts/run_pylint_2to3.sh
similarity index 91%
rename from sdks/python/run_pylint_2to3.sh
rename to sdks/python/scripts/run_pylint_2to3.sh
index 9a07436..56c8760 100755
--- a/sdks/python/run_pylint_2to3.sh
+++ b/sdks/python/scripts/run_pylint_2to3.sh
@@ -22,6 +22,17 @@
#
# The exit-code of the script indicates success or a failure.
+# Check that the script is running in a known directory.
+if [[ $PWD != *sdks/python* ]]; then
+ echo 'Unable to locate Apache Beam Python SDK root directory'
+ exit 1
+fi
+
+# Go to the Apache Beam Python SDK root
+if [[ "*sdks/python" != $PWD ]]; then
+ cd $(pwd | sed 's/sdks\/python.*/sdks\/python/')
+fi
+
set -o errexit
set -o pipefail
diff --git a/sdks/python/run_tox_cleanup.sh b/sdks/python/scripts/run_tox_cleanup.sh
similarity index 78%
rename from sdks/python/run_tox_cleanup.sh
rename to sdks/python/scripts/run_tox_cleanup.sh
index 76b683c..87081da 100755
--- a/sdks/python/run_tox_cleanup.sh
+++ b/sdks/python/scripts/run_tox_cleanup.sh
@@ -19,6 +19,17 @@
# This script is used to remove generated files in previous Tox runs so that
# they are not picked up by tests.
+# Check that the script is running in a known directory.
+if [[ $PWD != *sdks/python* ]]; then
+ echo 'Unable to locate Apache Beam Python SDK root directory'
+ exit 1
+fi
+
+# Go to the Apache Beam Python SDK root
+if [[ "*sdks/python" != $PWD ]]; then
+ cd $(pwd | sed 's/sdks\/python.*/sdks\/python/')
+fi
+
set -e
for dir in apache_beam target/build; do
diff --git a/sdks/python/tox.ini b/sdks/python/tox.ini
index 61dc12c..b40133e 100644
--- a/sdks/python/tox.ini
+++ b/sdks/python/tox.ini
@@ -48,10 +48,10 @@ list_dependencies_command = {envbindir}/python {envbindir}/pip freeze
commands =
python --version
pip --version
- {toxinidir}/run_tox_cleanup.sh
+ {toxinidir}/scripts/run_tox_cleanup.sh
python apache_beam/examples/complete/autocomplete_test.py
python setup.py nosetests
- {toxinidir}/run_tox_cleanup.sh
+ {toxinidir}/scripts/run_tox_cleanup.sh
[testenv:py27-cython]
# cython tests are only expected to work in linux (2.x and 3.x)
@@ -62,20 +62,20 @@ platform = linux2
commands =
python --version
pip --version
- {toxinidir}/run_tox_cleanup.sh
+ {toxinidir}/scripts/run_tox_cleanup.sh
python apache_beam/examples/complete/autocomplete_test.py
python setup.py nosetests
- {toxinidir}/run_tox_cleanup.sh
+ {toxinidir}/scripts/run_tox_cleanup.sh
[testenv:py27-gcp]
extras = test,gcp
commands =
python --version
pip --version
- {toxinidir}/run_tox_cleanup.sh
+ {toxinidir}/scripts/run_tox_cleanup.sh
python apache_beam/examples/complete/autocomplete_test.py
python setup.py nosetests
- {toxinidir}/run_tox_cleanup.sh
+ {toxinidir}/scripts/run_tox_cleanup.sh
[testenv:py27-lint]
deps =
@@ -87,7 +87,7 @@ deps =
commands =
python --version
pip --version
- time {toxinidir}/run_pylint.sh
+ time {toxinidir}/scripts/run_pylint.sh
[testenv:py27-lint3]
# Checks for py2/3 compatibility issues
@@ -103,7 +103,7 @@ modules =
commands =
python --version
pip --version
- time {toxinidir}/run_pylint_2to3.sh {[testenv:py27-lint3]modules}
+ time {toxinidir}/scripts/run_pylint_2to3.sh {[testenv:py27-lint3]modules}
[testenv:py3-lint]
@@ -118,7 +118,7 @@ setenv =
commands =
python --version
pip --version
- time {toxinidir}/run_mini_py3lint.sh
+ time {toxinidir}/scripts/run_mini_py3lint.sh
[testenv:docs]
extras = test,gcp,docs
@@ -128,7 +128,7 @@ deps =
commands =
python --version
pip --version
- time {toxinidir}/generate_pydoc.sh
+ time {toxinidir}/scripts/generate_pydoc.sh
[testenv:cover]
# This is not included in envlist which is defined in [tox].
@@ -137,7 +137,7 @@ deps =
commands =
python --version
pip --version
- {toxinidir}/run_tox_cleanup.sh
+ {toxinidir}/scripts/run_tox_cleanup.sh
# Clean up previously collected data.
coverage erase
coverage run setup.py test
--
To stop receiving notification emails like this one, please contact
pabloem@apache.org.