Commit 4a6e9e57 authored by Reinout van Rees's avatar Reinout van Rees

Merge pull request #260 from guyzmo/gh-259

Changed os.mkdir to os.makedirs to make it support nested directory creation
parents e9caa1fb 55687e96
...@@ -4,7 +4,8 @@ Change History ...@@ -4,7 +4,8 @@ Change History
2.4.3 (unreleased) 2.4.3 (unreleased)
================== ==================
- Nothing changed yet. - Added nested directory creation support
[guyzmo]
2.4.2 (2015-08-26) 2.4.2 (2015-08-26)
......
...@@ -392,10 +392,8 @@ class Buildout(DictMixin): ...@@ -392,10 +392,8 @@ class Buildout(DictMixin):
if cache: if cache:
cache = os.path.join(options['directory'], cache) cache = os.path.join(options['directory'], cache)
if not os.path.exists(cache): if not os.path.exists(cache):
# Note: os.mkdir only creates the dir if the parent
# exists. This is the way we want it.
self._logger.info('Creating directory %r.', cache) self._logger.info('Creating directory %r.', cache)
os.mkdir(cache) os.makedirs(cache)
if download_cache: if download_cache:
# Actually, we want to use a subdirectory in there called 'dist'. # Actually, we want to use a subdirectory in there called 'dist'.
......
...@@ -144,7 +144,7 @@ Auto-creation of download cache directory ...@@ -144,7 +144,7 @@ Auto-creation of download cache directory
----------------------------------------- -----------------------------------------
With zc.buildout version 2.2.2 or higher the cache directory is automatically With zc.buildout version 2.2.2 or higher the cache directory is automatically
created, provided it is within an already existing directory:: created::
>>> write('buildout.cfg', >>> write('buildout.cfg',
... ''' ... '''
...@@ -215,3 +215,30 @@ filesystem because it wouldn't make any sense having a remote cache:: ...@@ -215,3 +215,30 @@ filesystem because it wouldn't make any sense having a remote cache::
Initializing. Initializing.
Error: Setting "download-cache" to a non absolute location ("cache") within a Error: Setting "download-cache" to a non absolute location ("cache") within a
remote configuration file... remote configuration file...
Though, you can create the ``download-cache`` within a nested directory, so that you can
group all your generated directories (like ``eggs-directory`` or ``extends-cache`` too)
within a single directory:
>>> test_nested = tmpdir('test_nested')
>>> cd(test_nested)
>>> write('buildout.cfg',
... '''
... [buildout]
... download-cache = ${buildout:directory}/var/cache
... eggs-directory = ${buildout:directory}/var/eggs
... parts-directory = ${buildout:directory}/var/parts
... develop-eggs-directory = ${buildout:directory}/var/develop-eggs
... ''')
>>> dummy = system(buildout)
>>> ls(test_nested)
d bin
- buildout.cfg
d var
>>> ls(os.path.join(test_nested, 'var'))
d cache
d develop-eggs
d eggs
d parts
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