cjolowicz / nox-poetry

Use Poetry inside Nox sessions
https://nox-poetry.readthedocs.io/
MIT License
166 stars 18 forks source link

Poetry.build fails on terminals with ansi capability like conemu #779

Open cycledriver opened 2 years ago

cycledriver commented 2 years ago

On terminals with ansi capability poetry build wraps the output artifact with ansi color escape codes. This get used for the install/unisntall call and that fails with an exception like below.

Which operating system and Python version are you using? This happens on windows 10/server 2012

Which version of this project are you using? 1.0.0

What did you do?

poetry run nox

What did you expect to see? Tests succeed

What did you see instead?

$ poetry run nox
nox > Running session pre-commit
nox > Session pre-commit skipped: Python interpreter 3.10 not found.
nox > Running session safety
nox > Session safety skipped: Python interpreter 3.10 not found.
nox > Running session mypy-3.10
nox > Session mypy-3.10 skipped: Python interpreter 3.10 not found.
nox > Running session mypy-3.9
nox > Creating virtual environment (virtualenv) using python3.9 in .nox\mypy-3-9
nox > poetry build --format=wheel
nox > Session mypy-3.9 raised exception OSError(22, 'The filename, directory name, or volume label syntax is incorrect')
Traceback (most recent call last):
  File "C:\Users\marc\github\nox-poetry\.venv\lib\site-packages\nox\sessions.py", line 695, in execute
    self.func(session)
  File "C:\Users\marc\github\nox-poetry\.venv\lib\site-packages\nox\_decorators.py", line 68, in __call__
    return self.func(*args, **kwargs)
  File "C:\Users\marc\github\nox-poetry\src\nox_poetry\sessions.py", line 43, in wrapper
    function(proxy, *_args, **_kwargs)
  File "C:\Users\marc\github\nox-poetry\noxfile.py", line 146, in mypy
    session.install(*deps)
  File "C:\Users\marc\github\nox-poetry\src\nox_poetry\sessions.py", line 292, in install
    return self.poetry.install(*args, **kwargs)
  File "C:\Users\marc\github\nox-poetry\src\nox_poetry\sessions.py", line 128, in install
    package = self.build_package()
  File "C:\Users\marc\github\nox-poetry\src\nox_poetry\sessions.py", line 250, in build_package
    url = wheel.resolve().as_uri()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib\pathlib.py", line 1215, in resolve
    s = self._flavour.resolve(self, strict=strict)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib\pathlib.py", line 215, in resolve
    s = self._ext_to_normal(_getfinalpathname(s))
OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: 'dist\\\x1b[32mnox_poetry-1.0.0-py3-none-any.whl\x1b[0m'
nox > Session mypy-3.9 failed.
cycledriver commented 2 years ago

Fix in https://github.com/cjolowicz/nox-poetry/pull/778