[Checkins] SVN: zc.buildout/trunk/zc.recipe.egg_/ Added an extra-paths option to specify extra paths to be inclided in

Jim Fulton jim at zope.com
Tue Aug 29 13:11:13 EDT 2006


Log message for revision 69863:
  Added an extra-paths option to specify extra paths to be inclided in
  generated script paths.
  

Changed:
  U   zc.buildout/trunk/zc.recipe.egg_/README.txt
  U   zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/README.txt
  U   zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/egg.py
  U   zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/tests.py

-=-
Modified: zc.buildout/trunk/zc.recipe.egg_/README.txt
===================================================================
--- zc.buildout/trunk/zc.recipe.egg_/README.txt	2006-08-29 16:32:31 UTC (rev 69862)
+++ zc.buildout/trunk/zc.recipe.egg_/README.txt	2006-08-29 17:11:13 UTC (rev 69863)
@@ -41,6 +41,9 @@
 The zc.recipe.egg:custom recipe supports building custom eggs,
 currently with specialized options for building extensions.
 
+extra-paths
+   Extra paths to include in a generates script.
+
 To do
 -----
 
@@ -51,14 +54,6 @@
 - More control over script generation.  In particular, some way to 
   specify data t be recored in the script.
 
-- Honor the buildout offline option.
-
-- Windows suppprt
-
-  - Generate exe files
-
-  - Make sure tests work under windows
-
 Change History
 ==============
 

Modified: zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/README.txt
===================================================================
--- zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/README.txt	2006-08-29 16:32:31 UTC (rev 69862)
+++ zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/README.txt	2006-08-29 17:11:13 UTC (rev 69863)
@@ -37,6 +37,8 @@
    disabled.  If the option isn't given at all, then all scripts
    defined by the named eggs will be generated.
 
+extra-paths
+   Extra paths to include in a generates script.
 
 We have a link server that has a number of eggs:
 
@@ -113,7 +115,7 @@
 The value it prints out happens to be some values defined in the
 modules installed.
 
-We can also run the py_demo script.  Here we'll just print out
+We can also run the py-demo script.  Here we'll just print out
 the bits if the path added to reflect the eggs:
 
     >>> print system(os.path.join(sample_buildout, 'bin', 'py-demo'),
@@ -205,6 +207,46 @@
     -  foo
     -  py-zc.buildout
 
+If we need to include extra paths in a script, we can use the
+extra-paths option:
+
+    >>> write(sample_buildout, 'buildout.cfg',
+    ... """
+    ... [buildout]
+    ... parts = demo
+    ...
+    ... [demo]
+    ... recipe = zc.recipe.egg
+    ... find-links = %(server)s
+    ... index = %(server)s/index
+    ... scripts = demo=foo
+    ... extra-paths = 
+    ...    /foo/bar
+    ...    /spam/eggs
+    ... """ % dict(server=link_server))
+
+    >>> print system(buildout),
+
+Let's look at the script that was generated:
+
+    >>> cat(sample_buildout, 'bin', 'foo') # doctest: +NORMALIZE_WHITESPACE
+    #!/usr/local/bin/python2.3
+    <BLANKLINE>
+    import sys
+    sys.path[0:0] = [
+      '/tmp/xyzsample-install/demo-0.3-py2.3.egg',
+      '/tmp/xyzsample-install/demoneeded-1.1-py2.3.egg',
+      '/foo/bar',
+      '/spam/eggs'
+      ]
+    <BLANKLINE>
+    import eggrecipedemo
+    <BLANKLINE>
+    if __name__ == '__main__':
+        eggrecipedemo.main()
+
+
+
 Offline mode
 ------------
 

Modified: zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/egg.py
===================================================================
--- zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/egg.py	2006-08-29 16:32:31 UTC (rev 69862)
+++ zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/egg.py	2006-08-29 17:11:13 UTC (rev 69863)
@@ -39,6 +39,14 @@
             options['index'] = index
         self.index = index
 
+        self.extra_paths = [
+            os.path.join(buildout['buildout']['directory'], p.strip())
+            for p in options.get('extra-paths', '').split('\n')
+            if p.strip()
+            ]
+        if self.extra_paths:
+            options['extra-paths'] = '\n'.join(self.extra_paths)
+
         options['_b'] = buildout['buildout']['bin-directory']
         options['_e'] = buildout['buildout']['eggs-directory']
         options['_d'] = buildout['buildout']['develop-eggs-directory']
@@ -93,5 +101,7 @@
                     ])
             return zc.buildout.easy_install.scripts(
                 distributions, ws, options['executable'],
-                options['_b'], scripts=scripts)
+                options['_b'],
+                scripts=scripts,
+                extra_paths=self.extra_paths)
 

Modified: zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/tests.py
===================================================================
--- zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/tests.py	2006-08-29 16:32:31 UTC (rev 69862)
+++ zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/tests.py	2006-08-29 17:11:13 UTC (rev 69863)
@@ -73,6 +73,7 @@
                 'zc.buildout.egg'),
                (re.compile('(\n?)-  ([a-zA-Z_.-]+)-script.py\n-  \\2.exe\n'),
                 '\\1-  \\2\n'),
+               (re.compile('#![^\n]+python[^\n]*\n'), '#!python\n'),
                ])
             ),
         doctest.DocFileSuite(



More information about the Checkins mailing list