#2419: tg-admin sql create fails with sqlobject on installed apps
------------------------+---------------------------------------------------
 Reporter:  toshio      |       Owner:                  
     Type:  defect      |      Status:  new             
 Priority:  normal      |   Milestone:  __unclassified__
Component:  TurboGears  |     Version:  1.0.8           
 Severity:  normal      |    Keywords:                  
------------------------+---------------------------------------------------
 One of our developers is using SQLObject and TG-1.0.8.  He's writing up
 documentation for end users on how to setup the application on their
 machines.
 The application is installed in /usr/share/israwhidebroken.  There's two
 directories in there:

   * /usr/share/israwhidebroken/israwhidebroken <= Contains the module that
 drives the app
   * /usr/share/israwhidebroken/israwhidebroken-0.1-py26.egg-info <=
 Contains the egg info for the module

 He's tried to run "tg-admin sql create" to setup the database in a variety
 of ways and it has failed.  Our best guess as to what should work was::

 {{{
   $ cd /usr/share/israwhidebroken
   $ PYTHONPATH=/usr/share/israwhidebroken tg-admin sql create -c
 /etc/israwhidebroken.cfg
   [...]
   # note: line numbers slightly off as I have some print statements in for
 debugging
 Traceback (most recent call last):
   File "/usr/bin/tg-admin", line 8, in <module>
     load_entry_point('TurboGears==1.0.8', 'console_scripts', 'tg-admin')()
   File "/usr/lib/python2.6/site-packages/turbogears/command/base.py", line
 400, in main
     command.run()
   File "/usr/lib/python2.6/site-packages/turbogears/command/base.py", line
 138, in run
     command.the_runner.run(sys.argv)
   File "/usr/lib/python2.6/site-packages/sqlobject/manager/command.py",
 line 101, in run
     runner.run()
   File "/usr/lib/python2.6/site-packages/sqlobject/manager/command.py",
 line 306, in run
     self.load_options_from_egg(egg_spec)
   File "/usr/lib/python2.6/site-packages/sqlobject/manager/command.py",
 line 491, in load_options_from_egg
     dist, conf = self.config_from_egg(egg_spec)
   File "/usr/lib/python2.6/site-packages/sqlobject/manager/command.py",
 line 501, in config_from_egg
     dist = pkg_resources.get_distribution(egg_spec)
   File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 270, in
 get_distribution
     if isinstance(dist,Requirement): dist = get_provider(dist)
   File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 156, in
 get_provider
     return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
   File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 626, in
 require
     needed = self.resolve(parse_requirements(requirements))
   File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 524, in
 resolve
     raise DistributionNotFound(req)  # XXX put more info here
 pkg_resources.DistributionNotFound: israwhidebroken-0.1-py2.6
 }}}

 I took a look and found that turbogears/command/base.py:SQL.run() was
 getting
 the name of the egg directory, stripping the '.egg-info' extension and
 then
 passing that on to sqlobject and hence to setuptools.  Unfortunately,
 setuptools doesn't know how to deal with "israwhidebroken-0.1-py2.6".  it
 treats the whole thing as a complete package name string.  For setuptools
 to
 understand this it would need to be closer to "israwhidebroken == 0.1"
 (not
 sure how to deal with the py2.6).

 I did some work and have a patch which transforms the directory name into
 the
 form setuptools expects.  I also looked at TurboGears-1.1 and found that
 the
 logic is the same there and the patch applies.

-- 
Ticket URL: <http://trac.turbogears.org/ticket/2419>
TurboGears <http://www.turbogears.org/>
TurboGears front-to-back web development

-- 
You received this message because you are subscribed to the Google
Groups "TurboGears Tickets" group.
This group is read-only. No posting by normal members allowed.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/turbogears-tickets?hl=en?hl=en

Reply via email to