source: TI12-security/trunk/NDGSecurity/python/buildout/ndgsecurity/eggs/zc.buildout-1.2.1-py2.5.egg/zc/buildout/dependencylinks.txt @ 7081

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg-security/TI12-security/trunk/NDGSecurity/python/buildout/ndgsecurity/eggs/zc.buildout-1.2.1-py2.5.egg/zc/buildout/dependencylinks.txt@7081
Revision 7081, 6.0 KB checked in by pjkersha, 11 years ago (diff)
  • Property svn:keywords set to Id
Line 
1Dependency links
2----------------
3
4By default buildout will obey the setuptools dependency_links metadata
5when it looks for dependencies. This behavior can be controlled with
6the use-dependency-links buildout option.
7
8  [buildout]
9  ...
10  use-dependency-links = false
11
12The option defaults to true. If you set it to false, then dependency
13links are only looked for in the locations specified by find-links.
14
15Let's see this feature in action.  To begin, let's create a new egg
16repository. This repository uses the same sample eggs as the normal
17testing repository.
18
19    >>> link_server2 = start_server(sample_eggs)
20
21Turn on logging on this server so that we can see when eggs are pulled
22from it.
23   
24    >>> get(link_server2 + 'enable_server_logging')
25    GET 200 /enable_server_logging
26    ''
27
28Let's create a develop egg in our buildout that specifies
29dependency_links which point to the new server.
30
31    >>> mkdir(sample_buildout, 'depdemo')
32    >>> write(sample_buildout, 'depdemo', 'dependencydemo.py',
33    ...       'import eggrecipedemoneeded')
34    >>> write(sample_buildout, 'depdemo', 'setup.py',
35    ... '''from setuptools import setup; setup(
36    ...     name='depdemo', py_modules=['dependencydemo'],
37    ...     install_requires = 'demoneeded',
38    ...     dependency_links = ['%s'],
39    ...     zip_safe=True, version='1')
40    ... ''' % link_server2)
41
42Now let's configure the buildout to use the develop egg.
43
44    >>> write(sample_buildout, 'buildout.cfg',
45    ... '''
46    ... [buildout]
47    ... develop = depdemo
48    ... parts = eggs
49    ...
50    ... [eggs]
51    ... recipe = zc.recipe.egg:eggs
52    ... eggs = depdemo
53    ... ''')
54
55Now we can run the buildout.
56
57    >>> print system(buildout)
58    GET 200 /
59    GET 200 /demoneeded-1.2c1.zip
60    Develop: '/sample-buildout/depdemo'
61    Installing eggs.
62    Getting distribution for 'demoneeded'.
63    Got demoneeded 1.2c1.
64    <BLANKLINE>
65
66Notice that the egg was retrieved from the logging server.
67
68Now let's change the egg so that it doesn't specify dependency links.
69
70    >>> write(sample_buildout, 'depdemo', 'setup.py',
71    ... '''from setuptools import setup; setup(
72    ...     name='depdemo', py_modules=['dependencydemo'],
73    ...     install_requires = 'demoneeded',
74    ...     zip_safe=True, version='1')
75    ... ''')
76
77Now we'll remove the existing dependency egg, and rerunning the
78buildout to see where the egg comes from this time.
79
80    >>> from glob import glob
81    >>> from os.path import join
82    >>> def remove_demoneeded_egg():
83    ...     for egg in glob(join(sample_buildout, 'eggs', 'demoneeded*.egg')):
84    ...         remove(sample_buildout, 'eggs', egg)
85    >>> remove_demoneeded_egg()
86    >>> print system(buildout)
87    Develop: '/sample-buildout/depdemo'
88    Updating eggs.
89    Couldn't find index page for 'demoneeded' (maybe misspelled?)
90    Getting distribution for 'demoneeded'.
91    While:
92      Updating eggs.
93      Getting distribution for 'demoneeded'.
94    Error: Couldn't find a distribution for 'demoneeded'.
95    <BLANKLINE>
96
97Now it can't find the dependency since neither the buildout
98configuration nor setup specifies where to look.
99
100Let's change things so that the buildout configuration specifies where
101to look for eggs.
102
103    >>> write(sample_buildout, 'buildout.cfg',
104    ... '''
105    ... [buildout]
106    ... develop = depdemo
107    ... parts = eggs
108    ... find-links = %s
109    ...
110    ... [eggs]
111    ... recipe = zc.recipe.egg:eggs
112    ... eggs = depdemo
113    ... ''' % link_server)
114
115    >>> print system(buildout)
116    Develop: '/sample-buildout/depdemo'
117    Installing eggs.
118    Getting distribution for 'demoneeded'.
119    Got demoneeded 1.2c1.
120    <BLANKLINE>
121
122This time the dependency egg was found on the server without logging
123configured.
124
125Now let's change things once again so that both buildout and setup
126specify different places to look for the dependency egg.
127
128    >>> write(sample_buildout, 'depdemo', 'setup.py',
129    ... '''from setuptools import setup; setup(
130    ...     name='depdemo', py_modules=['dependencydemo'],
131    ...     install_requires = 'demoneeded',
132    ...     dependency_links = ['%s'],
133    ...     zip_safe=True, version='1')
134    ... '''  % link_server2)
135
136    >>> remove_demoneeded_egg()
137    >>> print system(buildout) #doctest: +ELLIPSIS
138    GET 200 /...
139    Develop: '/sample-buildout/depdemo'
140    Updating eggs.
141    Getting distribution for 'demoneeded'.
142    Got demoneeded 1.2c1.
143    <BLANKLINE>
144
145So when both setuptools and buildout specify places to search for
146eggs, the dependency_links takes precedence over find-links.
147
148There is a buildout option that you can specify to change this
149behavior. It is the use-dependency-links option. This option defaults
150to true. When you specify false for this option, buildout will ignore
151dependency_links and only look for eggs using find-links.
152
153Here is an example of using this option to disable dependency_links.
154
155    >>> write(sample_buildout, 'buildout.cfg',
156    ... '''
157    ... [buildout]
158    ... develop = depdemo
159    ... parts = eggs
160    ... find-links = %s
161    ... use-dependency-links = false
162    ...
163    ... [eggs]
164    ... recipe = zc.recipe.egg:eggs
165    ... eggs = depdemo
166    ... ''' % link_server)
167
168    >>> remove_demoneeded_egg()
169    >>> print system(buildout)
170    Develop: '/sample-buildout/depdemo'
171    Updating eggs.
172    Getting distribution for 'demoneeded'.
173    Got demoneeded 1.2c1.
174    <BLANKLINE>
175
176Notice that this time the egg isn't downloaded from the logging server.
177
178If we set the option to true, things return to the way they were
179before. The dependency's are looked for first in the logging server.
180
181    >>> write(sample_buildout, 'buildout.cfg',
182    ... '''
183    ... [buildout]
184    ... develop = depdemo
185    ... parts = eggs
186    ... find-links = %s
187    ... use-dependency-links = true
188    ...
189    ... [eggs]
190    ... recipe = zc.recipe.egg:eggs
191    ... eggs = depdemo
192    ... ''' % link_server)
193    >>> remove_demoneeded_egg()
194    >>> print system(buildout) #doctest: +ELLIPSIS
195    GET 200 /...
196    Develop: '/sample-buildout/depdemo'
197    Updating eggs.
198    Getting distribution for 'demoneeded'.
199    Got demoneeded 1.2c1.
200    <BLANKLINE>
Note: See TracBrowser for help on using the repository browser.