On Mar 12, 2009, at 13:10, Christian Heimes <li...@cheimes.de> wrote:

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.

That's the problem. If I change my env or edit setup.py and config.py exists already because I already did a build, it is not going to be re- generated if I do 'python setup.py install' even though it should since 'install' calls 'build' (and people expect it to) yet 'build' doesn't appear in self.distutils.commands.

Andi..



Christian

Reply via email to