-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove package pyproject line if package is module (#8218)
This change only ensures that projects whose name needs to be normalized (e.g. projects with a dash) behave the same way as projects whose name is a valid Python module name.
- Loading branch information
Showing
3 changed files
with
9 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ | |
|
||
from cleo.testers.command_tester import CommandTester | ||
from packaging.utils import canonicalize_name | ||
from poetry.core.utils.helpers import module_name | ||
|
||
from poetry.console.application import Application | ||
from poetry.console.commands.init import InitCommand | ||
|
@@ -86,7 +87,6 @@ def init_basic_toml() -> str: | |
authors = ["Your Name <[email protected]>"] | ||
license = "MIT" | ||
readme = "README.md" | ||
packages = [{include = "my_package"}] | ||
[tool.poetry.dependencies] | ||
python = "~2.7 || ^3.6" | ||
|
@@ -169,7 +169,6 @@ def test_interactive_with_dependencies( | |
authors = ["Your Name <[email protected]>"] | ||
license = "MIT" | ||
readme = "README.md" | ||
packages = [{include = "my_package"}] | ||
[tool.poetry.dependencies] | ||
python = "~2.7 || ^3.6" | ||
|
@@ -218,7 +217,6 @@ def test_interactive_with_dependencies_and_no_selection( | |
authors = ["Your Name <[email protected]>"] | ||
license = "MIT" | ||
readme = "README.md" | ||
packages = [{include = "my_package"}] | ||
[tool.poetry.dependencies] | ||
python = "~2.7 || ^3.6" | ||
|
@@ -249,7 +247,6 @@ def test_empty_license(tester: CommandTester) -> None: | |
description = "" | ||
authors = ["Your Name <[email protected]>"] | ||
readme = "README.md" | ||
packages = [{{include = "my_package"}}] | ||
[tool.poetry.dependencies] | ||
python = "^{python}" | ||
|
@@ -290,7 +287,6 @@ def test_interactive_with_git_dependencies( | |
authors = ["Your Name <[email protected]>"] | ||
license = "MIT" | ||
readme = "README.md" | ||
packages = [{include = "my_package"}] | ||
[tool.poetry.dependencies] | ||
python = "~2.7 || ^3.6" | ||
|
@@ -383,7 +379,6 @@ def test_interactive_with_git_dependencies_with_reference( | |
authors = ["Your Name <[email protected]>"] | ||
license = "MIT" | ||
readme = "README.md" | ||
packages = [{include = "my_package"}] | ||
[tool.poetry.dependencies] | ||
python = "~2.7 || ^3.6" | ||
|
@@ -429,7 +424,6 @@ def test_interactive_with_git_dependencies_and_other_name( | |
authors = ["Your Name <[email protected]>"] | ||
license = "MIT" | ||
readme = "README.md" | ||
packages = [{include = "my_package"}] | ||
[tool.poetry.dependencies] | ||
python = "~2.7 || ^3.6" | ||
|
@@ -481,7 +475,6 @@ def test_interactive_with_directory_dependency( | |
authors = ["Your Name <[email protected]>"] | ||
license = "MIT" | ||
readme = "README.md" | ||
packages = [{include = "my_package"}] | ||
[tool.poetry.dependencies] | ||
python = "~2.7 || ^3.6" | ||
|
@@ -532,7 +525,6 @@ def test_interactive_with_directory_dependency_and_other_name( | |
authors = ["Your Name <[email protected]>"] | ||
license = "MIT" | ||
readme = "README.md" | ||
packages = [{include = "my_package"}] | ||
[tool.poetry.dependencies] | ||
python = "~2.7 || ^3.6" | ||
|
@@ -584,7 +576,6 @@ def test_interactive_with_file_dependency( | |
authors = ["Your Name <[email protected]>"] | ||
license = "MIT" | ||
readme = "README.md" | ||
packages = [{include = "my_package"}] | ||
[tool.poetry.dependencies] | ||
python = "~2.7 || ^3.6" | ||
|
@@ -629,7 +620,6 @@ def test_interactive_with_wrong_dependency_inputs( | |
authors = ["Your Name <[email protected]>"] | ||
license = "MIT" | ||
readme = "README.md" | ||
packages = [{include = "my_package"}] | ||
[tool.poetry.dependencies] | ||
python = "^3.8" | ||
|
@@ -664,7 +654,6 @@ def test_python_option(tester: CommandTester) -> None: | |
authors = ["Your Name <[email protected]>"] | ||
license = "MIT" | ||
readme = "README.md" | ||
packages = [{include = "my_package"}] | ||
[tool.poetry.dependencies] | ||
python = "~2.7 || ^3.6" | ||
|
@@ -697,7 +686,6 @@ def test_predefined_dependency(tester: CommandTester, repo: TestRepository) -> N | |
authors = ["Your Name <[email protected]>"] | ||
license = "MIT" | ||
readme = "README.md" | ||
packages = [{include = "my_package"}] | ||
[tool.poetry.dependencies] | ||
python = "~2.7 || ^3.6" | ||
|
@@ -739,7 +727,6 @@ def test_predefined_and_interactive_dependencies( | |
authors = ["Your Name <[email protected]>"] | ||
license = "MIT" | ||
readme = "README.md" | ||
packages = [{include = "my_package"}] | ||
[tool.poetry.dependencies] | ||
python = "~2.7 || ^3.6" | ||
|
@@ -775,7 +762,6 @@ def test_predefined_dev_dependency(tester: CommandTester, repo: TestRepository) | |
authors = ["Your Name <[email protected]>"] | ||
license = "MIT" | ||
readme = "README.md" | ||
packages = [{include = "my_package"}] | ||
[tool.poetry.dependencies] | ||
python = "~2.7 || ^3.6" | ||
|
@@ -819,7 +805,6 @@ def test_predefined_and_interactive_dev_dependencies( | |
authors = ["Your Name <[email protected]>"] | ||
license = "MIT" | ||
readme = "README.md" | ||
packages = [{include = "my_package"}] | ||
[tool.poetry.dependencies] | ||
python = "~2.7 || ^3.6" | ||
|
@@ -866,7 +851,6 @@ def test_predefined_all_options(tester: CommandTester, repo: TestRepository) -> | |
authors = ["Foo Bar <[email protected]>"] | ||
license = "MIT" | ||
readme = "README.md" | ||
packages = [{include = "my_package"}] | ||
[tool.poetry.dependencies] | ||
python = "^3.8" | ||
|
@@ -959,7 +943,6 @@ def test_init_non_interactive_existing_pyproject_add_dependency( | |
description = "" | ||
authors = ["Your Name <[email protected]>"] | ||
readme = "README.md" | ||
packages = [{include = "my_package"}] | ||
[tool.poetry.dependencies] | ||
python = "^3.6" | ||
|
@@ -1043,7 +1026,9 @@ def test_package_include( | |
), | ||
) | ||
|
||
packages = "" if include is None else f'packages = [{{include = "{include}"}}]\n' | ||
packages = "" | ||
if include and module_name(package_name) != include: | ||
packages = f'packages = [{{include = "{include}"}}]\n' | ||
|
||
expected = ( | ||
f"[tool.poetry]\n" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters