Commit b9bac10a by Sébastien Eustace

Fix config command

parent 0f0558f9
......@@ -64,18 +64,20 @@ To remove a repository (repo is a short alias for repositories):
return unique_config_values
def initialize(self, i, o):
from poetry.utils._compat import decode
super(ConfigCommand, self).initialize(i, o)
# Create config file if it does not exist
if not self._config.file.exists():
self._config.file.parent.mkdir(parents=True, exist_ok=True)
with self._config.file.open("w") as f:
f.write(TEMPLATE)
with self._config.file.open("w", encoding="utf-8") as f:
f.write(decode(TEMPLATE))
if not self._auth_config.file.exists():
self._auth_config.file.parent.mkdir(parents=True, exist_ok=True)
with self._auth_config.file.open("w") as f:
f.write(AUTH_TEMPLATE)
with self._auth_config.file.open("w", encoding="utf-8") as f:
f.write(decode(AUTH_TEMPLATE))
def handle(self):
if self.option("list"):
......
......@@ -39,8 +39,9 @@ shellingham = "^1.1"
# The typing module is not in the stdlib in Python 2.7 and 3.4
typing = { version = "^3.6", python = "~2.7 || ~3.4" }
# Use pathlib2 and virtualenv for Python 2.7
pathlib2 = { version = "^2.3", python = "~2.7" }
# Use pathlib2 for Python 2.7 and 3.4
pathlib2 = { version = "^2.3", python = "~2.7 || ~3.4" }
# Use virtualenv for Python 2.7 since venv does not exist
virtualenv = { version = "^16.0", python = "~2.7" }
[tool.poetry.dev-dependencies]
......
......@@ -11,6 +11,8 @@ from poetry.utils.toml_file import TomlFile
@pytest.fixture
def config():
with tempfile.NamedTemporaryFile() as f:
f.close()
return Config(TomlFile(f.name))
......
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