Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #2098 (closed defect: fixed)

Opened 9 years ago

Last modified 9 years ago

tgsetup.py fails with AttributeError when .pydistutils.cfg has find_link value

Reported by: aji Owned by: faide
Priority: normal Milestone: 1.0.x bugfix
Component: TurboGears Version: 1.0.8
Severity: normal Keywords: tgsetup.py AttributeError
Cc:

Description

If my system has a ~/.pydistutils.cfg file with a find_links attribute in the [easy_install] section, then tgsetup.py will fail:

$ sudo python tgsetup.py
TurboGears Installer
Beginning setuptools/EasyInstall installation and TurboGears download

Traceback (most recent call last):
  File "tgsetup.py", line 462, in <module>
    tg_main()
  File "tgsetup.py", line 210, in tg_main
    main(args)
  File "tgsetup.py", line 426, in main
    main(argv)
  File "/usr/local/lib/python2.5/site-packages/setuptools-0.6c9-py2.5.egg/setuptools/command/easy_install.py", line 1671, in main
  File "/usr/local/lib/python2.5/site-packages/setuptools-0.6c9-py2.5.egg/setuptools/command/easy_install.py", line 1659, in with_ei_usage
  File "/usr/local/lib/python2.5/site-packages/setuptools-0.6c9-py2.5.egg/setuptools/command/easy_install.py", line 1675, in <lambda>
  File "/usr/lib/python2.5/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/usr/lib/python2.5/distutils/dist.py", line 974, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python2.5/distutils/dist.py", line 993, in run_command
    cmd_obj.ensure_finalized()
  File "/usr/lib/python2.5/distutils/cmd.py", line 117, in ensure_finalized
    self.finalize_options()
  File "tgsetup.py", line 273, in finalize_options
    self.find_links.append(TGDOWNLOAD)
AttributeError: 'str' object has no attribute 'append'

The existing find_links value is a string, but tgsetup.py assumes that it is a list if it exists.

This patch will fix the error:

$ diff tgsetup.py.orig tgsetup.py
268a269,272
>             # this elif fixes the AttributeError: 'str' object has no attribute 'append' error
>             elif isinstance(self.find_links, (str, unicode)):
>                 # encase string in list
>                 self.find_links = [self.find_links]

Change History

comment:1 Changed 9 years ago by chrisz

  • Status changed from new to closed
  • Resolution set to fixed

Fixed in r6207.

Note: See TracTickets for help on using tickets.