Commit a7ffc82a authored by Xavier Thompson's avatar Xavier Thompson

[tool] Add dev.py --isolate option

This creates a environment for tests that is isolated from the current
environment (as long as there are no .egg-link to e.g. site-packages).
parent 09a1a171
......@@ -222,18 +222,40 @@ def main(args):
except ImportError:
install_coverage()
######################################################################
bin_buildout = os.path.join('bin', 'buildout')
version_args = [
'versions:setuptools=' + (args.setuptools_version or ''),
'versions:pip=' + (args.pip_version or ''),
]
if args.isolate:
print('')
print('Bootstrap isolated buildout')
print('')
if subprocess.call(
[bin_buildout, 'buildout:extra-paths='] +
version_args +
['bootstrap']
):
raise RuntimeError("failed to bootstrap isolated buildout")
######################################################################
print('')
print('Run buildout')
print('')
bin_buildout = os.path.join('bin', 'buildout')
if sys.platform.startswith('java'):
# Jython needs the script to be called twice via sys.executable
assert subprocess.Popen([sys.executable, bin_buildout, '-N']).wait() == 0
assert subprocess.Popen(
[sys.executable, bin_buildout, '-N'] + version_args
).wait() == 0
sys.stdout.flush()
sys.exit(subprocess.Popen(bin_buildout).wait())
sys.exit(subprocess.Popen(
[bin_buildout, '-N'] + version_args
).wait())
def parse_args():
import argparse
......@@ -247,6 +269,9 @@ def parse_args():
parser.add_argument('--no-clean',
help='not used in the code, find out if still needed in Makefile',
action='store_const', const='NO_CLEAN')
parser.add_argument('--isolate',
help='isolate from environment',
action='store_true', default=False)
args = parser.parse_args()
return args
......
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