← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/remove-buildout-templates into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/remove-buildout-templates into lp:launchpad with lp:~cjwatson/launchpad/simplify-buildout-bin-test as a prerequisite.

Commit message:
Inline the relevant bits of _pythonpath.py so that it no longer needs to be generated.  Remove the buildout-templates machinery.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/remove-buildout-templates/+merge/323744

This requires hardcoding parts/scripts (although that will change once we convert to pip), which is a small price to pay for being able to remove this complex and buildout-specific bit of build infrastructure.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/remove-buildout-templates into lp:launchpad.
=== modified file '.bzrignore'
--- .bzrignore	2017-01-17 22:14:56 +0000
+++ .bzrignore	2017-05-08 12:45:26 +0000
@@ -41,7 +41,6 @@
 dist
 ./eggs
 ./download-cache
-./_pythonpath.py
 ./production-configs
 bzr.dev
 _trial_temp

=== modified file 'Makefile'
--- Makefile	2017-01-21 13:42:28 +0000
+++ Makefile	2017-05-08 12:45:26 +0000
@@ -57,8 +57,6 @@
     bin/tags bin/test bin/tracereport bin/twistd \
     bin/watch_jsbuild bin/with-xvfb
 
-BUILDOUT_TEMPLATES = buildout-templates/_pythonpath.py.in
-
 # DO NOT ALTER : this should just build by default
 default: inplace
 
@@ -229,8 +227,7 @@
 # If we listed every target on the left-hand side, a parallel make would try
 # multiple copies of this rule to build them all.  Instead, we nominally build
 # just $(PY), and everything else is implicitly updated by that.
-$(PY): bin/buildout versions.cfg $(BUILDOUT_CFG) setup.py \
-		$(BUILDOUT_TEMPLATES)
+$(PY): bin/buildout versions.cfg $(BUILDOUT_CFG) setup.py
 	$(SHHH) PYTHONPATH= ./bin/buildout \
                 configuration:instance_name=${LPCONFIG} -c $(BUILDOUT_CFG)
 	touch $@
@@ -351,7 +348,6 @@
 	$(RM) -r parts
 	$(RM) -r develop-eggs
 	$(RM) .installed.cfg
-	$(RM) _pythonpath.py
 	$(RM) -r yui/*
 
 clean_logs:

=== modified file 'README'
--- README	2017-05-08 12:45:26 +0000
+++ README	2017-05-08 12:45:26 +0000
@@ -89,9 +89,6 @@
 the files in the top-level directory are for.  However, here's a guide to some
 of the ones that come up from time to time.
 
-  buildout-templates/
-    Templates that are generated into actual files when buildout is run.
-
   bzrplugins/
     Bazaar plugins used in running Launchpad.
 

=== renamed file 'buildout-templates/_pythonpath.py.in' => '_pythonpath.py'
--- buildout-templates/_pythonpath.py.in	2017-01-20 01:46:34 +0000
+++ _pythonpath.py	2017-05-08 12:45:26 +0000
@@ -1,20 +1,25 @@
-# Copyright 2009-2016 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2017 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
-# NOTE: This is a generated file.  The original is in
-# buildout-templates/_pythonpath.py.in
-
 # This file works if the Python has been started with -S, or if bin/py
 # has been used.
 
-# Auto-generated code to handle relative paths
-${python-relative-path-setup}
-
-import os
+import imp
+import os.path
 import sys
-import warnings
-
-site_dir = ${scripts:parts-directory|path-repr}
+
+# Get path to this file.
+if __name__ == '__main__':
+    filename = __file__
+else:
+    # If this is an imported module, we want the location of the .py
+    # file, not the .pyc, because the .py file may have been symlinked.
+    filename = imp.find_module(__name__)[1]
+# Get the full, non-symbolic-link directory for this file.  This is the
+# project root.
+top = os.path.dirname(os.path.abspath(os.path.realpath(filename)))
+
+site_dir = os.path.join(top, 'parts', 'scripts')
 
 if ('site' in sys.modules and
     not sys.modules['site'].__file__.startswith(

=== removed directory 'buildout-templates'
=== modified file 'buildout.cfg'
--- buildout.cfg	2016-11-03 15:19:01 +0000
+++ buildout.cfg	2017-05-08 12:45:26 +0000
@@ -1,10 +1,9 @@
-# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2017 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 [buildout]
 parts =
     scripts
-    filetemplates
     tags
     iharness
     i18n
@@ -35,10 +34,6 @@
 [configuration]
 instance_name = development
 
-[filetemplates]
-recipe = z3c.recipe.filetemplate
-source-directory = buildout-templates
-
 [scripts]
 recipe = z3c.recipe.scripts
 eggs = lp

=== modified file 'doc/buildout.txt'
--- doc/buildout.txt	2017-05-08 12:45:26 +0000
+++ doc/buildout.txt	2017-05-08 12:45:26 +0000
@@ -317,8 +317,7 @@
     Sections other than ``[buildout]`` that are specified as parts always must
     specify a ``recipe``: an identifier that determines what code should
     process that section.  You'll see a variety of recipes in Launchpad's
-    buildout.cfg, including ``z3c.recipe.filetemplate``, ``zc.recipe.egg``, and
-    others.
+    buildout.cfg, including ``zc.recipe.egg`` and others.
 
 ``versions.cfg``
     As mentioned above, ``buildout.cfg`` extends ``versions.cfg``  by
@@ -368,13 +367,6 @@
     The downside is that adding and upgrading packages takes a small additional
     step, as we'll see below.
 
-``buildout-templates``
-    The last additional item in the checkout is the ``buildout-templates``
-    directory.  This is used to hold templates that are used by the
-    section in buildout.cfg that uses the ``z3c.recipe.filetemplate`` recipe.
-    This can be used for many things, but we are using it as an alternate way
-    for producing scripts when the zc.recipe.egg approach is insufficient.
-
 In addition to these seven listings, after you have run the Makefile (or
 ``bin/buildout``), you will see an additional listing:
 
@@ -532,27 +524,6 @@
 
 .. _`zc.recipe.egg documentation`: http://pypi.python.org/pypi/zc.recipe.egg
 
-Add a File Modified By Buildout
-===============================
-
-Sometimes we need more control for the way our scripts are generated, or we
-need other files processed during a buildout.  Writing a custom zc.buildout
-recipe is one way, but well out of the scope of this document.  Read the
-zc.buildout documentation for direction.
-
-A much easier, and more limited approach is to use `z3c.recipe.filetemplate`_
-to build the file.  The recipe uses the ``buildout-templates`` directory,
-which is a mirror of the Launchpad source tree.  The recipe searches the tree
-for files ending in '.in', performs variable substitution on them, and then be
-copies them into the Launchpad source tree.
-
-To add a file using the recipe, simply create mirrors of the source tree
-directories that you need under ``buildout-templates/``, and create a .in file
-template at the desired location.  Take a look at
-``buildout-templates/_pythonpath.py.in`` for an example of what is possible.
-
-.. _`z3c.recipe.filetemplate`: http://pypi.python.org/pypi/z3c.recipe.filetemplate
-
 Work with Unreleased or Forked Packages
 =======================================
 

=== modified file 'versions.cfg'
--- versions.cfg	2017-02-01 09:37:31 +0000
+++ versions.cfg	2017-05-08 12:45:26 +0000
@@ -158,7 +158,6 @@
 wsgiref = 0.1.2
 z3c.pt = 2.2.3
 z3c.ptcompat = 0.5.7
-z3c.recipe.filetemplate = 2.2.0
 z3c.recipe.i18n = 0.8.1
 z3c.recipe.tag = 0.6
 # Also upgrade the zc.buildout version in the Makefile's bin/buildout section.


Follow ups