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 #1585 (closed defect: wontfix)

Opened 12 years ago

Last modified 12 years ago

[PATCH] Use TurboGears[future] when quickstarting an sqlalchemy project

Reported by: toshio Owned by: anonymous
Priority: normal Milestone: 1.0.4
Component: TurboGears Version: 1.0.3
Severity: normal Keywords:
Cc:

Description

When quickstarting a TurboGears project with sqlalchemy, it would be great if the start script would require SQLAlchemy. This patch does that.

It also switches to using require like the tg-admin script and other entry-point generated scripts. This works around broken setuptools behaviour in some cases when multiple versions of a required package are installed.

We're using this in 1.0.3 to allow installing sqlalchemy-0.4 and sqlalchemy-0.3 concurrently. If everything comes together, that shouldn't be a problem with 1.0.4 but it will protect us if 1.0.4 doesn't work with genshi-0.5 or another module is updated incompatibly.

Index: turbogears/qstemplates/quickstart/start-+package+.py_tmpl
===================================================================
--- turbogears/qstemplates/quickstart/start-+package+.py_tmpl.orig
+++ turbogears/qstemplates/quickstart/start-+package+.py_tmpl
@@ -1,6 +1,10 @@
 #!${sys_executable}
+#if $sqlalchemy != "True"
+__requires__="TurboGears"
+#else 
+__requires__="TurboGears[future]"
+#end if
 import pkg_resources
-pkg_resources.require("TurboGears")
 
 from turbogears import config, update_config, start_server
 import cherrypy

Change History

comment:1 Changed 12 years ago by faide

  • Summary changed from Patch: Use TurboGears[future] when quickstarting an sqlalchemy project to [PATCH] Use TurboGears[future] when quickstarting an sqlalchemy project

comment:2 Changed 12 years ago by Chris Arndt

Can you explain, what the __requires__ assignment does exactly? It isn't documented on the setuptools page and a quick search indicates that this rather a hack than a recommended way to use setuptools.

I would prefer a patch that turns the generated start script into an entry point console script as described on  http://docs.turbogears.org/1.0/DeployWithAnEgg#id4.

comment:3 Changed 12 years ago by Chris Arndt

See also #1386.

comment:4 Changed 12 years ago by faide

Chris is right #1386 is the way to go.

comment:5 Changed 12 years ago by faide

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

We will implement #1386 instead

comment:6 Changed 12 years ago by toshio

Excellent. Will #1386 be backported to TG-1.0.4?

comment:7 Changed 12 years ago by faide

Yes, #1386 is already in the 1.0.x branch and will be present in the upcoming 1.0.4b3 release :-)

Note: See TracTickets for help on using tickets.