Commit b754f294 by Ashwin Nair Committed by Randy Döring

Add support for subdirectories in git urls

parent c9eadbd0
......@@ -535,6 +535,9 @@ class Executor:
else:
req = Path(package.source_url).resolve(strict=False)
if package.source_subdirectory:
req /= package.source_subdirectory
pyproject = PyProjectTOML(os.path.join(req, "pyproject.toml"))
if pyproject.is_poetry_project():
......@@ -762,6 +765,8 @@ class Executor:
"commit_id": package.source_resolved_reference,
},
}
if package.source_subdirectory:
reference["subdirectory"] = package.source_subdirectory
return reference
......
......@@ -7,3 +7,7 @@ license = "MIT"
[tool.poetry.dependencies]
python = "^3.7"
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
......@@ -7,3 +7,7 @@ license = "MIT"
[tool.poetry.dependencies]
python = "^3.7"
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
......@@ -7,3 +7,7 @@ license = "MIT"
[tool.poetry.dependencies]
python = "~2.7 || ^3.4"
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
......@@ -553,6 +553,40 @@ def test_executor_should_write_pep610_url_references_for_git(
)
def test_executor_should_write_pep610_url_references_for_git_with_subdirectories(
tmp_venv: VirtualEnv,
pool: Pool,
config: Config,
io: BufferedIO,
mock_file_downloads: None,
):
package = Package(
"two",
"2.0.0",
source_type="git",
source_reference="master",
source_resolved_reference="123456",
source_url="https://github.com/demo/subdirectories.git",
source_subdirectory="two",
)
executor = Executor(tmp_venv, pool, config, io)
executor.execute([Install(package)])
verify_installed_distribution(
tmp_venv,
package,
{
"vcs_info": {
"vcs": "git",
"requested_revision": "master",
"commit_id": "123456",
},
"url": package.source_url,
"subdirectory": package.source_subdirectory,
},
)
def test_executor_should_use_cached_link_and_hash(
tmp_venv: VirtualEnv,
pool: Pool,
......
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