[Distutils] Two problems with setuptools

Dmitry Vasiliev dima at hlabs.spb.ru
Sun Dec 23 17:50:22 CET 2007


Phillip J. Eby wrote:
> At 03:22 PM 12/21/2007 +0300, Dmitry Vasiliev wrote:
>> It seems OK but the problem arrives if I want to test package (python
>> setup.py test) and then install it (python setup.py install). At the
>> test phase the required packages will be downloaded and placed in the
>> current directory. But at the install phase it seems setuptools will be
>> fooled by the previously downloaded packages and doesn't install them
>> correctly.
> 
> This is a known bug and not an easy one to fix, which is a big part of
> why it's not fixed yet.  :(

Aah, bad. Can't the "test" command downloads packages in some location
which is just temporarily placed on PYTHONPATH?

>> It works fine except the case when I want to place some options in
>> setup.cfg. For 'install_data' it works as expected, but for
>> 'install_scripts' it seems the configuration parses before the required
>> package will be downloaded and my additional options for
>> 'install_scripts' doesn't work.
> 
> I think you should post your actual code here.  As far as I can tell,
> setuptools installs the setup_requires eggs before any configuration
> parsing can happen.  I would suspect something is wrong with either your
> setup_requires or your "lazily-populated dictlike object".

Actually the problem is easily reproducible with the following code:

---- setup.cfg ----
[install_scripts]

some-option=value
-------------------

---- setup.py ----
from setuptools import setup

setup(
    setup_requires=["somemodule"],
)
------------------

I ran "python setup.py install_scripts" (on Windows XP, Python 2.4,
setuptools 0.6c7) and got the following traceback:

Traceback (most recent call last):
  File "setup.py", line 7, in ?
    setup_requires=["somemodule"],
  File "c:\Python24\lib\distutils\core.py", line 110, in setup
    _setup_distribution = dist = klass(attrs)
  File
"c:\python24\lib\site-packages\setuptools-0.6c7-py2.4.egg\setuptools\dist.py",
line 219, in __init__
    self.fetch_build_eggs(attrs.pop('setup_requires'))
  File
"c:\python24\lib\site-packages\setuptools-0.6c7-py2.4.egg\setuptools\dist.py",
line 242, in fetch_build_eggs
    for dist in working_set.resolve(
  File
"c:\python24\lib\site-packages\setuptools-0.6c7-py2.4.egg\pkg_resources.py",
line 522, in resolve
    dist = best[req.key] = env.best_match(req, self, installer)
  File
"c:\python24\lib\site-packages\setuptools-0.6c7-py2.4.egg\pkg_resources.py",
line 758, in best_match
    return self.obtain(req, installer) # try and download/install
  File
"c:\python24\lib\site-packages\setuptools-0.6c7-py2.4.egg\pkg_resources.py",
line 770, in obtain
    return installer(requirement)
  File
"c:\python24\lib\site-packages\setuptools-0.6c7-py2.4.egg\setuptools\dist.py",
line 284, in fetch_build_egg
    cmd.ensure_finalized()
  File "c:\Python24\lib\distutils\cmd.py", line 117, in ensure_finalized
    self.finalize_options()
  File
"c:\python24\lib\site-packages\setuptools-0.6c7-py2.4.egg\setuptools\command\easy_install.py"
, line 139, in finalize_options
    ('install_dir', 'script_dir')
  File "c:\Python24\lib\distutils\cmd.py", line 304, in
set_undefined_options
    src_cmd_obj = self.distribution.get_command_obj(src_cmd)
  File "c:\Python24\lib\distutils\dist.py", line 851, in get_command_obj
    self._set_command_options(cmd_obj, options)
  File "c:\Python24\lib\distutils\dist.py", line 889, in
_set_command_options
    raise DistutilsOptionError, \
distutils.errors.DistutilsOptionError: error in setup.cfg: command
'install_scripts' has no such option 'some_option'

-- 
Dmitry Vasiliev <dima at hlabs.spb.ru>
http://hlabs.spb.ru

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 250 bytes
Desc: OpenPGP digital signature
Url : http://mail.python.org/pipermail/distutils-sig/attachments/20071223/6bf7372b/attachment.pgp 


More information about the Distutils-SIG mailing list