flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [flink] dianfu commented on a change in pull request #9855: [FLINK-14306][python] Add the code-generated flink_fn_execution_pb2.py to the codebase
Date Wed, 09 Oct 2019 11:27:43 GMT
dianfu commented on a change in pull request #9855: [FLINK-14306][python] Add the code-generated
flink_fn_execution_pb2.py to the codebase
URL: https://github.com/apache/flink/pull/9855#discussion_r332961009
 
 

 ##########
 File path: flink-python/pyflink/gen_protos.py
 ##########
 @@ -137,10 +137,51 @@ def _install_grpcio_tools_and_generate_proto_files():
     if install_obj.install_purelib != install_obj.install_platlib:
         sys.path.append(install_obj.install_platlib)
     try:
-        generate_proto_files()
+        generate_proto_files(force, output_dir)
     finally:
         sys.stderr.flush()
 
 
+def _add_license_header(dir, file_name):
+    with open(os.path.join(dir, file_name), 'r') as original_file:
+        original_data = original_file.read()
+        tmp_file_name = file_name + '.tmp'
+        with open(os.path.join(dir, tmp_file_name), 'w') as tmp_file:
+            tmp_file.write(
+                '################################################################################\n'
+                '#  Licensed to the Apache Software Foundation (ASF) under one\n'
+                '#  or more contributor license agreements.  See the NOTICE file\n'
+                '#  distributed with this work for additional information\n'
+                '#  regarding copyright ownership.  The ASF licenses this file\n'
+                '#  to you under the Apache License, Version 2.0 (the\n'
+                '#  "License"); you may not use this file except in compliance\n'
+                '#  with the License.  You may obtain a copy of the License at\n'
+                '#\n'
+                '#      http://www.apache.org/licenses/LICENSE-2.0\n'
+                '#\n'
+                '#  Unless required by applicable law or agreed to in writing, software\n'
+                '#  distributed under the License is distributed on an "AS IS" BASIS,\n'
+                '#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n'
+                '#  See the License for the specific language governing permissions and\n'
+                '# limitations under the License.\n'
+                '################################################################################\n'
+            )
+            tmp_file.write(original_data)
+            os.rename(os.path.join(dir, tmp_file_name), os.path.join(dir, file_name))
+
+
+def _check_grpcio_tools_version():
 
 Review comment:
   There are two reasons blocking us to do that:
   1. Modules dynamically added to "sys.path" is not possible to get via `pkg_resources.get_distribution`
   2. If `grpcio-tools` is not present in the Python environment and is installed via this
script, we can make sure that the version is correct.
   
   Does that make sense?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message