@@ -40,29 +40,24 @@ pushd "${CLIENT_ROOT}" > /dev/null
40
40
CLIENT_ROOT=` pwd`
41
41
popd > /dev/null
42
42
43
- echo " --- Downloading and processing OpenAPI spec "
44
- python " ${SCRIPT_ROOT} /preprocess_spec.py "
43
+ TEMP_FOLDER= $( mktemp -d )
44
+ trap " rm -rf ${TEMP_FOLDER} " EXIT SIGINT
45
45
46
- echo " --- Cleaning up previously generated folders "
47
- rm -rf " ${CLIENT_ROOT} /client/apis "
48
- rm -rf " ${CLIENT_ROOT} /client/models "
49
- rm -rf " ${CLIENT_ROOT} /docs "
50
- rm -rf " ${CLIENT_ROOT} /test "
46
+ GEN_ROOT= " ${TEMP_FOLDER} /gen "
47
+ SETTING_FILE= " ${TEMP_FOLDER} /settings "
48
+ echo " export KUBERNETES_BRANCH= \" $( python ${SCRIPT_ROOT} /constants.py KUBERNETES_BRANCH ) \" " > $SETTING_FILE
49
+ echo " export CLIENT_VERSION= \" $( python ${SCRIPT_ROOT} /constants.py CLIENT_VERSION ) \" " >> $SETTING_FILE
50
+ echo " export PACKAGE_NAME= \" client \" " >> $SETTING_FILE
51
51
52
- echo " --- Generating client ... "
53
- 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}
52
+ echo " >>> Cloning gen repo "
53
+ git clone --recursive https://github.com/kubernetes-client/gen.git " ${GEN_ROOT} "
54
54
55
- echo " --- Patching generated code..."
56
- find " ${CLIENT_ROOT} /test" -type f -name \* .py -exec sed -i ' s/\bclient/kubernetes.client/g' {} +
57
- find " ${CLIENT_ROOT} " -path " ${CLIENT_ROOT} /base" -prune -o -type f -a -name \* .md -exec sed -i ' s/\bclient/kubernetes.client/g' {} +
58
- find " ${CLIENT_ROOT} " -path " ${CLIENT_ROOT} /base" -prune -o -type f -a -name \* .md -exec sed -i ' s/kubernetes.client-python/client-python/g' {} +
59
- # rm "${CLIENT_ROOT}/LICENSE"
60
- echo " --- updating version information..."
55
+ echo " >>> Running python generator from the gen repo"
56
+ " ${GEN_ROOT} /openapi/python.sh" " ${CLIENT_ROOT} " " ${SETTING_FILE} "
57
+ mv " ${CLIENT_ROOT} /swagger.json" " ${SCRIPT_ROOT} /swagger.json"
58
+
59
+ echo " >>> updating version information..."
61
60
sed -i' ' " s/^CLIENT_VERSION = .*/CLIENT_VERSION = \\\" ${CLIENT_VERSION} \\\" /" " ${SCRIPT_ROOT} /../setup.py"
62
61
sed -i' ' " s/^PACKAGE_NAME = .*/PACKAGE_NAME = \\\" ${PACKAGE_NAME} \\\" /" " ${SCRIPT_ROOT} /../setup.py"
63
62
sed -i' ' " s,^DEVELOPMENT_STATUS = .*,DEVELOPMENT_STATUS = \\\" ${DEVELOPMENT_STATUS} \\\" ," " ${SCRIPT_ROOT} /../setup.py"
64
- sed -i' ' " /^configuration = Configuration()$/d" " ${CLIENT_ROOT} /client/__init__.py"
65
- sed -i' ' " /^from .configuration import Configuration$/d" " ${CLIENT_ROOT} /client/__init__.py"
66
- sed -i ' ${/^$/d;}' " ${CLIENT_ROOT} /client/__init__.py"
67
- echo " from .configuration import Configuration, ConfigurationObject, configuration" >> " ${CLIENT_ROOT} /client/__init__.py"
68
- echo " ---Done."
63
+ echo " >>> Done."
0 commit comments