Commit 536d5a13 authored by Marius Gedminas's avatar Marius Gedminas Committed by Domen Kožar

merge

parent e65b7bfb
......@@ -440,6 +440,10 @@ the mkdir recipe to support multiple paths:
... pass
... """)
..
>>> clean_up_pyc(sample_buildout, 'recipes', 'mkdir.py')
If there is an error creating a path, the install method will exit and
leave previously created paths in place:
......@@ -549,6 +553,10 @@ Let's fix the recipe:
... pass
... """)
..
>>> clean_up_pyc(sample_buildout, 'recipes', 'mkdir.py')
And put back the typo:
>>> write(sample_buildout, 'buildout.cfg',
......@@ -578,11 +586,6 @@ When we rerun the buildout:
...
OSError: [Errno 17] File exists: '/sample-buildout/bin'
.. Wait for the file to really disappear. My linux is weird.
>>> wait_until("foo goes away", lambda : not os.path.exists('foo'),
... timeout=200)
we get the same error, but we don't get the directory left behind:
>>> os.path.exists('foo')
......@@ -636,7 +639,7 @@ recipe:
..
>>> remove(sample_buildout, 'recipes', 'mkdir.pyc')
>>> clean_up_pyc(sample_buildout, 'recipes', 'mkdir.py')
We returned by calling created, taking advantage of the fact that it
returns the registered paths. We did this for illustrative purposes.
......
......@@ -99,6 +99,17 @@ def write(dir, *args):
fsync(f.fileno())
f.close()
def clean_up_pyc(*path):
base, filename = os.path.join(*path[:-1]), path[-1]
if filename.endswith('.py'):
filename += 'c' # .py -> .pyc
for path in (
os.path.join(base, filename),
os.path.join(base, '__pycache__', filename),
):
if os.path.exists(path):
remove(path)
## FIXME - check for other platforms
MUST_CLOSE_FDS = not sys.platform.startswith('win')
......@@ -432,7 +443,8 @@ def buildoutSetUp(test):
start_server = start_server,
buildout = os.path.join(sample, 'bin', 'buildout'),
wait_until = wait_until,
make_py = make_py
make_py = make_py,
clean_up_pyc = clean_up_pyc,
))
def buildoutTearDown(test):
......
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