[Checkins] SVN: zc.buildout/trunk/ 151820: Add the distribution directory to sys.path when running

Ross Patterson me at rpatterson.net
Tue Oct 30 18:44:47 EDT 2007


Log message for revision 81246:
  
  151820: Add the distribution directory to sys.path when running
  the setup.py script so that the setup.py script can import modules
  from the distribution directory.
  

Changed:
  U   zc.buildout/trunk/CHANGES.txt
  U   zc.buildout/trunk/src/zc/buildout/easy_install.py
  U   zc.buildout/trunk/src/zc/buildout/tests.py

-=-
Modified: zc.buildout/trunk/CHANGES.txt
===================================================================
--- zc.buildout/trunk/CHANGES.txt	2007-10-30 22:39:49 UTC (rev 81245)
+++ zc.buildout/trunk/CHANGES.txt	2007-10-30 22:44:46 UTC (rev 81246)
@@ -33,6 +33,9 @@
 Bugs Fixed
 ----------
 
+- 151820: Develop failed if the setup.py script imported modules in
+  the distribution directory.
+
 - The setup command wasn't documented.
 
 - The setup command failed if run in a directory without specifying a

Modified: zc.buildout/trunk/src/zc/buildout/easy_install.py
===================================================================
--- zc.buildout/trunk/src/zc/buildout/easy_install.py	2007-10-30 22:39:49 UTC (rev 81245)
+++ zc.buildout/trunk/src/zc/buildout/easy_install.py	2007-10-30 22:44:46 UTC (rev 81246)
@@ -994,6 +994,7 @@
         
 runsetup_template = """
 import sys
+sys.path.insert(0, %(setupdir)r)
 sys.path.insert(0, %(setuptools)r)
 import os, setuptools
 

Modified: zc.buildout/trunk/src/zc/buildout/tests.py
===================================================================
--- zc.buildout/trunk/src/zc/buildout/tests.py	2007-10-30 22:39:49 UTC (rev 81245)
+++ zc.buildout/trunk/src/zc/buildout/tests.py	2007-10-30 22:44:46 UTC (rev 81246)
@@ -2328,11 +2328,39 @@
 
     """
 
+def develop_with_modules():
+    """
+Distribution setup scripts can import modules in the distribution directory:
 
+    >>> mkdir('foo')
+    >>> write('foo', 'bar.py',
+    ... '''# empty
+    ... ''')
 
+    >>> write('foo', 'setup.py',
+    ... '''
+    ... import bar
+    ... from setuptools import setup
+    ... setup(name="foo")
+    ... ''')
 
+    >>> write('buildout.cfg',
+    ... '''
+    ... [buildout]
+    ... develop = foo
+    ... parts = 
+    ... ''')
 
+    >>> print system(join('bin', 'buildout')),
+    Develop: '/sample-buildout/foo'
 
+    >>> ls('develop-eggs')
+    -  foo.egg-link
+    -  zc.recipe.egg.egg-link
+
+    """
+
+
 ######################################################################
     
 def create_sample_eggs(test, executable=sys.executable):



More information about the Checkins mailing list