← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~gary/launchpad/bug656213 into lp:launchpad/devel

 

Gary Poster has proposed merging lp:~gary/launchpad/bug656213 into lp:launchpad/devel.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #656213 .lpconfig and /etc/launchpad/config no longer work
  https://bugs.launchpad.net/bugs/656213


This branch changes the buildout to address the linked bug.

stub has already approved the branch in the bug report; this is an official request that is friendly to our various bits of automation.
-- 
https://code.launchpad.net/~gary/launchpad/bug656213/+merge/38242
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~gary/launchpad/bug656213 into lp:launchpad/devel.
=== modified file 'buildout.cfg'
--- buildout.cfg	2010-09-06 21:13:14 +0000
+++ buildout.cfg	2010-10-12 16:01:07 +0000
@@ -51,9 +51,9 @@
 interpreter = py
 # Note that any indentation is lost in initialization blocks.
 initialization =
-    import os
-    os.environ.setdefault('LPCONFIG', '${configuration:instance_name}')
-    import lp_sitecustomize # Initializes LP environment.
+    # See buildout.cfg, [scripts] section, "initialization" key.
+    from lp_sitecustomize import main
+    main('${configuration:instance_name}') # Initializes LP environment.
 entry-points = stxdocs=zope.configuration.stxdocs:main
     googletestservice=canonical.launchpad.testing.googletestservice:main
     windmill=windmill.bin.windmill_bin:main

=== modified file 'lib/lp_sitecustomize.py'
--- lib/lp_sitecustomize.py	2010-09-27 08:46:26 +0000
+++ lib/lp_sitecustomize.py	2010-10-12 16:01:07 +0000
@@ -87,15 +87,17 @@
         module="Crypto")
 
 
-def main():
-    # Note that we configure the LPCONFIG environmental variable in the
-    # custom buildout-generated sitecustomize.py in
-    # parts/scripts/sitecustomize.py rather than here.  This is because
-    # the instance name, ${configuration:instance_name}, is dynamic,
-    # sent to buildout from the Makefile.  See buildout.cfg in the
-    # initialization value of the [scripts] section for the code that
-    # goes into this custom sitecustomize.py.  We do as much other
-    # initialization as possible here, in a more visible place.
+def main(instance_name):
+    # This is called by our custom buildout-generated sitecustomize.py
+    # in parts/scripts/sitecustomize.py. The instance name is sent to
+    # buildout from the Makefile, and then inserted into
+    # sitecustomize.py.  See buildout.cfg in the "initialization" value
+    # of the [scripts] section for the code that goes into this custom
+    # sitecustomize.py.  We do all actual initialization here, in a more
+    # visible place.
+    if instance_name and instance_name != 'development':
+        # See bug 656213 for why we do this carefully.
+        os.environ.setdefault('LPCONFIG', instance_name)
     os.environ['STORM_CEXTENSIONS'] = '1'
     add_custom_loglevels()
     customizeMimetypes()
@@ -109,5 +111,3 @@
     silence_bzr_logger()
     silence_zcml_logger()
     silence_transaction_logger()
-
-main()