diff --git a/poetry.lock b/poetry.lock index af3d530c3..9142afa38 100644 --- a/poetry.lock +++ b/poetry.lock @@ -207,6 +207,7 @@ python-versions = "*" [package.dependencies] attrs = ">=17.4.0" +importlib-metadata = {version = "*", markers = "python_version < \"3.8\""} pyrsistent = ">=0.14.0" six = ">=1.11.0" @@ -323,7 +324,7 @@ six = "*" [[package]] name = "pytest" -version = "6.2.3" +version = "6.2.4" description = "pytest: simple powerful testing with Python" category = "dev" optional = false @@ -528,7 +529,7 @@ testing = ["pytest (>=4.6)", "pytest-checkdocs (>=1.2.3)", "pytest-flake8", "pyt [metadata] lock-version = "1.1" python-versions = "^3.6" -content-hash = "99ce5f04445fc917015b1703c90e88ad9695db1c466e775cad1caea231e1d35a" +content-hash = "b32f0571590c57077d864e4bca6adef82d6af64e7654215319d43a04a4d30128" [metadata.files] appdirs = [ @@ -701,8 +702,8 @@ pyrsistent = [ {file = "pyrsistent-0.16.1.tar.gz", hash = "sha256:aa2ae1c2e496f4d6777f869ea5de7166a8ccb9c2e06ebcf6c7ff1b670c98c5ef"}, ] pytest = [ - {file = "pytest-6.2.3-py3-none-any.whl", hash = "sha256:6ad9c7bdf517a808242b998ac20063c41532a570d088d77eec1ee12b0b5574bc"}, - {file = "pytest-6.2.3.tar.gz", hash = "sha256:671238a46e4df0f3498d1c3270e5deb9b32d25134c99b7d75370a68cfbe9b634"}, + {file = "pytest-6.2.4-py3-none-any.whl", hash = "sha256:91ef2131a9bd6be8f76f1f08eac5c5317221d6ad1e143ae03894b862e8976890"}, + {file = "pytest-6.2.4.tar.gz", hash = "sha256:50bcad0a0b9c5a72c8e4e7c9855a3ad496ca6a881a3641b4260605450772c54b"}, ] pytest-cov = [ {file = "pytest-cov-2.11.1.tar.gz", hash = "sha256:359952d9d39b9f822d9d29324483e7ba04a3a17dd7d05aa6beb7ea01e359e5f7"}, diff --git a/poetry/core/masonry/builders/builder.py b/poetry/core/masonry/builders/builder.py index 7aa2dfd7c..9797b1e10 100644 --- a/poetry/core/masonry/builders/builder.py +++ b/poetry/core/masonry/builders/builder.py @@ -285,50 +285,36 @@ def convert_entry_points(self) -> Dict[str, List[str]]: result = defaultdict(list) # Scripts -> Entry points - for name, ep in self._poetry.local_config.get("scripts", {}).items(): - extras: str = "" - module_path: str = "" + for name, specification in self._poetry.local_config.get("scripts", {}).items(): + if isinstance(specification, str): + # TODO: deprecate this in favour or reference + specification = {"reference": specification, "type": "console"} - # Currently we support 2 legacy and 1 new format: - # (legacy) my_script = 'my_package.main:entry' - # (legacy) my_script = { callable = 'my_package.main:entry' } - # (supported) my_script = { reference = 'my_package.main:entry', type = "console" } - - if isinstance(ep, str): + if "callable" in specification: warnings.warn( - "This way of declaring console scripts is deprecated and will be removed in a future version. " - 'Use reference = "{}", type = "console" instead.'.format(ep), + f"Use of callable in script specification ({name}) is deprecated. Use reference instead.", DeprecationWarning, ) - extras = "" - module_path = ep - elif isinstance(ep, dict) and ( - ep.get("type") == "console" - or "callable" in ep # Supporting both new and legacy format for now - ): - if "callable" in ep: - warnings.warn( - "Using the keyword callable is deprecated and will be removed in a future version. " - 'Use reference = "{}", type = "console" instead.'.format( - ep["callable"] - ), - DeprecationWarning, - ) + specification = { + "reference": specification["callable"], + "type": "console", + } - extras = "[{}]".format(", ".join(ep["extras"])) - module_path = ep.get("reference", ep.get("callable")) - else: + if specification.get("type") != "console": continue - result["console_scripts"].append( - "{} = {}{}".format(name, module_path, extras) - ) + extras = specification.get("extras", []) + extras = f"[{', '.join(extras)}]" if extras else "" + reference = specification.get("reference") + + if reference: + result["console_scripts"].append(f"{name} = {reference}{extras}") # Plugins -> entry points plugins = self._poetry.local_config.get("plugins", {}) for groupname, group in plugins.items(): - for name, ep in sorted(group.items()): - result[groupname].append("{} = {}".format(name, ep)) + for name, specification in sorted(group.items()): + result[groupname].append(f"{name} = {specification}") for groupname in result: result[groupname] = sorted(result[groupname]) @@ -338,21 +324,26 @@ def convert_entry_points(self) -> Dict[str, List[str]]: def convert_script_files(self) -> List[Path]: script_files: List[Path] = [] - for _, ep in self._poetry.local_config.get("scripts", {}).items(): - if isinstance(ep, dict) and ep.get("type") == "file": - source = ep["reference"] + for name, specification in self._poetry.local_config.get("scripts", {}).items(): + if isinstance(specification, dict) and specification.get("type") == "file": + source = specification["reference"] if Path(source).is_absolute(): raise RuntimeError( - "{} is an absolute path. Expected relative path.".format(source) + f"{source} in {name} is an absolute path. Expected relative path." ) abs_path = Path.joinpath(self._path, source) if not abs_path.exists(): - raise RuntimeError("{} file-script is not found.".format(abs_path)) + raise RuntimeError( + f"{abs_path} in script specification ({name}) is not found." + ) + if not abs_path.is_file(): - raise RuntimeError("{} file-script is not a file.".format(abs_path)) + raise RuntimeError( + f"{abs_path} in script specification ({name}) is not a file." + ) script_files.append(abs_path) diff --git a/poetry/core/masonry/builders/sdist.py b/poetry/core/masonry/builders/sdist.py index 752cbb700..df07bb293 100644 --- a/poetry/core/masonry/builders/sdist.py +++ b/poetry/core/masonry/builders/sdist.py @@ -191,7 +191,7 @@ def build_setup(self) -> bytes: script_files = self.convert_script_files() if script_files: rel_paths = [str(p.relative_to(self._path)) for p in script_files] - before.append('scripts = \\\n["{}"]\n'.format('", "'.join(rel_paths))) + before.append("scripts = \\\n{}\n".format(pformat(rel_paths))) extra.append("'scripts': scripts,") if self._package.python_versions != "*": diff --git a/tests/masonry/builders/fixtures/complete/bin/script1.sh b/tests/masonry/builders/fixtures/complete/bin/script.sh similarity index 100% rename from tests/masonry/builders/fixtures/complete/bin/script1.sh rename to tests/masonry/builders/fixtures/complete/bin/script.sh diff --git a/tests/masonry/builders/fixtures/complete/pyproject.toml b/tests/masonry/builders/fixtures/complete/pyproject.toml index 711005450..8b7d2c6b6 100644 --- a/tests/masonry/builders/fixtures/complete/pyproject.toml +++ b/tests/masonry/builders/fixtures/complete/pyproject.toml @@ -36,7 +36,7 @@ cachy = { version = "^0.2.0", extras = ["msgpack"] } [tool.poetry.dependencies.pendulum] version = "^1.4" -markers= 'python_version ~= "2.7" and sys_platform == "win32" or python_version in "3.4 3.5"' +markers = 'python_version ~= "2.7" and sys_platform == "win32" or python_version in "3.4 3.5"' optional = true [tool.poetry.dev-dependencies] @@ -48,9 +48,8 @@ time = ["pendulum"] [tool.poetry.scripts] my-script = "my_package:main" my-2nd-script = "my_package:main2" -extra-script-legacy = {callable = "my_package.extra_legacy:main", extras = ["time"]} -extra-script = {reference = "my_package.extra:main", extras = ["time"], type = "console"} -sh-script = {reference = "bin/script1.sh", type = "file"} +file-script = { reference = "bin/script.sh", type = "file" } +extra-script = { reference = "my_package.extra:main", extras = ["time"], type = "console" } [tool.poetry.urls] diff --git a/tests/masonry/builders/fixtures/missing_script_files/README.rst b/tests/masonry/builders/fixtures/missing_script_files/README.rst deleted file mode 100644 index f127696c5..000000000 --- a/tests/masonry/builders/fixtures/missing_script_files/README.rst +++ /dev/null @@ -1,2 +0,0 @@ -Missing Script Files -======== \ No newline at end of file diff --git a/tests/masonry/builders/fixtures/missing_script_files/missing_script_files/__init__.py b/tests/masonry/builders/fixtures/missing_script_files/missing_script_files/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/masonry/builders/fixtures/missing_script_files/pyproject.toml b/tests/masonry/builders/fixtures/missing_script_files/pyproject.toml deleted file mode 100644 index 94eee3fb1..000000000 --- a/tests/masonry/builders/fixtures/missing_script_files/pyproject.toml +++ /dev/null @@ -1,15 +0,0 @@ -[tool.poetry] -name = "missing-script-files" -version = "0.1" -description = "Some description." -authors = [ - "Sébastien Eustace " -] -readme = "README.rst" - -[tool.poetry.scripts] -missing_file = {reference = "not_existing_folder/not_existing_file.sh", type = "file"} - - -[tool.poetry.dependencies] -python = "3.6" \ No newline at end of file diff --git a/tests/masonry/builders/fixtures/script_callable_legacy_string/README.rst b/tests/masonry/builders/fixtures/script_callable_legacy_string/README.rst new file mode 100644 index 000000000..f7fe15470 --- /dev/null +++ b/tests/masonry/builders/fixtures/script_callable_legacy_string/README.rst @@ -0,0 +1,2 @@ +My Package +========== diff --git a/tests/masonry/builders/fixtures/script_callable_legacy_string/my_package/__init__.py b/tests/masonry/builders/fixtures/script_callable_legacy_string/my_package/__init__.py new file mode 100644 index 000000000..10aa336ce --- /dev/null +++ b/tests/masonry/builders/fixtures/script_callable_legacy_string/my_package/__init__.py @@ -0,0 +1 @@ +__version__ = "1.2.3" diff --git a/tests/masonry/builders/fixtures/script_callable_legacy_string/pyproject.toml b/tests/masonry/builders/fixtures/script_callable_legacy_string/pyproject.toml new file mode 100644 index 000000000..2c949a9d5 --- /dev/null +++ b/tests/masonry/builders/fixtures/script_callable_legacy_string/pyproject.toml @@ -0,0 +1,19 @@ +[tool.poetry] +name = "my-package" +version = "1.2.3" +description = "Some description." +authors = [ + "Poetry Maintainers " +] +license = "MIT" +readme = "README.rst" + +[tool.poetry.dependencies] +python = "^3.6" + +[tool.poetry.dev-dependencies] + +[tool.poetry.extras] + +[tool.poetry.scripts] +script-legacy = "my_package:main" diff --git a/tests/masonry/builders/fixtures/script_callable_legacy_table/README.rst b/tests/masonry/builders/fixtures/script_callable_legacy_table/README.rst new file mode 100644 index 000000000..f7fe15470 --- /dev/null +++ b/tests/masonry/builders/fixtures/script_callable_legacy_table/README.rst @@ -0,0 +1,2 @@ +My Package +========== diff --git a/tests/masonry/builders/fixtures/script_callable_legacy_table/my_package/__init__.py b/tests/masonry/builders/fixtures/script_callable_legacy_table/my_package/__init__.py new file mode 100644 index 000000000..10aa336ce --- /dev/null +++ b/tests/masonry/builders/fixtures/script_callable_legacy_table/my_package/__init__.py @@ -0,0 +1 @@ +__version__ = "1.2.3" diff --git a/tests/masonry/builders/fixtures/script_callable_legacy_table/pyproject.toml b/tests/masonry/builders/fixtures/script_callable_legacy_table/pyproject.toml new file mode 100644 index 000000000..cab2488f5 --- /dev/null +++ b/tests/masonry/builders/fixtures/script_callable_legacy_table/pyproject.toml @@ -0,0 +1,21 @@ +[tool.poetry] +name = "my-package" +version = "1.2.3" +description = "Some description." +authors = [ + "Poetry Maintainers " +] +license = "MIT" +readme = "README.rst" + +[tool.poetry.dependencies] +python = "^3.6" + +[tool.poetry.dev-dependencies] + +[tool.poetry.extras] +time = [] + +[tool.poetry.scripts] +script-legacy = { callable = "my_package.extra_legacy:main" } +extra-script-legacy = { callable = "my_package.extra_legacy:main", extras = ["time"] } diff --git a/tests/masonry/builders/fixtures/script_file_invalid_definition/README.rst b/tests/masonry/builders/fixtures/script_file_invalid_definition/README.rst deleted file mode 100644 index 4f2f20661..000000000 --- a/tests/masonry/builders/fixtures/script_file_invalid_definition/README.rst +++ /dev/null @@ -1,4 +0,0 @@ -Script File Invalid Definition -======== - -This is a use case where the user provides a pyproject.toml where the file script definition is wrong. \ No newline at end of file diff --git a/tests/masonry/builders/fixtures/script_file_invalid_definition/bin/script.sh b/tests/masonry/builders/fixtures/script_file_invalid_definition/bin/script.sh deleted file mode 100644 index 2fcee7113..000000000 --- a/tests/masonry/builders/fixtures/script_file_invalid_definition/bin/script.sh +++ /dev/null @@ -1 +0,0 @@ -echo "Hello World" \ No newline at end of file diff --git a/tests/masonry/builders/fixtures/script_file_invalid_definition/pyproject.toml b/tests/masonry/builders/fixtures/script_file_invalid_definition/pyproject.toml deleted file mode 100644 index 7f2601769..000000000 --- a/tests/masonry/builders/fixtures/script_file_invalid_definition/pyproject.toml +++ /dev/null @@ -1,15 +0,0 @@ -[tool.poetry] -name = "script_file_invalid_definition" -version = "0.1" -description = "Some description." -authors = [ - "Sébastien Eustace " -] -readme = "README.rst" - -[tool.poetry.scripts] -invalid_definition = {reference = "bin/script.sh", type = "ffiillee"} - - -[tool.poetry.dependencies] -python = "3.6" \ No newline at end of file diff --git a/tests/masonry/builders/fixtures/script_file_invalid_definition/script_file_invalid_definition/__init__.py b/tests/masonry/builders/fixtures/script_file_invalid_definition/script_file_invalid_definition/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/masonry/builders/fixtures/script_reference_console/README.rst b/tests/masonry/builders/fixtures/script_reference_console/README.rst new file mode 100644 index 000000000..f7fe15470 --- /dev/null +++ b/tests/masonry/builders/fixtures/script_reference_console/README.rst @@ -0,0 +1,2 @@ +My Package +========== diff --git a/tests/masonry/builders/fixtures/script_reference_console/my_package/__init__.py b/tests/masonry/builders/fixtures/script_reference_console/my_package/__init__.py new file mode 100644 index 000000000..10aa336ce --- /dev/null +++ b/tests/masonry/builders/fixtures/script_reference_console/my_package/__init__.py @@ -0,0 +1 @@ +__version__ = "1.2.3" diff --git a/tests/masonry/builders/fixtures/script_reference_console/pyproject.toml b/tests/masonry/builders/fixtures/script_reference_console/pyproject.toml new file mode 100644 index 000000000..a55800b67 --- /dev/null +++ b/tests/masonry/builders/fixtures/script_reference_console/pyproject.toml @@ -0,0 +1,21 @@ +[tool.poetry] +name = "my-package" +version = "1.2.3" +description = "Some description." +authors = [ + "Poetry Maintainers " +] +license = "MIT" +readme = "README.rst" + +[tool.poetry.dependencies] +python = "^3.6" + +[tool.poetry.dev-dependencies] + +[tool.poetry.extras] +time = [] + +[tool.poetry.scripts] +script = { reference = "my_package.extra:main", type = "console" } +extra-script = { reference = "my_package.extra:main", extras = ["time"], type = "console" } diff --git a/tests/masonry/builders/fixtures/script_reference_file/README.rst b/tests/masonry/builders/fixtures/script_reference_file/README.rst new file mode 100644 index 000000000..f7fe15470 --- /dev/null +++ b/tests/masonry/builders/fixtures/script_reference_file/README.rst @@ -0,0 +1,2 @@ +My Package +========== diff --git a/tests/masonry/builders/fixtures/script_reference_file/bin/script.sh b/tests/masonry/builders/fixtures/script_reference_file/bin/script.sh new file mode 100644 index 000000000..2a9686ac6 --- /dev/null +++ b/tests/masonry/builders/fixtures/script_reference_file/bin/script.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +echo "Hello World!" \ No newline at end of file diff --git a/tests/masonry/builders/fixtures/script_reference_file/my_package/__init__.py b/tests/masonry/builders/fixtures/script_reference_file/my_package/__init__.py new file mode 100644 index 000000000..10aa336ce --- /dev/null +++ b/tests/masonry/builders/fixtures/script_reference_file/my_package/__init__.py @@ -0,0 +1 @@ +__version__ = "1.2.3" diff --git a/tests/masonry/builders/fixtures/script_reference_file/pyproject.toml b/tests/masonry/builders/fixtures/script_reference_file/pyproject.toml new file mode 100644 index 000000000..973a94c14 --- /dev/null +++ b/tests/masonry/builders/fixtures/script_reference_file/pyproject.toml @@ -0,0 +1,19 @@ +[tool.poetry] +name = "my-package" +version = "1.2.3" +description = "Some description." +authors = [ + "Poetry Maintainers " +] +license = "MIT" +readme = "README.rst" + +[tool.poetry.dependencies] +python = "^3.6" + +[tool.poetry.dev-dependencies] + +[tool.poetry.extras] + +[tool.poetry.scripts] +sh-script = { reference = "bin/script.sh", type = "file" } diff --git a/tests/masonry/builders/fixtures/script_reference_file_invalid_definition/README.rst b/tests/masonry/builders/fixtures/script_reference_file_invalid_definition/README.rst new file mode 100644 index 000000000..f7fe15470 --- /dev/null +++ b/tests/masonry/builders/fixtures/script_reference_file_invalid_definition/README.rst @@ -0,0 +1,2 @@ +My Package +========== diff --git a/tests/masonry/builders/fixtures/script_reference_file_invalid_definition/bin/script.sh b/tests/masonry/builders/fixtures/script_reference_file_invalid_definition/bin/script.sh new file mode 100644 index 000000000..2a9686ac6 --- /dev/null +++ b/tests/masonry/builders/fixtures/script_reference_file_invalid_definition/bin/script.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +echo "Hello World!" \ No newline at end of file diff --git a/tests/masonry/builders/fixtures/script_reference_file_invalid_definition/my_package/__init__.py b/tests/masonry/builders/fixtures/script_reference_file_invalid_definition/my_package/__init__.py new file mode 100644 index 000000000..10aa336ce --- /dev/null +++ b/tests/masonry/builders/fixtures/script_reference_file_invalid_definition/my_package/__init__.py @@ -0,0 +1 @@ +__version__ = "1.2.3" diff --git a/tests/masonry/builders/fixtures/script_reference_file_invalid_definition/pyproject.toml b/tests/masonry/builders/fixtures/script_reference_file_invalid_definition/pyproject.toml new file mode 100644 index 000000000..7c6aa5627 --- /dev/null +++ b/tests/masonry/builders/fixtures/script_reference_file_invalid_definition/pyproject.toml @@ -0,0 +1,19 @@ +[tool.poetry] +name = "my-package" +version = "1.2.3" +description = "Some description." +authors = [ + "Poetry Maintainers " +] +license = "MIT" +readme = "README.rst" + +[tool.poetry.dependencies] +python = "^3.6" + +[tool.poetry.dev-dependencies] + +[tool.poetry.extras] + +[tool.poetry.scripts] +invalid_definition = { reference = "bin/script.sh", type = "ffiillee" } diff --git a/tests/masonry/builders/fixtures/script_reference_file_missing/README.rst b/tests/masonry/builders/fixtures/script_reference_file_missing/README.rst new file mode 100644 index 000000000..f7fe15470 --- /dev/null +++ b/tests/masonry/builders/fixtures/script_reference_file_missing/README.rst @@ -0,0 +1,2 @@ +My Package +========== diff --git a/tests/masonry/builders/fixtures/script_reference_file_missing/my_package/__init__.py b/tests/masonry/builders/fixtures/script_reference_file_missing/my_package/__init__.py new file mode 100644 index 000000000..10aa336ce --- /dev/null +++ b/tests/masonry/builders/fixtures/script_reference_file_missing/my_package/__init__.py @@ -0,0 +1 @@ +__version__ = "1.2.3" diff --git a/tests/masonry/builders/fixtures/script_reference_file_missing/pyproject.toml b/tests/masonry/builders/fixtures/script_reference_file_missing/pyproject.toml new file mode 100644 index 000000000..973a94c14 --- /dev/null +++ b/tests/masonry/builders/fixtures/script_reference_file_missing/pyproject.toml @@ -0,0 +1,19 @@ +[tool.poetry] +name = "my-package" +version = "1.2.3" +description = "Some description." +authors = [ + "Poetry Maintainers " +] +license = "MIT" +readme = "README.rst" + +[tool.poetry.dependencies] +python = "^3.6" + +[tool.poetry.dev-dependencies] + +[tool.poetry.extras] + +[tool.poetry.scripts] +sh-script = { reference = "bin/script.sh", type = "file" } diff --git a/tests/masonry/builders/test_builder.py b/tests/masonry/builders/test_builder.py index af634e5e4..590266421 100644 --- a/tests/masonry/builders/test_builder.py +++ b/tests/masonry/builders/test_builder.py @@ -159,23 +159,104 @@ def test_metadata_with_url_dependencies(): def test_missing_script_files_throws_error(): builder = Builder( Factory().create_poetry( - Path(__file__).parent / "fixtures" / "missing_script_files" + Path(__file__).parent / "fixtures" / "script_reference_file_missing" ) ) with pytest.raises(RuntimeError) as err: builder.convert_script_files() - assert "file-script is not found." in err.value.args[0] + assert "is not found." in err.value.args[0] def test_invalid_script_files_definition(): with pytest.raises(RuntimeError) as err: Builder( Factory().create_poetry( - Path(__file__).parent / "fixtures" / "script_file_invalid_definition" + Path(__file__).parent + / "fixtures" + / "script_reference_file_invalid_definition" ) ) assert "configuration is invalid" in err.value.args[0] assert "[scripts.invalid_definition]" in err.value.args[0] + + +@pytest.mark.parametrize( + "fixture", + [ + "script_callable_legacy_table", + ], +) +def test_entrypoint_scripts_legacy_warns(fixture): + with pytest.warns(DeprecationWarning): + Builder( + Factory().create_poetry(Path(__file__).parent / "fixtures" / fixture) + ).convert_entry_points() + + +@pytest.mark.parametrize( + "fixture, result", + [ + ( + "script_callable_legacy_table", + { + "console_scripts": [ + "extra-script-legacy = my_package.extra_legacy:main", + "script-legacy = my_package.extra_legacy:main", + ] + }, + ), + ( + "script_callable_legacy_string", + {"console_scripts": ["script-legacy = my_package:main"]}, + ), + ( + "script_reference_console", + { + "console_scripts": [ + "extra-script = my_package.extra:main[time]", + "script = my_package.extra:main", + ] + }, + ), + ( + "script_reference_file", + {}, + ), + ], +) +@pytest.mark.filterwarnings("ignore::DeprecationWarning") +def test_builder_convert_entry_points(fixture, result): + entry_points = Builder( + Factory().create_poetry(Path(__file__).parent / "fixtures" / fixture) + ).convert_entry_points() + assert entry_points == result + + +@pytest.mark.parametrize( + "fixture, result", + [ + ( + "script_callable_legacy_table", + [], + ), + ( + "script_callable_legacy_string", + [], + ), + ( + "script_reference_console", + [], + ), + ( + "script_reference_file", + [Path("bin") / "script.sh"], + ), + ], +) +def test_builder_convert_script_files(fixture, result): + project_root = Path(__file__).parent / "fixtures" / fixture + script_files = Builder(Factory().create_poetry(project_root)).convert_script_files() + assert [p.relative_to(project_root) for p in script_files] == result diff --git a/tests/masonry/builders/test_complete.py b/tests/masonry/builders/test_complete.py index 7b7a986c8..50e919552 100644 --- a/tests/masonry/builders/test_complete.py +++ b/tests/masonry/builders/test_complete.py @@ -223,10 +223,10 @@ def test_complete(): try: assert "my_package/sub_pgk1/extra_file.xml" not in zip.namelist() - assert "my-package-1.2.3.data/scripts/script1.sh" in zip.namelist() + assert "my-package-1.2.3.data/scripts/script.sh" in zip.namelist() assert ( "Hello World" - in zip.read("my-package-1.2.3.data/scripts/script1.sh").decode() + in zip.read("my-package-1.2.3.data/scripts/script.sh").decode() ) entry_points = zip.read("my_package-1.2.3.dist-info/entry_points.txt") @@ -236,7 +236,6 @@ def test_complete(): == """\ [console_scripts] extra-script=my_package.extra:main[time] -extra-script-legacy=my_package.extra_legacy:main[time] my-2nd-script=my_package:main2 my-script=my_package:main @@ -307,7 +306,6 @@ def test_complete(): "my_package/sub_pkg1/__init__.py", "my_package/sub_pkg2/__init__.py", "my_package/sub_pkg2/data2/data.json", - "my-package-1.2.3.data/scripts/script1.sh", "my_package-1.2.3.dist-info/entry_points.txt", "my_package-1.2.3.dist-info/LICENSE", "my_package-1.2.3.dist-info/WHEEL", @@ -345,7 +343,7 @@ def test_complete_no_vcs(): "my_package/sub_pkg1/__init__.py", "my_package/sub_pkg2/__init__.py", "my_package/sub_pkg2/data2/data.json", - "my-package-1.2.3.data/scripts/script1.sh", + "my-package-1.2.3.data/scripts/script.sh", "my_package/sub_pkg3/foo.py", "my_package-1.2.3.dist-info/entry_points.txt", "my_package-1.2.3.dist-info/LICENSE", @@ -364,7 +362,6 @@ def test_complete_no_vcs(): == """\ [console_scripts] extra-script=my_package.extra:main[time] -extra-script-legacy=my_package.extra_legacy:main[time] my-2nd-script=my_package:main2 my-script=my_package:main diff --git a/tests/masonry/builders/test_sdist.py b/tests/masonry/builders/test_sdist.py index 3bb8c0411..2b058d275 100644 --- a/tests/masonry/builders/test_sdist.py +++ b/tests/masonry/builders/test_sdist.py @@ -126,11 +126,11 @@ def test_make_setup(): assert ns["entry_points"] == { "console_scripts": [ "extra-script = my_package.extra:main[time]", - "extra-script-legacy = my_package.extra_legacy:main[time]", "my-2nd-script = my_package:main2", "my-script = my_package:main", ] } + assert ns["scripts"] == [str(Path("bin") / "script.sh")] assert ns["extras_require"] == { 'time:python_version ~= "2.7" and sys_platform == "win32" or python_version in "3.4 3.5"': [ "pendulum>=1.4,<2.0" @@ -171,7 +171,7 @@ def test_find_files_to_add(): [ Path("LICENSE"), Path("README.rst"), - Path("bin/script1.sh"), + Path("bin/script.sh"), Path("my_package/__init__.py"), Path("my_package/data1/test.json"), Path("my_package/sub_pkg1/__init__.py"), diff --git a/tests/masonry/test_api.py b/tests/masonry/test_api.py index 47afe6ae7..e0c73ab4c 100644 --- a/tests/masonry/test_api.py +++ b/tests/masonry/test_api.py @@ -133,7 +133,6 @@ def test_prepare_metadata_for_build_wheel(): entry_points = """\ [console_scripts] extra-script=my_package.extra:main[time] -extra-script-legacy=my_package.extra_legacy:main[time] my-2nd-script=my_package:main2 my-script=my_package:main