You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Mike Heffner (JIRA)" <ji...@apache.org> on 2009/05/21 21:24:45 UTC
[jira] Created: (THRIFT-514) Add option to configure compiler
output directory
Add option to configure compiler output directory
-------------------------------------------------
Key: THRIFT-514
URL: https://issues.apache.org/jira/browse/THRIFT-514
Project: Thrift
Issue Type: New Feature
Components: Compiler (General)
Environment: Thrift SVN revision 752489 from trunk.
Reporter: Mike Heffner
Priority: Minor
I would like to change the output directory the compiler uses. For example, compiling to Python uses "gen-py" as the output directory and there is currently no option to change that. Suggest adding an option to specify the output directory. This can alleviate some issues when integrating auto-generation into Makefile build infrastructures.
Suggestions from Michael Greene on thrift-dev@:
Mike, If you're feeling adventurous, you can change it in your own
copy--each of the generators supplies its own output directory name.
For example, see the assignment out_dir_base_ = "gen-py"; in the
constructor of
http://svn.apache.org/repos/asf/incubator/thrift/trunk/compiler/cpp/src/generate/t_py_generator.cc
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (THRIFT-514) Add option to configure compiler
output directory
Posted by "Mike Heffner (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-514?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12722078#action_12722078 ]
Mike Heffner commented on THRIFT-514:
-------------------------------------
So is that good or bad from your perspective? My familiarity with Thrift is minimal, so it seemed like the best way to associate a directory with a generator.
> Add option to configure compiler output directory
> -------------------------------------------------
>
> Key: THRIFT-514
> URL: https://issues.apache.org/jira/browse/THRIFT-514
> Project: Thrift
> Issue Type: New Feature
> Components: Compiler (General)
> Environment: Thrift SVN revision 752489 from trunk.
> Reporter: Mike Heffner
> Priority: Minor
> Attachments: thrift_514_gendir.diff
>
>
> I would like to change the output directory the compiler uses. For example, compiling to Python uses "gen-py" as the output directory and there is currently no option to change that. Suggest adding an option to specify the output directory. This can alleviate some issues when integrating auto-generation into Makefile build infrastructures.
> Suggestions from Michael Greene on thrift-dev@:
> Mike, If you're feeling adventurous, you can change it in your own
> copy--each of the generators supplies its own output directory name.
> For example, see the assignment out_dir_base_ = "gen-py"; in the
> constructor of
> http://svn.apache.org/repos/asf/incubator/thrift/trunk/compiler/cpp/src/generate/t_py_generator.cc
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (THRIFT-514) Add option to configure compiler
output directory
Posted by "David Reiss (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-514?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12725691#action_12725691 ]
David Reiss commented on THRIFT-514:
------------------------------------
Regarding the noclobber patch, why not just open it in append mode? It will probably update the last modified time, but does that matter?
> Add option to configure compiler output directory
> -------------------------------------------------
>
> Key: THRIFT-514
> URL: https://issues.apache.org/jira/browse/THRIFT-514
> Project: Thrift
> Issue Type: New Feature
> Components: Compiler (General)
> Environment: Thrift SVN revision 752489 from trunk.
> Reporter: Mike Heffner
> Priority: Minor
> Attachments: thrift_514_gendir.diff, thrift_514_noclobber_init.diff
>
>
> I would like to change the output directory the compiler uses. For example, compiling to Python uses "gen-py" as the output directory and there is currently no option to change that. Suggest adding an option to specify the output directory. This can alleviate some issues when integrating auto-generation into Makefile build infrastructures.
> Suggestions from Michael Greene on thrift-dev@:
> Mike, If you're feeling adventurous, you can change it in your own
> copy--each of the generators supplies its own output directory name.
> For example, see the assignment out_dir_base_ = "gen-py"; in the
> constructor of
> http://svn.apache.org/repos/asf/incubator/thrift/trunk/compiler/cpp/src/generate/t_py_generator.cc
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (THRIFT-514) Add option to configure compiler
output directory
Posted by "Michael Greene (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-514?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12711816#action_12711816 ]
Michael Greene commented on THRIFT-514:
---------------------------------------
I think it'd have to be, right? Wouldn't you have to configure it per generator? For those using multiple generators, what layouts do they want to be possible?
> Add option to configure compiler output directory
> -------------------------------------------------
>
> Key: THRIFT-514
> URL: https://issues.apache.org/jira/browse/THRIFT-514
> Project: Thrift
> Issue Type: New Feature
> Components: Compiler (General)
> Environment: Thrift SVN revision 752489 from trunk.
> Reporter: Mike Heffner
> Priority: Minor
>
> I would like to change the output directory the compiler uses. For example, compiling to Python uses "gen-py" as the output directory and there is currently no option to change that. Suggest adding an option to specify the output directory. This can alleviate some issues when integrating auto-generation into Makefile build infrastructures.
> Suggestions from Michael Greene on thrift-dev@:
> Mike, If you're feeling adventurous, you can change it in your own
> copy--each of the generators supplies its own output directory name.
> For example, see the assignment out_dir_base_ = "gen-py"; in the
> constructor of
> http://svn.apache.org/repos/asf/incubator/thrift/trunk/compiler/cpp/src/generate/t_py_generator.cc
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (THRIFT-514) Add option to configure compiler
output directory
Posted by "Mike Heffner (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-514?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12725740#action_12725740 ]
Mike Heffner commented on THRIFT-514:
-------------------------------------
Well, if you use the default "gen-py" directory it isn't really necessary because you must use sys.path.append() to work around the hyphen in the name. However, if you were to use the gendir option and specify a directory "foo", then for the statement "import foo.namespace.ttypes" to work you would need that top-level __init__.py file created at "foo/__init__.py".
> Add option to configure compiler output directory
> -------------------------------------------------
>
> Key: THRIFT-514
> URL: https://issues.apache.org/jira/browse/THRIFT-514
> Project: Thrift
> Issue Type: New Feature
> Components: Compiler (General)
> Environment: Thrift SVN revision 752489 from trunk.
> Reporter: Mike Heffner
> Priority: Minor
> Attachments: thrift_514_gendir.diff, thrift_514_noclobber_init.diff
>
>
> I would like to change the output directory the compiler uses. For example, compiling to Python uses "gen-py" as the output directory and there is currently no option to change that. Suggest adding an option to specify the output directory. This can alleviate some issues when integrating auto-generation into Makefile build infrastructures.
> Suggestions from Michael Greene on thrift-dev@:
> Mike, If you're feeling adventurous, you can change it in your own
> copy--each of the generators supplies its own output directory name.
> For example, see the assignment out_dir_base_ = "gen-py"; in the
> constructor of
> http://svn.apache.org/repos/asf/incubator/thrift/trunk/compiler/cpp/src/generate/t_py_generator.cc
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (THRIFT-514) Add option to configure compiler
output directory
Posted by "David Reiss (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-514?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12725721#action_12725721 ]
David Reiss commented on THRIFT-514:
------------------------------------
Actually, this is (the file that is normally) gen-py/__init__.py, right? You can just not create that one. I'm pretty sure it is never necessary. I just added it because it was easier to include than exclude.
> Add option to configure compiler output directory
> -------------------------------------------------
>
> Key: THRIFT-514
> URL: https://issues.apache.org/jira/browse/THRIFT-514
> Project: Thrift
> Issue Type: New Feature
> Components: Compiler (General)
> Environment: Thrift SVN revision 752489 from trunk.
> Reporter: Mike Heffner
> Priority: Minor
> Attachments: thrift_514_gendir.diff, thrift_514_noclobber_init.diff
>
>
> I would like to change the output directory the compiler uses. For example, compiling to Python uses "gen-py" as the output directory and there is currently no option to change that. Suggest adding an option to specify the output directory. This can alleviate some issues when integrating auto-generation into Makefile build infrastructures.
> Suggestions from Michael Greene on thrift-dev@:
> Mike, If you're feeling adventurous, you can change it in your own
> copy--each of the generators supplies its own output directory name.
> For example, see the assignment out_dir_base_ = "gen-py"; in the
> constructor of
> http://svn.apache.org/repos/asf/incubator/thrift/trunk/compiler/cpp/src/generate/t_py_generator.cc
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (THRIFT-514) Add option to configure compiler
output directory
Posted by "David Reiss (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-514?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12722084#action_12722084 ]
David Reiss commented on THRIFT-514:
------------------------------------
It seems like a fine way to specify it to me, though I think it would make more sense to get opinions from the people who plan to use this feature.
> Add option to configure compiler output directory
> -------------------------------------------------
>
> Key: THRIFT-514
> URL: https://issues.apache.org/jira/browse/THRIFT-514
> Project: Thrift
> Issue Type: New Feature
> Components: Compiler (General)
> Environment: Thrift SVN revision 752489 from trunk.
> Reporter: Mike Heffner
> Priority: Minor
> Attachments: thrift_514_gendir.diff
>
>
> I would like to change the output directory the compiler uses. For example, compiling to Python uses "gen-py" as the output directory and there is currently no option to change that. Suggest adding an option to specify the output directory. This can alleviate some issues when integrating auto-generation into Makefile build infrastructures.
> Suggestions from Michael Greene on thrift-dev@:
> Mike, If you're feeling adventurous, you can change it in your own
> copy--each of the generators supplies its own output directory name.
> For example, see the assignment out_dir_base_ = "gen-py"; in the
> constructor of
> http://svn.apache.org/repos/asf/incubator/thrift/trunk/compiler/cpp/src/generate/t_py_generator.cc
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (THRIFT-514) Add option to configure compiler
output directory
Posted by "Mike Heffner (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-514?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12725712#action_12725712 ]
Mike Heffner commented on THRIFT-514:
-------------------------------------
Append mode would be fine, O_EXCL was just a bit more pedantic. The update is unlikely to cause an issue, at most it may cause a dependency to recompile the pyc. Most SCM's should ignore it.
> Add option to configure compiler output directory
> -------------------------------------------------
>
> Key: THRIFT-514
> URL: https://issues.apache.org/jira/browse/THRIFT-514
> Project: Thrift
> Issue Type: New Feature
> Components: Compiler (General)
> Environment: Thrift SVN revision 752489 from trunk.
> Reporter: Mike Heffner
> Priority: Minor
> Attachments: thrift_514_gendir.diff, thrift_514_noclobber_init.diff
>
>
> I would like to change the output directory the compiler uses. For example, compiling to Python uses "gen-py" as the output directory and there is currently no option to change that. Suggest adding an option to specify the output directory. This can alleviate some issues when integrating auto-generation into Makefile build infrastructures.
> Suggestions from Michael Greene on thrift-dev@:
> Mike, If you're feeling adventurous, you can change it in your own
> copy--each of the generators supplies its own output directory name.
> For example, see the assignment out_dir_base_ = "gen-py"; in the
> constructor of
> http://svn.apache.org/repos/asf/incubator/thrift/trunk/compiler/cpp/src/generate/t_py_generator.cc
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (THRIFT-514) Add option to configure compiler
output directory
Posted by "Mike Heffner (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-514?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mike Heffner updated THRIFT-514:
--------------------------------
Attachment: thrift_514_gendir.diff
The attached diff adds the ability to specify a "gendir" option with each generator. For example, for Ruby:
--gen rb:gendir=foobar
will use the Ruby generator and dump to the directory "foobar" (located under the -o <dir> if specified).
The directory can be specified per-generator allowing a different directory to be specified for each. If you specify the directory as ".", it will dump to CWD or the -o directory.
The patch also pushes the directory setting code to the t_generator class.
It will error if the gendir contains a "/". Not sure if that is useful for not.
Documentation has not been updated yet, will do if others find this approach useful.
> Add option to configure compiler output directory
> -------------------------------------------------
>
> Key: THRIFT-514
> URL: https://issues.apache.org/jira/browse/THRIFT-514
> Project: Thrift
> Issue Type: New Feature
> Components: Compiler (General)
> Environment: Thrift SVN revision 752489 from trunk.
> Reporter: Mike Heffner
> Priority: Minor
> Attachments: thrift_514_gendir.diff
>
>
> I would like to change the output directory the compiler uses. For example, compiling to Python uses "gen-py" as the output directory and there is currently no option to change that. Suggest adding an option to specify the output directory. This can alleviate some issues when integrating auto-generation into Makefile build infrastructures.
> Suggestions from Michael Greene on thrift-dev@:
> Mike, If you're feeling adventurous, you can change it in your own
> copy--each of the generators supplies its own output directory name.
> For example, see the assignment out_dir_base_ = "gen-py"; in the
> constructor of
> http://svn.apache.org/repos/asf/incubator/thrift/trunk/compiler/cpp/src/generate/t_py_generator.cc
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (THRIFT-514) Add option to configure compiler
output directory
Posted by "David Reiss (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-514?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12711812#action_12711812 ]
David Reiss commented on THRIFT-514:
------------------------------------
I'd prefer for this to be separate from "-o" if at all possible. Is "-O" to silly?
> Add option to configure compiler output directory
> -------------------------------------------------
>
> Key: THRIFT-514
> URL: https://issues.apache.org/jira/browse/THRIFT-514
> Project: Thrift
> Issue Type: New Feature
> Components: Compiler (General)
> Environment: Thrift SVN revision 752489 from trunk.
> Reporter: Mike Heffner
> Priority: Minor
>
> I would like to change the output directory the compiler uses. For example, compiling to Python uses "gen-py" as the output directory and there is currently no option to change that. Suggest adding an option to specify the output directory. This can alleviate some issues when integrating auto-generation into Makefile build infrastructures.
> Suggestions from Michael Greene on thrift-dev@:
> Mike, If you're feeling adventurous, you can change it in your own
> copy--each of the generators supplies its own output directory name.
> For example, see the assignment out_dir_base_ = "gen-py"; in the
> constructor of
> http://svn.apache.org/repos/asf/incubator/thrift/trunk/compiler/cpp/src/generate/t_py_generator.cc
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (THRIFT-514) Add option to configure compiler
output directory
Posted by "Mike Heffner (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-514?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mike Heffner updated THRIFT-514:
--------------------------------
Attachment: thrift_514_noclobber_init.diff
This patch prevents clobbering an existing top-level "__init__.py" file when the Python generator is executed. The generator would normally create this file as an empty placeholder, so assuming the existing __init__.py is valid, there shouldn't be anything lost by relying on the existing file.
This is especially useful when using the 'gendir' option set to a shared directory with an existing __init__.py file.
> Add option to configure compiler output directory
> -------------------------------------------------
>
> Key: THRIFT-514
> URL: https://issues.apache.org/jira/browse/THRIFT-514
> Project: Thrift
> Issue Type: New Feature
> Components: Compiler (General)
> Environment: Thrift SVN revision 752489 from trunk.
> Reporter: Mike Heffner
> Priority: Minor
> Attachments: thrift_514_gendir.diff, thrift_514_noclobber_init.diff
>
>
> I would like to change the output directory the compiler uses. For example, compiling to Python uses "gen-py" as the output directory and there is currently no option to change that. Suggest adding an option to specify the output directory. This can alleviate some issues when integrating auto-generation into Makefile build infrastructures.
> Suggestions from Michael Greene on thrift-dev@:
> Mike, If you're feeling adventurous, you can change it in your own
> copy--each of the generators supplies its own output directory name.
> For example, see the assignment out_dir_base_ = "gen-py"; in the
> constructor of
> http://svn.apache.org/repos/asf/incubator/thrift/trunk/compiler/cpp/src/generate/t_py_generator.cc
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (THRIFT-514) Add option to configure compiler
output directory
Posted by "David Reiss (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-514?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12720994#action_12720994 ]
David Reiss commented on THRIFT-514:
------------------------------------
Congratulations on being the first person to use a non-boolean generator flag.
> Add option to configure compiler output directory
> -------------------------------------------------
>
> Key: THRIFT-514
> URL: https://issues.apache.org/jira/browse/THRIFT-514
> Project: Thrift
> Issue Type: New Feature
> Components: Compiler (General)
> Environment: Thrift SVN revision 752489 from trunk.
> Reporter: Mike Heffner
> Priority: Minor
> Attachments: thrift_514_gendir.diff
>
>
> I would like to change the output directory the compiler uses. For example, compiling to Python uses "gen-py" as the output directory and there is currently no option to change that. Suggest adding an option to specify the output directory. This can alleviate some issues when integrating auto-generation into Makefile build infrastructures.
> Suggestions from Michael Greene on thrift-dev@:
> Mike, If you're feeling adventurous, you can change it in your own
> copy--each of the generators supplies its own output directory name.
> For example, see the assignment out_dir_base_ = "gen-py"; in the
> constructor of
> http://svn.apache.org/repos/asf/incubator/thrift/trunk/compiler/cpp/src/generate/t_py_generator.cc
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (THRIFT-514) Add option to configure compiler
output directory
Posted by "Todd Lipcon (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-514?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12711776#action_12711776 ]
Todd Lipcon commented on THRIFT-514:
------------------------------------
+1 - I very often end up moving the generated code elsewhere as part of a build process
> Add option to configure compiler output directory
> -------------------------------------------------
>
> Key: THRIFT-514
> URL: https://issues.apache.org/jira/browse/THRIFT-514
> Project: Thrift
> Issue Type: New Feature
> Components: Compiler (General)
> Environment: Thrift SVN revision 752489 from trunk.
> Reporter: Mike Heffner
> Priority: Minor
>
> I would like to change the output directory the compiler uses. For example, compiling to Python uses "gen-py" as the output directory and there is currently no option to change that. Suggest adding an option to specify the output directory. This can alleviate some issues when integrating auto-generation into Makefile build infrastructures.
> Suggestions from Michael Greene on thrift-dev@:
> Mike, If you're feeling adventurous, you can change it in your own
> copy--each of the generators supplies its own output directory name.
> For example, see the assignment out_dir_base_ = "gen-py"; in the
> constructor of
> http://svn.apache.org/repos/asf/incubator/thrift/trunk/compiler/cpp/src/generate/t_py_generator.cc
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (THRIFT-514) Add option to configure compiler
output directory
Posted by "Mike Heffner (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-514?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12711846#action_12711846 ]
Mike Heffner commented on THRIFT-514:
-------------------------------------
In addition, I think it would be useful to have an option to tell it to NOT create a generator folder. For example for the thrift file:
{{{
namespace py foobar
service FooBarService {
...
}
}}}
It currently will output as:
{{{
gen-py/
gen-py/__init__.py
gen-py/foobar/...
}}}
It would be nice if you could just get:
{{{
foobar/
foobar/__init__.py
foobar/...
}}}
Granted, that could only work well for a single generator.
> Add option to configure compiler output directory
> -------------------------------------------------
>
> Key: THRIFT-514
> URL: https://issues.apache.org/jira/browse/THRIFT-514
> Project: Thrift
> Issue Type: New Feature
> Components: Compiler (General)
> Environment: Thrift SVN revision 752489 from trunk.
> Reporter: Mike Heffner
> Priority: Minor
>
> I would like to change the output directory the compiler uses. For example, compiling to Python uses "gen-py" as the output directory and there is currently no option to change that. Suggest adding an option to specify the output directory. This can alleviate some issues when integrating auto-generation into Makefile build infrastructures.
> Suggestions from Michael Greene on thrift-dev@:
> Mike, If you're feeling adventurous, you can change it in your own
> copy--each of the generators supplies its own output directory name.
> For example, see the assignment out_dir_base_ = "gen-py"; in the
> constructor of
> http://svn.apache.org/repos/asf/incubator/thrift/trunk/compiler/cpp/src/generate/t_py_generator.cc
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.