Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
python-poetry
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
python-poetry
Commits
c9eadbd0
Commit
c9eadbd0
authored
May 30, 2022
by
Ashwin Nair
Committed by
Randy Döring
Aug 10, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add subdirectory refs to installed_repository
parent
4afa07df
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
0 deletions
+37
-0
src/poetry/repositories/installed_repository.py
+5
-0
tests/repositories/fixtures/installed/lib/python3.7/site-packages/git_pep_610_subdirectory-1.2.3.dist-info/METADATA
+6
-0
tests/repositories/fixtures/installed/lib/python3.7/site-packages/git_pep_610_subdirectory-1.2.3.dist-info/direct_url.json
+9
-0
tests/repositories/test_installed_repository.py
+17
-0
No files found.
src/poetry/repositories/installed_repository.py
View file @
c9eadbd0
...
...
@@ -124,6 +124,7 @@ class InstalledRepository(Repository):
source_url
=
None
source_reference
=
None
source_resolved_reference
=
None
source_subdirectory
=
None
if
is_standard_package
:
if
path
.
name
.
endswith
(
".dist-info"
):
paths
=
cls
.
get_package_paths
(
...
...
@@ -169,6 +170,7 @@ class InstalledRepository(Repository):
source_url
=
source_url
,
source_reference
=
source_reference
,
source_resolved_reference
=
source_resolved_reference
,
source_subdirectory
=
source_subdirectory
,
)
package
.
description
=
distribution
.
metadata
.
get
(
# type: ignore[attr-defined]
...
...
@@ -185,6 +187,7 @@ class InstalledRepository(Repository):
source_url
=
None
source_reference
=
None
source_resolved_reference
=
None
source_subdirectory
=
None
develop
=
False
url_reference
=
json
.
loads
(
...
...
@@ -213,6 +216,7 @@ class InstalledRepository(Repository):
source_reference
=
url_reference
[
"vcs_info"
]
.
get
(
"requested_revision"
,
source_resolved_reference
)
source_subdirectory
=
url_reference
.
get
(
"subdirectory"
)
package
=
Package
(
distribution
.
metadata
[
"name"
],
...
...
@@ -221,6 +225,7 @@ class InstalledRepository(Repository):
source_url
=
source_url
,
source_reference
=
source_reference
,
source_resolved_reference
=
source_resolved_reference
,
source_subdirectory
=
source_subdirectory
,
develop
=
develop
,
)
...
...
tests/repositories/fixtures/installed/lib/python3.7/site-packages/git_pep_610_subdirectory-1.2.3.dist-info/METADATA
0 → 100644
View file @
c9eadbd0
Metadata-Version: 2.1
Name: git-pep-610-subdirectory
Version: 1.2.3
Summary: Foo
License: MIT
Requires-Python: >=3.6
tests/repositories/fixtures/installed/lib/python3.7/site-packages/git_pep_610_subdirectory-1.2.3.dist-info/direct_url.json
0 → 100644
View file @
c9eadbd0
{
"url"
:
"https://github.com/demo/git-pep-610-subdirectory.git"
,
"vcs_info"
:
{
"vcs"
:
"git"
,
"requested_revision"
:
"my-branch"
,
"commit_id"
:
"123456"
},
"subdirectory"
:
"subdir"
}
tests/repositories/test_installed_repository.py
View file @
c9eadbd0
...
...
@@ -39,6 +39,9 @@ INSTALLED_RESULTS = [
metadata
.
PathDistribution
(
SITE_PURELIB
/
"git_pep_610_no_requested_version-1.2.3.dist-info"
),
metadata
.
PathDistribution
(
SITE_PURELIB
/
"git_pep_610_subdirectory-1.2.3.dist-info"
),
metadata
.
PathDistribution
(
SITE_PURELIB
/
"url_pep_610-1.2.3.dist-info"
),
metadata
.
PathDistribution
(
SITE_PURELIB
/
"file_pep_610-1.2.3.dist-info"
),
metadata
.
PathDistribution
(
SITE_PURELIB
/
"directory_pep_610-1.2.3.dist-info"
),
...
...
@@ -238,6 +241,20 @@ def test_load_pep_610_compliant_git_packages_no_requested_version(
assert
package
.
source_reference
==
package
.
source_resolved_reference
def
test_load_pep_610_compliant_git_packages_with_subdirectory
(
repository
:
InstalledRepository
,
):
package
=
get_package_from_repository
(
"git-pep-610-subdirectory"
,
repository
)
assert
package
is
not
None
assert
package
.
name
==
"git-pep-610-subdirectory"
assert
package
.
version
.
text
==
"1.2.3"
assert
package
.
source_type
==
"git"
assert
package
.
source_url
==
"https://github.com/demo/git-pep-610-subdirectory.git"
assert
package
.
source_reference
==
"my-branch"
assert
package
.
source_resolved_reference
==
"123456"
assert
package
.
source_subdirectory
==
"subdir"
def
test_load_pep_610_compliant_url_packages
(
repository
:
InstalledRepository
):
package
=
get_package_from_repository
(
"url-pep-610"
,
repository
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment