Commit aba6d170 by Sébastien Eustace

Add a new settings.virtualenvs.in-project setting

parent d99cb602
......@@ -6,6 +6,7 @@
- Added a new, more efficient dependency resolver.
- Added a new `init` command to generate a `pyproject.toml` file in existing projects.
- Added a new setting `settings.virtualenvs.in-project` to make `poetry` create the project's virtualenv inside the project's directory.
- Added the `--extras` and `--python` options to `debug:resolve` to help debug dependency resolution.
### Changed
......
......@@ -101,6 +101,7 @@ To remove a repository (repo is a short alias for repositories):
unique_config_values = {
'settings.virtualenvs.create': (boolean_validator, boolean_normalizer),
'settings.virtualenvs.in-project': (boolean_validator, boolean_normalizer),
'settings.pypi.fallback': (boolean_validator, boolean_normalizer),
}
......
......@@ -60,9 +60,15 @@ class Venv(object):
config = Config.create('config.toml')
create_venv = config.setting('settings.virtualenvs.create')
root_venv = config.setting('settings.virtualenvs.in-project')
venv_path = config.setting('settings.virtualenvs.path')
if venv_path is None:
if root_venv:
if not cwd:
raise RuntimeError('Unbale to determine the project\'s directory')
venv_path = (cwd / '.venv')
elif venv_path is None:
venv_path = Path(CACHE_DIR) / 'virtualenvs'
else:
venv_path = Path(venv_path)
......@@ -74,7 +80,11 @@ class Venv(object):
name, '.'.join([str(v) for v in sys.version_info[:2]])
)
venv = venv_path / name
if root_venv:
venv = venv_path
else:
venv = venv_path / name
if not venv.exists():
if create_venv is False:
io.writeln(
......
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