Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.buildout
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
6
Merge Requests
6
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
slapos.buildout
Commits
34fd0458
Commit
34fd0458
authored
Jul 01, 2015
by
Reinout van Rees
Browse files
Options
Browse Files
Download
Plain Diff
Pulled in lelit's pull request #172 to add some fixes and to merge with master
parents
c8c34766
46a34688
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
122 additions
and
9 deletions
+122
-9
CHANGES.rst
CHANGES.rst
+8
-0
DEVELOPERS.txt
DEVELOPERS.txt
+4
-0
src/zc/buildout/buildout.py
src/zc/buildout/buildout.py
+32
-6
src/zc/buildout/buildout.txt
src/zc/buildout/buildout.txt
+1
-1
src/zc/buildout/downloadcache.txt
src/zc/buildout/downloadcache.txt
+77
-2
No files found.
CHANGES.rst
View file @
34fd0458
...
...
@@ -40,6 +40,14 @@ Change History
configuration so that tests run much quicker so that buildout is easier and
quicker to develop.
- Treat ``download-cache`` and ``eggs-directory`` in a special manner:
a) they can be relative paths, relative to the location of the configuration
file that defines them
b) the can be in the form ``~/subdir``, with the usual convention that the
``~`` char means the home directory of the user executing the buildout
2.3.1 (2014-12-16)
==================
...
...
DEVELOPERS.txt
View file @
34fd0458
...
...
@@ -7,6 +7,10 @@ When you're developing buildout itself, you need to know two things:
will find your already-installed setuptools, leading to test differences
when setuptools' presence is explicitly tested.
- Also the presence of ``~/.buildout/default.cfg`` may interfere with the
tests so you may want to temporarily rename it so that it does not get in
the way.
- Don't bootstrap with ``python bootstrap/bootstrap.py`` but with ``python
dev.py``.
...
...
src/zc/buildout/buildout.py
View file @
34fd0458
...
...
@@ -253,6 +253,36 @@ class Buildout(DictMixin):
if
k
not
in
versions
))
# Absolutize some particular directory, handling also the ~/foo form,
# and considering the location of the configuration file that generated
# the setting as the base path, falling back to the main configuration
# file location
for
name
in
(
'download-cache'
,
'eggs-directory'
,
'extends-cache'
):
if
name
in
data
[
'buildout'
]:
origdir
,
src
=
data
[
'buildout'
][
name
]
if
'${'
in
origdir
:
continue
if
not
os
.
path
.
isabs
(
origdir
):
if
src
in
(
'DEFAULT_VALUE'
,
'COMPUTED_VALUE'
,
'COMMAND_LINE_VALUE'
):
if
'directory'
in
data
[
'buildout'
]:
basedir
=
data
[
'buildout'
][
'directory'
][
0
]
else
:
basedir
=
self
.
_buildout_dir
else
:
if
_isurl
(
src
):
raise
zc
.
buildout
.
UserError
(
'Setting "%s" to a non absolute location ("%s") '
'within a
\
n
'
'remote configuration file ("%s") is ambiguous.'
%
(
name
,
origdir
,
src
))
basedir
=
os
.
path
.
dirname
(
src
)
absdir
=
os
.
path
.
expanduser
(
origdir
)
if
not
os
.
path
.
isabs
(
absdir
):
absdir
=
os
.
path
.
join
(
basedir
,
absdir
)
data
[
'buildout'
][
name
]
=
(
absdir
,
src
)
self
.
_annotated
=
copy
.
deepcopy
(
data
)
self
.
_raw
=
_unannotate
(
data
)
self
.
_data
=
{}
...
...
@@ -351,12 +381,8 @@ class Buildout(DictMixin):
download_cache
=
options
.
get
(
'download-cache'
)
if
download_cache
:
download_cache
=
os
.
path
.
join
(
options
[
'directory'
],
download_cache
)
if
not
os
.
path
.
isdir
(
download_cache
):
raise
zc
.
buildout
.
UserError
(
'The specified download cache:
\
n
'
'%r
\
n
'
"Doesn't exist.
\
n
"
%
download_cache
)
if
not
os
.
path
.
exists
(
download_cache
):
os
.
mkdir
(
download_cache
)
download_cache
=
os
.
path
.
join
(
download_cache
,
'dist'
)
if
not
os
.
path
.
isdir
(
download_cache
):
os
.
mkdir
(
download_cache
)
...
...
src/zc/buildout/buildout.txt
View file @
34fd0458
...
...
@@ -810,7 +810,7 @@ COMMAND_LINE_VALUE).
DEFAULT_VALUE
directory= /sample-buildout
COMPUTED_VALUE
eggs-directory= eggs
eggs-directory=
/sample-buildout/
eggs
DEFAULT_VALUE
executable= ...
DEFAULT_VALUE
...
...
src/zc/buildout/downloadcache.txt
View file @
34fd0458
...
...
@@ -46,7 +46,7 @@ download:
<a href="index/">index/</a><br>
<a href="other-1.0-py2.4.egg">other-1.0-py2.4.egg</a><br>
</body></html>
We'll enable logging on the link server so we can see what's going on:
...
...
@@ -87,7 +87,7 @@ If we remove the installed eggs from eggs directory and re-run the buildout:
>>> for f in os.listdir('eggs'):
... if f.startswith('demo'):
... remove('eggs', f)
>>> print_(system(buildout), end='')
GET 200 /
Updating eggs.
...
...
@@ -139,3 +139,78 @@ install-from-cache option set to true:
Getting distribution for 'demoneeded'.
Got demoneeded 1.1.
Generated script '/sample-buildout/bin/demo'.
Auto-creation of download cache directory
-----------------------------------------
With zc.buildout version 2.2.2 or higher the cache directory is automatically
created, provided it is within an already existing directory::
>>> write('buildout.cfg',
... '''
... [buildout]
... parts =
... download-cache = %(cache)s/newdir
... ''' % globals())
>>> print_(system(buildout), end='')
Uninstalling eggs.
>>> ls(cache)
d dist
d newdir
Using relative paths
--------------------
You can use a relative path for ``download-cache`` (the same logic is applied to
``eggs-directory`` and to ``extends-cache`` too) and in such case it is considered
relative to the location of the configuration file that sets its value.
As an example, we create a ``base.cfg`` configuration in a different directory::
>>> basedir = tmpdir('basecfg')
>>> write(basedir, 'base.cfg',
... '''
... [buildout]
... download-cache = cache
... ''')
and a ``buildout.cfg`` that extends from there::
>>> write('buildout.cfg',
... '''
... [buildout]
... extends = %(basedir)s/base.cfg
... parts =
... ''' % globals())
>>> dummy = system(buildout)
>>> ls(basedir)
- base.cfg
d cache
Of course this cannot be used when the base configuration is not on the local
filesystem because it wouldn't make any sense having a remote cache::
>>> server_data = tmpdir('server_data')
>>> server_url = start_server(server_data)
>>> cd(sample_buildout)
>>> write(server_data, 'base.cfg', """\
... [buildout]
... download-cache = cache
... """)
>>> write('buildout.cfg',
... '''
... [buildout]
... extends = %(server_url)s/base.cfg
... parts =
... ''' % globals())
>>> print_(system(buildout), end='') # doctest: +ELLIPSIS
While:
Initializing.
Error: Setting "download-cache" to a non absolute location ("cache") within a
remote configuration file...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment