-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Labels
kind/bugSomething isn't working as expectedSomething isn't working as expectedstatus/triageThis issue needs to be triagedThis issue needs to be triaged
Description
Description
poetry build -C <path> does not work if path is relative.
Example:
mkdir foobar
cd foobar
poetry init
mkdir foobar
touch README.md foobar/script.py
cd ..
poetry build -C foobar
Gives:
Building foobar (0.1.0)
- Building sdist
[Errno 2] No such file or directory: '/home/angivare/foobar/foobar/foobar/script.py'
Workarounds
Use absolute path, or just cd and do not use -C
Poetry Installation Method
pip
Operating System
Ubuntu 22.04
Poetry Version
1.8.4
Poetry Configuration
cache-dir = "/home/angivare/.cache/pypoetry"
experimental.system-git-client = false
installer.max-workers = null
installer.modern-installation = true
installer.no-binary = null
installer.parallel = true
keyring.enabled = true
solver.lazy-wheel = true
virtualenvs.create = true
virtualenvs.in-project = null
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.no-setuptools = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}/virtualenvs" # /home/angivare/.cache/pypoetry/virtualenvs
virtualenvs.prefer-active-python = false
virtualenvs.prompt = "{project_name}-py{python_version}"
warnings.export = truePython Sysconfig
No response
Example pyproject.toml
No response
Poetry Runtime Logs
angivare@angivare:~$ poetry build -C foobar -vvv
Loading configuration file /home/angivare/.config/pypoetry/config.toml
Loading configuration file /home/angivare/.config/pypoetry/auth.toml
Using virtualenv: /home/angivare/.pyenv/versions/3.12.3/envs/poetry-debug
Building foobar (0.1.0)
- Building sdist
- Adding: foobar/foobar/script.py
- Adding: README.md
- Adding: pyproject.toml
Stack trace:
10 ~/.pyenv/versions/3.12.3/envs/poetry-debug/lib/python3.12/site-packages/cleo/application.py:327 in run
325│
326│ try:
→ 327│ exit_code = self._run(io)
328│ except BrokenPipeError:
329│ # If we are piped to another process, it may close early and send a
9 ~/.pyenv/versions/3.12.3/envs/poetry-debug/lib/python3.12/site-packages/poetry/console/application.py:190 in _run
188│ self._load_plugins(io)
189│
→ 190│ exit_code: int = super()._run(io)
191│ return exit_code
192│
8 ~/.pyenv/versions/3.12.3/envs/poetry-debug/lib/python3.12/site-packages/cleo/application.py:431 in _run
429│ io.input.interactive(interactive)
430│
→ 431│ exit_code = self._run_command(command, io)
432│ self._running_command = None
433│
7 ~/.pyenv/versions/3.12.3/envs/poetry-debug/lib/python3.12/site-packages/cleo/application.py:473 in _run_command
471│
472│ if error is not None:
→ 473│ raise error
474│
475│ return terminate_event.exit_code
6 ~/.pyenv/versions/3.12.3/envs/poetry-debug/lib/python3.12/site-packages/cleo/application.py:457 in _run_command
455│
456│ if command_event.command_should_run():
→ 457│ exit_code = command.run(io)
458│ else:
459│ exit_code = ConsoleCommandEvent.RETURN_CODE_DISABLED
5 ~/.pyenv/versions/3.12.3/envs/poetry-debug/lib/python3.12/site-packages/cleo/commands/base_command.py:117 in run
115│ io.input.validate()
116│
→ 117│ return self.execute(io) or 0
118│
119│ def merge_application_definition(self, merge_args: bool = True) -> None:
4 ~/.pyenv/versions/3.12.3/envs/poetry-debug/lib/python3.12/site-packages/cleo/commands/command.py:61 in execute
59│
60│ try:
→ 61│ return self.handle()
62│ except KeyboardInterrupt:
63│ return 1
3 ~/.pyenv/versions/3.12.3/envs/poetry-debug/lib/python3.12/site-packages/poetry/console/commands/build.py:66 in handle
64│ if not dist_dir.is_absolute():
65│ dist_dir = self.poetry.pyproject_path.parent / dist_dir
→ 66│ self._build(fmt, executable=env.python, target_dir=dist_dir)
67│
68│ return 0
2 ~/.pyenv/versions/3.12.3/envs/poetry-debug/lib/python3.12/site-packages/poetry/console/commands/build.py:49 in _build
47│
48│ for builder in builders:
→ 49│ builder(self.poetry, executable=executable).build(target_dir)
50│
51│ def handle(self) -> int:
1 ~/.pyenv/versions/3.12.3/envs/poetry-debug/lib/python3.12/site-packages/poetry/core/masonry/builders/sdist.py:83 in build
81│
82│ for file in sorted(files_to_add, key=lambda x: x.relative_to_source_root()):
→ 83│ tar_info = tar.gettarinfo(
84│ str(file.path),
85│ arcname=pjoin(tar_dir, str(file.relative_to_source_root())),
FileNotFoundError
[Errno 2] No such file or directory: '/home/angivare/foobar/foobar/foobar/script.py'
at ~/.pyenv/versions/3.12.3/lib/python3.12/tarfile.py:2037 in gettarinfo
2033│
2034│ # Use os.stat or os.lstat, depending on if symlinks shall be resolved.
2035│ if fileobj is None:
2036│ if not self.dereference:
→ 2037│ statres = os.lstat(name)
2038│ else:
2039│ statres = os.stat(name)
2040│ else:
2041│ statres = os.fstat(fileobj.fileno())Metadata
Metadata
Assignees
Labels
kind/bugSomething isn't working as expectedSomething isn't working as expectedstatus/triageThis issue needs to be triagedThis issue needs to be triaged