diff --git a/scripts/__init__.py b/scripts/__init__.py deleted file mode 100644 index 3fd54b0c5..000000000 --- a/scripts/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright 2016 The Kubernetes Authors. -# -# Licensed 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. - -# Intentional empty init file to make this folder a python package diff --git a/scripts/update-client.sh b/scripts/update-client.sh index c92c9bb0d..0ee66be55 100755 --- a/scripts/update-client.sh +++ b/scripts/update-client.sh @@ -28,6 +28,8 @@ fi SCRIPT_ROOT=$(dirname "${BASH_SOURCE}") CLIENT_ROOT="${SCRIPT_ROOT}/../kubernetes" +CLIENT_VERSION=$(python "${SCRIPT_ROOT}/constants.py" CLIENT_VERSION) +PACKAGE_NAME=$(python "${SCRIPT_ROOT}/constants.py" PACKAGE_NAME) pushd "${SCRIPT_ROOT}" > /dev/null SCRIPT_ROOT=`pwd` @@ -37,24 +39,24 @@ pushd "${CLIENT_ROOT}" > /dev/null CLIENT_ROOT=`pwd` popd > /dev/null -PACKAGE_NAME=${PACKAGE_NAME:-client} - echo "--- Downloading and processing OpenAPI spec" python "${SCRIPT_ROOT}/preprocess_spec.py" echo "--- Cleaning up previously generated folders" -rm -rf "${CLIENT_ROOT}/${PACKAGE_NAME}/apis" -rm -rf "${CLIENT_ROOT}/${PACKAGE_NAME}/models" +rm -rf "${CLIENT_ROOT}/client/apis" +rm -rf "${CLIENT_ROOT}/client/models" rm -rf "${CLIENT_ROOT}/docs" rm -rf "${CLIENT_ROOT}/test" echo "--- Generating client ..." -mvn -f "${SCRIPT_ROOT}/pom.xml" clean generate-sources -Dgenerator.spec.path="${SCRIPT_ROOT}/swagger.json" -Dgenerator.output.path="${CLIENT_ROOT}" -Dgenerator.package.name=${PACKAGE_NAME} -D=generator.client.version=$(python "${SCRIPT_ROOT}/constants.py" CLIENT_VERSION) +mvn -f "${SCRIPT_ROOT}/pom.xml" clean generate-sources -Dgenerator.spec.path="${SCRIPT_ROOT}/swagger.json" -Dgenerator.output.path="${CLIENT_ROOT}" -Dgenerator.package.name=client -D=generator.client.version=${CLIENT_VERSION} echo "--- Patching generated code..." find "${CLIENT_ROOT}/test" -type f -name \*.py -exec sed -i 's/\bclient/kubernetes.client/g' {} + find "${CLIENT_ROOT}/" -type f -name \*.md -exec sed -i 's/\bclient/kubernetes.client/g' {} + find "${CLIENT_ROOT}/" -type f -name \*.md -exec sed -i 's/kubernetes.client-python/client-python/g' {} + rm "${CLIENT_ROOT}/LICENSE" +echo "--- updating version information..." +sed -i'' "s/^CLIENT_VERSION = .*/CLIENT_VERSION = \\\"${CLIENT_VERSION}\\\"/" "${SCRIPT_ROOT}/../setup.py" +sed -i'' "s/^PACKAGE_NAME = .*/PACKAGE_NAME = \\\"${PACKAGE_NAME}\\\"/" "${SCRIPT_ROOT}/../setup.py" echo "---Done." - diff --git a/setup.py b/setup.py index dae17915f..17640181f 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,10 @@ from setuptools import find_packages, setup -from scripts.constants import CLIENT_VERSION, PACKAGE_NAME +# Do not edit these constants. They will be updated automatically +# by scripts/update-client.sh. +CLIENT_VERSION = "1.0.0-snapshot" +PACKAGE_NAME = "kubernetes" # To install the library, run the following # @@ -44,7 +47,7 @@ setup( install_requires=REQUIRES, packages=['kubernetes', 'kubernetes.client', 'kubernetes.config', 'kubernetes.watch', 'kubernetes.client.apis', - 'kubernetes.client.models', 'scripts'], + 'kubernetes.client.models'], include_package_data=True, long_description="""\ Python client for kubernetes http://kubernetes.io/