Andi Vajda wrote: >> 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).
This case is covered by the first check "if not os.path.exists(self.jcc_config_file)". When a user does the "tar -xzf && python2.5 setup.py install" dance, the config file does not yet exist. The first if/else block makes sure it's always created. The second block ensures the file is not re-created unless the user invokes setup.py with a build or bdist command. Christian