I have a setup.cfg containing Linux installation options,
[install]
prefix=/opt/foo
install-lib=/opt/foo
which corresponds to the default directory layout this project has under Linux.
Now the same project uses py2exe for Windows installation. Currently, I'm using a .bat file to move this setup.cfg out of the way while running python setup.py py2exe in order not to confuse py2exe with those setting, which I think amounts to distutils/py2exe using default parameters.
I'd much rather invoke python setup.py py2exe with some extra arguments to override those specified in setup.cfg, but using --prefix= --install-lib= gives me
[...]
*** copy data files ***
Traceback (most recent call last):
  File "setup.py", line 158, in <module>
    **platformOptions)
  File "C:\Python27\lib\distutils\core.py", line 152, in setup
    dist.run_commands()
  File "C:\Python27\lib\distutils\dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
    cmd_obj.run()
  File "C:\Python27\lib\site-packages\py2exe\build_exe.py", line 243, in run
    self._run()
  File "C:\Python27\lib\site-packages\py2exe\build_exe.py", line 312, in _run
    self.create_binaries(py_files, extensions, dlls)
  File "C:\Python27\lib\site-packages\py2exe\build_exe.py", line 560, in create_binaries
    install_data.ensure_finalized()
  File "C:\Python27\lib\distutils\cmd.py", line 109, in ensure_finalized
    self.finalize_options()
  File "C:\Python27\lib\distutils\command\install_data.py", line 41, in finalize_options
    ('force', 'force'),
  File "C:\Python27\lib\distutils\cmd.py", line 298, in set_undefined_options
    src_cmd_obj.ensure_finalized()
  File "C:\Python27\lib\distutils\cmd.py", line 109, in ensure_finalized
    self.finalize_options()
  File "C:\Python27\lib\distutils\command\install.py", line 353, in finalize_options
    'userbase', 'usersite')
  File "C:\Python27\lib\distutils\command\install.py", line 504, in convert_paths
    setattr(self, attr, convert_path(getattr(self, attr)))
  File "C:\Python27\lib\distutils\util.py", line 199, in convert_path
    raise ValueError, "path '%s' cannot be absolute" % pathname
ValueError: path '/opt/trelby' cannot be absolute
which is the same behavior as when not trying to override setup.cfg parameters at all, so something seems to go wrong.
I'm also willing to alternatively set distutils.core.setup()'s options parameter in setup.py, if necessary, but the main question seems to be: to what value, in order to achieve default py2exe behavior?
BTW, code is found at https://github.com/oskusalerma/trelby
 
    