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. Christian