Patch advice

4 views
Skip to first unread message

Eli Collins

unread,
Jun 6, 2011, 3:55:22 PM6/6/11
to the-fellowship-...@googlegroups.com
Hello all -

I'm currently trying to write a patch to implement an enhancement to disutils2 (I created an issue for it here -http://bugs.python.org/issue12242); and I'm currently stymied by my lack of knowledge about distutils2's architecture. I didn't want to clutter the issue tracker with questions, and this seemed the most appropriate place to ask. (If there's another venue where I should post this, my apologies in advance). 

To summarize the linked issue, I'm trying to add a environment marker that reflects the name of the current compiler (eg "mingw", "msvc", etc), allowing for compiler-specific options in setup.cfg extension declarations. 

The simplest approach I could puzzle out was to:
  1. modify distutils2/config.py so that _pop_values() accepted and passed through an execution_context dict to interpret()
  2. then modify Config._read_setup_cfg() to set the name of the compiler in a dictionary right above "ext_modules = self.dist.ext_modules"
  3. and pass the dict to all the following _pop_values() calls used to build the extension object. 
I got stumped at that point, because it looks like the information I need is the value of "build_ext.compiler", and command instances aren't created until much later (assuming the command is even invoked at all). 

The next thought I had was to modify distutils2/dist.py so that the Config object wasn't created until after dist.command_options was populated, and read the information from there, but that seemed like it was becoming way too drastic a change; and that I should consult with the project developers before I walked too far down an unacceptable and dark path :)

Any advice about how I might go from here would be greatly appreciated; or if the issue is not one that seems likely to be accepted, let me know and I'll stop here. 

Thanks 

- Eli Collins

Éric Araujo

unread,
Jun 9, 2011, 8:33:12 AM6/9/11
to the-fellowship-...@googlegroups.com
Hi Eli,

We agreed on another implementation idea on the bug report, but I’m
going to reply to two points here.

> I'm currently trying to write a patch to implement an enhancement to
> disutils2 (I created an issue for it here -http://bugs.python.org/issue12242);
> and I'm currently stymied by my lack of knowledge about distutils2's
> architecture. I didn't want to clutter the issue tracker with questions, and
> this seemed the most appropriate place to ask. (If there's another venue
> where I should post this, my apologies in advance).

Asking on the tracker is okay; this list is okay too.

> I got stumped at that point, because it looks like the information I need is

> the value of *"build_ext.compiler"*, and command instances aren't created

> until much later (assuming the command is even invoked at all).

Every command object can get another command object (with options set,
but without running it) with self.get_finalized_command.

Regards

Reply all
Reply to author
Forward
0 new messages