Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] script entry point import path #3214

Merged
merged 1 commit into from
Oct 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion poetry/masonry/builders/editable.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def _add_scripts(self):
for script in scripts:
name, script = script.split(" = ")
module, callable_ = script.split(":")
callable_holder = callable_.rsplit(".", 1)[0]
callable_holder = callable_.split(".", 1)[0]

script_file = scripts_path.joinpath(name)
self._debug(
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/simple_project/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ python = "~2.7 || ^3.4"
[tool.poetry.scripts]
foo = "foo:bar"
baz = "bar:baz.boom.bim"
fox = "fuz.foo:bar.baz"
16 changes: 14 additions & 2 deletions tests/masonry/builders/test_editable_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def test_builder_installs_proper_files_for_standard_packages(simple_poetry, tmp_

assert "poetry" == dist_info.joinpath("INSTALLER").read_text()
assert (
"[console_scripts]\nbaz=bar:baz.boom.bim\nfoo=foo:bar\n\n"
"[console_scripts]\nbaz=bar:baz.boom.bim\nfoo=foo:bar\nfox=fuz.foo:bar.baz\n\n"
== dist_info.joinpath("entry_points.txt").read_text()
)

Expand Down Expand Up @@ -140,7 +140,7 @@ def test_builder_installs_proper_files_for_standard_packages(simple_poetry, tmp_

baz_script = """\
#!{python}
from bar import baz.boom
from bar import baz

if __name__ == '__main__':
baz.boom.bim()
Expand All @@ -162,6 +162,18 @@ def test_builder_installs_proper_files_for_standard_packages(simple_poetry, tmp_

assert foo_script == tmp_venv._bin_dir.joinpath("foo").read_text()

fox_script = """\
#!{python}
from fuz.foo import bar

if __name__ == '__main__':
bar.baz()
""".format(
python=tmp_venv._bin("python")
)

assert fox_script == tmp_venv._bin_dir.joinpath("fox").read_text()


def test_builder_falls_back_on_setup_and_pip_for_packages_with_build_scripts(
extended_poetry,
Expand Down