merge stable, fixing dependencies generation on c-c newcube on the way
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 20 Apr 2010 14:36:18 +0200
changeset 5347 8ebed973819b
parent 5343 b7eca41d72f9 (current diff)
parent 5346 9ec5c37f11ba (diff)
child 5352 be44c58d3ed9
merge stable, fixing dependencies generation on c-c newcube on the way
dbapi.py
debian/control
devtools/devctl.py
skeleton/__pkginfo__.py.tmpl
--- a/dbapi.py	Tue Apr 20 10:57:08 2010 +0200
+++ b/dbapi.py	Tue Apr 20 14:36:18 2010 +0200
@@ -108,11 +108,50 @@
 def connect(database=None, login=None, host=None, group=None,
             cnxprops=None, setvreg=True, mulcnx=True, initlog=True, **kwargs):
     """Constructor for creating a connection to the CubicWeb repository.
-    Returns a Connection object.
+    Returns a :class:`Connection` object.
+
+    Typical usage::
+
+      cnx = connect('myinstance', login='me', password='toto')
+
+    Arguments:
+
+    :database:
+      the instance's pyro identifier.
+
+    :login:
+      the user login to use to authenticate.
+
+    :host:
+      the pyro nameserver host. Will be detected using broadcast query if
+      unspecified.
+
+    :group:
+      the instance's pyro nameserver group. You don't have to specify it unless
+      tweaked in instance's configuration.
 
-    When method is 'pyro', setvreg is True, try to deal with connections to
-    differents instances in the same process unless specified otherwise by
-    setting the mulcnx to False.
+    :cnxprops:
+      an optional :class:`ConnectionProperties` instance, allowing to specify
+      the connection method (eg in memory or pyro). A Pyro connection will be
+      established if you don't specify that argument.
+
+    :setvreg:
+      flag telling if a registry should be initialized for the connection.
+      Don't change this unless you know what you're doing.
+
+    :mulcnx:
+      Will disappear at some point. Try to deal with connections to differents
+      instances in the same process unless specified otherwise by setting this
+      flag to False. Don't change this unless you know what you're doing.
+
+    :initlog:
+      flag telling if logging should be initialized. You usually don't want
+      logging initialization when establishing the connection from a process
+      where it's already initialized.
+
+    :kwargs:
+      there goes authentication tokens. You usually have to specify for
+      instance a password for the given user, using a named 'password' argument.
     """
     config = cwconfig.CubicWebNoAppConfiguration()
     if host:
--- a/debian/control	Tue Apr 20 10:57:08 2010 +0200
+++ b/debian/control	Tue Apr 20 14:36:18 2010 +0200
@@ -50,7 +50,7 @@
 Description: postgres support for the CubicWeb framework
  CubicWeb is a semantic web application framework.
  .
- This virtual package provides dependancies to use postgres for the
+ This virtual package provides dependencies to use postgres for the
  cubicweb repository.
 
 Package: cubicweb-mysql-support
@@ -60,7 +60,7 @@
 Description: mysql support for the CubicWeb framework
  CubicWeb is a semantic web application framework.
  .
- This virtual package provides dependancies to use mysql for the
+ This virtual package provides dependencies to use mysql for the
  cubicweb repository.
 
 
--- a/devtools/devctl.py	Tue Apr 20 10:57:08 2010 +0200
+++ b/devtools/devctl.py	Tue Apr 20 14:36:18 2010 +0200
@@ -538,19 +538,14 @@
         longdesc = shortdesc = raw_input('Enter a short description for your cube: ')
         if verbose:
             longdesc = raw_input('Enter a long description (leave empty to reuse the short one): ')
+        dependencies = {'cubicweb': '>= %s' % cubicwebversion}
         if verbose:
-            includes = self._ask_for_dependancies()
-            if len(includes) == 1:
-                dependancies = '%r,' % includes[0]
-            else:
-                dependancies = ', '.join(repr(cube) for cube in includes)
-        else:
-            dependancies = ''
+            dependencies.update(self._ask_for_dependencies())
         context = {'cubename' : cubename,
                    'distname' : distname,
                    'shortdesc' : shortdesc,
                    'longdesc' : longdesc or shortdesc,
-                   'dependancies' : dependancies,
+                   'dependencies' : dependencies,
                    'version'  : cubicwebversion,
                    'year'  : str(datetime.now().year),
                    'author': self['author'],
@@ -565,21 +560,22 @@
                         'cubes.*', 'external_resources*')
         copy_skeleton(skeldir, cubedir, context, exclude=exclude)
 
-    def _ask_for_dependancies(self):
+    def _ask_for_dependencies(self):
         from logilab.common.shellutils import ASK
         from logilab.common.textutils import splitstrip
-        includes = []
-        for stdtype in ServerConfiguration.available_cubes():
-            answer = ASK.ask("Depends on cube %s? " % stdtype,
+        depcubes = []
+        for cube in ServerConfiguration.available_cubes():
+            answer = ASK.ask("Depends on cube %s? " % cube,
                              ('N','y','skip','type'), 'N')
             if answer == 'y':
-                includes.append(stdtype)
+                depcubes.append(cube)
             if answer == 'type':
-                includes = splitstrip(raw_input('type dependancies: '))
+                depcubes = splitstrip(raw_input('type dependencies: '))
                 break
             elif answer == 'skip':
                 break
-        return includes
+        return dict(('cubicweb-' + cube, ServerConfiguration.cube_version(cube))
+                    for cube in depcubes)
 
 
 class ExamineLogCommand(Command):
--- a/goa/goactl.py	Tue Apr 20 10:57:08 2010 +0200
+++ b/goa/goactl.py	Tue Apr 20 14:36:18 2010 +0200
@@ -195,7 +195,7 @@
         # goa instance'skeleton
         copy_skeleton(join(CW_SOFTWARE_ROOT, 'goa', 'skel'),
                       appldir, context, askconfirm=True)
-        # cubicweb core dependancies
+        # cubicweb core dependencies
         for directory, subdirectory in slink_directories():
             subdirectory = join(appldir, subdirectory)
             if not exists(split(subdirectory)[0]):
--- a/skeleton/__pkginfo__.py.tmpl	Tue Apr 20 10:57:08 2010 +0200
+++ b/skeleton/__pkginfo__.py.tmpl	Tue Apr 20 14:36:18 2010 +0200
@@ -40,6 +40,6 @@
 # Note: here, you'll need to add subdirectories if you want
 # them to be included in the debian package
 
-__depends__ = {'cubicweb': '>= %(version)s'}
+__depends__ =  %(dependencies)s
 __recommends__ = {}