You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by jf...@apache.org on 2013/03/26 04:50:37 UTC

git commit: Thrift-1806: Python generation always truncates __init__.py files Client: Python Patch: Nathaniel Cook

Updated Branches:
  refs/heads/master 2ff542859 -> 2d26f18a1


Thrift-1806: Python generation always truncates __init__.py files
Client: Python
Patch: Nathaniel Cook

When generating python code the generator correctly creates _init.py file for each directory. If the __init_.py file has contents it is always overwritten. This usually isn't a problem unless using the -out flag, then there is a potential to erase non generated code.


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/2d26f18a
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/2d26f18a
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/2d26f18a

Branch: refs/heads/master
Commit: 2d26f18a12d20e2bc5063a34ff347558fa91517f
Parents: 2ff5428
Author: Jake Farrell <jf...@apache.org>
Authored: Mon Mar 25 23:49:37 2013 -0400
Committer: Jake Farrell <jf...@apache.org>
Committed: Mon Mar 25 23:49:37 2013 -0400

----------------------------------------------------------------------
 compiler/cpp/src/generate/t_py_generator.cc |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/2d26f18a/compiler/cpp/src/generate/t_py_generator.cc
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/generate/t_py_generator.cc b/compiler/cpp/src/generate/t_py_generator.cc
index fd954c5..4a540f2 100644
--- a/compiler/cpp/src/generate/t_py_generator.cc
+++ b/compiler/cpp/src/generate/t_py_generator.cc
@@ -337,7 +337,7 @@ void t_py_generator::init_generator() {
   while (true) {
     // TODO: Do better error checking here.
     MKDIR(package_dir_.c_str());
-    std::ofstream init_py((package_dir_+"/__init__.py").c_str());
+    std::ofstream init_py((package_dir_+"/__init__.py").c_str(), std::ios_base::app);
     init_py.close();
     if (module.empty()) {
       break;