zhongjiajie commented on a change in pull request #19155:
URL: https://github.com/apache/airflow/pull/19155#discussion_r734494286



##########
File path: clients/gen/python.sh
##########
@@ -43,16 +44,22 @@ echo "--- Patching generated code..."
 
 # Post-processing of the generated Python wrapper.
 
+INPLACE_ARG="-i"
+if [[ "$OSTYPE" == "darwin"* ]]; then
+    INPLACE_ARG="-i ''"
+fi
+
 touch "${OUTPUT_DIR}/__init__.py"
-find "${OUTPUT_DIR}/test" -type f -name \*.py -exec sed -i '' -e 
's/client/airflow_client.client/g' {} +
-find "${OUTPUT_DIR}" -type f -a -name \*.md -exec sed -i '' -e 's/# client/# 
Apache Airflow Python Client/g' {} +
-find "${OUTPUT_DIR}" -type f -a -name \*.md -exec sed -i '' -e 's/import 
client/import airflow_client.client/g' {} +
-find "${OUTPUT_DIR}" -type f -a -name \*.md -exec sed -i '' -e 's/from 
client/from airflow_client.client/g' {} +
-find "${OUTPUT_DIR}" -type f -a -name \*.md -exec sed -i '' -e 
's/getattr(client\.models/getattr(airflow_client.client.models/g' {} +
+find "${OUTPUT_DIR}/test" -type f -name \*.py -exec sed $INPLACE_ARG -e 
's/client/airflow_client.client/g' {} +
+find "${OUTPUT_DIR}" -type f -a -name \*.md -exec sed $INPLACE_ARG -e 's/# 
client/# Apache Airflow Python Client/g' {} +
+find "${OUTPUT_DIR}" -type f -a -name \*.md -exec sed $INPLACE_ARG -e 
's/import client/import airflow_client.client/g' {} +
+find "${OUTPUT_DIR}" -type f -a -name \*.md -exec sed $INPLACE_ARG -e 's/from 
client/from airflow_client.client/g' {} +
+find "${OUTPUT_DIR}" -type f -a -name \*.md -exec sed $INPLACE_ARG -e 
's/getattr(client\.models/getattr(airflow_client.client.models/g' {} +
 
 # fix imports
-find "${OUTPUT_DIR}/client/" -type f -name \*.py -exec sed -i '' -e 's/import 
client\./import airflow_client.client./g' {} +
-find "${OUTPUT_DIR}/client/" -type f -name \*.py -exec sed -i '' -e 's/from 
client/from airflow_client.client/g' {} +
-find "${OUTPUT_DIR}/client/" -type f -name \*.py -exec sed -i '' -e 
's/getattr(client\.models/getattr(airflow_client.client.models/g' {} +
+find "${OUTPUT_DIR}/client/" -type f -name \*.py -exec sed $INPLACE_ARG -e 
's/import client\./import airflow_client.client./g' {} +
+find "${OUTPUT_DIR}/client/" -type f -name \*.py -exec sed $INPLACE_ARG -e 
's/from client/from airflow_client.client/g' {} +
+find "${OUTPUT_DIR}/client/" -type f -name \*.py -exec sed $INPLACE_ARG -e 
's/getattr(client\.models/getattr(airflow_client.client.models/g' {} +
 
 run_pre_commit
+echo "Generation successful"

Review comment:
       Please add newline in the end.

##########
File path: clients/gen/python.sh
##########
@@ -43,16 +44,22 @@ echo "--- Patching generated code..."
 
 # Post-processing of the generated Python wrapper.
 
+INPLACE_ARG="-i"

Review comment:
       Good catch!




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to