Commit 9c085a58 by Arjan Keeman Committed by finswimmer

Ensure editable builder generate valid scripts

parent cb34c3d0
...@@ -139,7 +139,7 @@ class EditableBuilder(Builder): ...@@ -139,7 +139,7 @@ class EditableBuilder(Builder):
for script in scripts: for script in scripts:
name, script = script.split(" = ") name, script = script.split(" = ")
module, callable_ = script.split(":") module, callable_ = script.split(":")
callable_holder = callable_.rsplit(".", 1)[0] callable_holder = callable_.split(".", 1)[0]
script_file = scripts_path.joinpath(name) script_file = scripts_path.joinpath(name)
self._debug( self._debug(
......
...@@ -27,3 +27,4 @@ python = "~2.7 || ^3.4" ...@@ -27,3 +27,4 @@ python = "~2.7 || ^3.4"
[tool.poetry.scripts] [tool.poetry.scripts]
foo = "foo:bar" foo = "foo:bar"
baz = "bar:baz.boom.bim" baz = "bar:baz.boom.bim"
fox = "fuz.foo:bar.baz"
...@@ -92,7 +92,7 @@ def test_builder_installs_proper_files_for_standard_packages(simple_poetry, tmp_ ...@@ -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 "poetry" == dist_info.joinpath("INSTALLER").read_text()
assert ( 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() == dist_info.joinpath("entry_points.txt").read_text()
) )
...@@ -140,7 +140,7 @@ My Package ...@@ -140,7 +140,7 @@ My Package
baz_script = """\ baz_script = """\
#!{python} #!{python}
from bar import baz.boom from bar import baz
if __name__ == '__main__': if __name__ == '__main__':
baz.boom.bim() baz.boom.bim()
...@@ -162,6 +162,18 @@ if __name__ == '__main__': ...@@ -162,6 +162,18 @@ if __name__ == '__main__':
assert foo_script == tmp_venv._bin_dir.joinpath("foo").read_text() 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( def test_builder_falls_back_on_setup_and_pip_for_packages_with_build_scripts(
extended_poetry, extended_poetry,
......
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