On Thu, 12 Mar 2009, Christian Heimes wrote:

Andi Vajda wrote:
In other words, you're fixing this with this patch by introducing
another such inconvenience, both with a silent failure. It doesn't look
like the trade off is worthwhile.

This is not saying anything about the quality or cleverness of the patch
itself. It taught me something about how do customize build.

Since you've already put in place the build_py customization, it would
be a shame to lose this. Is there a better way to implement run() so
that the
logic for deciding on generating config.py doesn't have the flaws above
? Is there a way to have config.py created only during a real 'build' ?

Forsooth, it's tricky to get the creation of config.py right. I can't
find a way to detect a real 'build' (as you said).
You could follow a different path though. The config.py file should be
(re)created when it doesn't not yet exist or whenever the user  builds
JCC. All build and binary distribution commands (binary egg, Windows
installer etc) start with either 'build' or 'bdist'.


if not os.path.exists(self.jcc_config_file):
   create_config = 1
else:
   create_config = 0

for command in self.distribution.commands:
   if command.startswith(("build", "bdist")):
       create_config = 1
       break

if create_config:
   self.create_jcc_config()


I might have missed a scenario or two where the code still to create a
correct config.py. It should cover about 99.99% of all possible cases.

It doesn't cover the case where one just calls 'install' without 'build' and a build is actually needed. build is invoked, as expected, but doesn't appear in the commands list. In other words, not all build commands start with 'build'. 'install' behaves like a build command too (in addition to installing stuff).

Andi..

Reply via email to