Commit 3f85f61e authored by Lele Gaifax's avatar Lele Gaifax

Automatically create the download-cache directory if missing

This fixes the issue #171.
parent 6e782873
...@@ -351,12 +351,8 @@ class Buildout(DictMixin): ...@@ -351,12 +351,8 @@ class Buildout(DictMixin):
download_cache = options.get('download-cache') download_cache = options.get('download-cache')
if download_cache: if download_cache:
download_cache = os.path.join(options['directory'], download_cache) download_cache = os.path.join(options['directory'], download_cache)
if not os.path.isdir(download_cache): if not os.path.exists(download_cache):
raise zc.buildout.UserError( os.mkdir(download_cache)
'The specified download cache:\n'
'%r\n'
"Doesn't exist.\n"
% download_cache)
download_cache = os.path.join(download_cache, 'dist') download_cache = os.path.join(download_cache, 'dist')
if not os.path.isdir(download_cache): if not os.path.isdir(download_cache):
os.mkdir(download_cache) os.mkdir(download_cache)
......
...@@ -139,3 +139,23 @@ install-from-cache option set to true: ...@@ -139,3 +139,23 @@ install-from-cache option set to true:
Getting distribution for 'demoneeded'. Getting distribution for 'demoneeded'.
Got demoneeded 1.1. Got demoneeded 1.1.
Generated script '/sample-buildout/bin/demo'. 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
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