Commit 49a79832 authored by Godefroid Chapelle's avatar Godefroid Chapelle

Problem: issues with auto-discovery

Solution: be explicit instead of relying on auto-discovery
parent d08c74fb
...@@ -692,11 +692,12 @@ Fortunately, an application setup script can be minimal. Here's an ...@@ -692,11 +692,12 @@ Fortunately, an application setup script can be minimal. Here's an
example:: example::
from setuptools import setup from setuptools import setup
setup(name='main', install_requires = ['bobo', 'six']) setup(name='main', py_modules='main', install_requires = ['bobo', 'six'])
.. -> src .. -> src
>>> write(src, 'setup.py') >>> write(src, 'setup.py')
>>> write('pass', 'main.py')
We suggest copying and modifying the example above, using it as We suggest copying and modifying the example above, using it as
boilerplate. As is probably clear, the setup arguments used are: boilerplate. As is probably clear, the setup arguments used are:
......
...@@ -28,7 +28,8 @@ are dependencies of the named parts. For example, in ...@@ -28,7 +28,8 @@ are dependencies of the named parts. For example, in
.. -> src .. -> src
>>> write(src, 'buildout.cfg') >>> write(src, 'buildout.cfg')
>>> write("from setuptools import setup; setup(name='myapp')", 'setup.py') >>> write("from setuptools import setup; setup(name='myapp', py_modules=['myapp'])", 'setup.py')
>>> write("pass", 'myapp.py')
>>> run_buildout('buildout annotate') >>> run_buildout('buildout annotate')
>>> run_buildout() >>> run_buildout()
>>> print(read()) # doctest: +ELLIPSIS >>> print(read()) # doctest: +ELLIPSIS
......
...@@ -363,7 +363,8 @@ when running buildout: ...@@ -363,7 +363,8 @@ when running buildout:
.. -> src .. -> src
>>> write("import setuptools; setuptools.setup(name='a')", "setup.py") >>> write("import setuptools; setuptools.setup(name='a', py_modules=['a'])", "setup.py")
>>> write('pass', 'a.py')
>>> write(""" >>> write("""
... [buildout] ... [buildout]
... develop=. ... develop=.
...@@ -376,8 +377,9 @@ when running buildout: ...@@ -376,8 +377,9 @@ when running buildout:
... b=1 ... b=1
... """, "buildout.cfg") ... """, "buildout.cfg")
>>> os.mkdir('b') >>> os.mkdir('b')
>>> write("import setuptools; setuptools.setup(name='b', version=1)", >>> write("import setuptools; setuptools.setup(name='b', py_modules=['b'], version=1)",
... "b", "setup.py") ... "b", "setup.py")
>>> write('pass', 'b.py')
>>> run_buildout(src.replace('/path/to/other/project', 'b')) >>> run_buildout(src.replace('/path/to/other/project', 'b'))
>>> eqs(ls('develop-eggs'), 'b.egg-link', 'a.egg-link') >>> eqs(ls('develop-eggs'), 'b.egg-link', 'a.egg-link')
......
...@@ -1166,7 +1166,7 @@ We also have to update our setup script:: ...@@ -1166,7 +1166,7 @@ We also have to update our setup script::
... debug = debug:Debug ... debug = debug:Debug
... environ = environ:Environ ... environ = environ:Environ
... ''') ... ''')
... setup(name="recipes", entry_points=entry_points) ... setup(name="recipes", entry_points=entry_points, py_modules=['debug', 'environ'])
... """) ... """)
We've rearranged the script a bit to make the entry points easier to We've rearranged the script a bit to make the entry points easier to
...@@ -2264,7 +2264,7 @@ recipe:: ...@@ -2264,7 +2264,7 @@ recipe::
... [zc.buildout.uninstall] ... [zc.buildout.uninstall]
... service = service:uninstall_service ... service = service:uninstall_service
... ''') ... ''')
... setup(name="recipes", entry_points=entry_points) ... setup(name="recipes", entry_points=entry_points, py_modules=['debug', 'environ', 'service'])
... """) ... """)
Here's how these recipes could be used in a buildout:: Here's how these recipes could be used in a buildout::
...@@ -2375,7 +2375,7 @@ the ``mkdir`` recipe:: ...@@ -2375,7 +2375,7 @@ the ``mkdir`` recipe::
... uninstall_service = service:uninstall_service ... uninstall_service = service:uninstall_service
... mkdir = backup:backup_directory ... mkdir = backup:backup_directory
... ''') ... ''')
... setup(name="recipes", entry_points=entry_points) ... setup(name="recipes", entry_points=entry_points, py_modules=['debug', 'environ', 'service', 'backup'])
... """) ... """)
Now we can use it with a ``mkdir`` part:: Now we can use it with a ``mkdir`` part::
...@@ -2439,7 +2439,7 @@ rest of the examples:: ...@@ -2439,7 +2439,7 @@ rest of the examples::
... mkdir = mkdir:Mkdir ... mkdir = mkdir:Mkdir
... debug = debug:Debug ... debug = debug:Debug
... ''') ... ''')
... setup(name="recipes", entry_points=entry_points) ... setup(name="recipes", entry_points=entry_points, py_modules=['debug', 'environ', 'service', 'backup'])
... """) ... """)
......
...@@ -1238,11 +1238,13 @@ def extensions_installed_as_eggs_work_in_offline_mode(): ...@@ -1238,11 +1238,13 @@ def extensions_installed_as_eggs_work_in_offline_mode():
''' '''
def changes_in_svn_or_CVS_dont_affect_sig(): def changes_in_svn_or_git_dont_affect_sig():
""" """
If we have a develop recipe, it's signature shouldn't be affected to If we have a develop recipe, it's signature shouldn't be affected to
changes in .git, .svn or CVS directories. changes in .git, .svn directories.
CVS directories used to work as well but do not anymore.
>>> mkdir('recipe') >>> mkdir('recipe')
>>> write('recipe', 'setup.py', >>> write('recipe', 'setup.py',
...@@ -1276,14 +1278,14 @@ changes in .git, .svn or CVS directories. ...@@ -1276,14 +1278,14 @@ changes in .git, .svn or CVS directories.
>>> mkdir('recipe', '.git') >>> mkdir('recipe', '.git')
>>> mkdir('recipe', '.svn') >>> mkdir('recipe', '.svn')
>>> mkdir('recipe', 'CVS') >>> # deprecated CVS mkdir('recipe', 'CVS')
>>> print_(system(join(sample_buildout, 'bin', 'buildout')), end='') >>> print_(system(join(sample_buildout, 'bin', 'buildout')), end='')
Develop: '/sample-buildout/recipe' Develop: '/sample-buildout/recipe'
Updating foo. Updating foo.
>>> write('recipe', '.git', 'x', '1') >>> write('recipe', '.git', 'x', '1')
>>> write('recipe', '.svn', 'x', '1') >>> write('recipe', '.svn', 'x', '1')
>>> write('recipe', 'CVS', 'x', '1') >>> # deprecated CVS write('recipe', 'CVS', 'x', '1')
>>> print_(system(join(sample_buildout, 'bin', 'buildout')), end='') >>> print_(system(join(sample_buildout, 'bin', 'buildout')), end='')
Develop: '/sample-buildout/recipe' Develop: '/sample-buildout/recipe'
...@@ -1640,6 +1642,7 @@ def whine_about_unused_options(): ...@@ -1640,6 +1642,7 @@ def whine_about_unused_options():
... """ ... """
... from setuptools import setup ... from setuptools import setup
... setup(name = "foo", ... setup(name = "foo",
... py_modules=['foo'],
... entry_points = {'zc.buildout': ['default = foo:Foo']}, ... entry_points = {'zc.buildout': ['default = foo:Foo']},
... ) ... )
... """) ... """)
...@@ -2039,8 +2042,9 @@ if sys.version_info > (2, 4): ...@@ -2039,8 +2042,9 @@ if sys.version_info > (2, 4):
>>> write('setup.py', >>> write('setup.py',
... ''' ... '''
... from setuptools import setup ... from setuptools import setup
... setup(name='zc.buildout.testexit', entry_points={ ... setup(name='zc.buildout.testexit',
... 'zc.buildout': ['default = testexitrecipe:x']}) ... py_modules=['testexitrecipe'],
... entry_points={'zc.buildout': ['default = testexitrecipe:x']})
... ''') ... ''')
>>> write('testexitrecipe.py', >>> write('testexitrecipe.py',
...@@ -2101,6 +2105,7 @@ def bug_59270_recipes_always_start_in_buildout_dir(): ...@@ -2101,6 +2105,7 @@ def bug_59270_recipes_always_start_in_buildout_dir():
... ''' ... '''
... from setuptools import setup ... from setuptools import setup
... setup(name='bad.test', ... setup(name='bad.test',
... py_modules=['bad_recipe'],
... entry_points={'zc.buildout': ['default=bad_recipe:Bad']},) ... entry_points={'zc.buildout': ['default=bad_recipe:Bad']},)
... ''') ... ''')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment