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
cc8f59a3
Commit
cc8f59a3
authored
Sep 25, 2020
by
Sébastien Eustace
Committed by
Arun Babu Neelicattu
Sep 25, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix the show command
parent
600c2285
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
157 additions
and
52 deletions
+157
-52
poetry/console/commands/show.py
+26
-13
poetry/mixology/version_solver.py
+10
-5
poetry/puzzle/provider.py
+5
-0
poetry/puzzle/solver.py
+5
-3
poetry/repositories/repository.py
+5
-2
tests/console/commands/test_show.py
+91
-14
tests/fixtures/project_with_local_dependencies/pyproject.toml
+1
-1
tests/fixtures/project_with_setup/project_with_setup.egg-info/PKG-INFO
+1
-1
tests/fixtures/project_with_setup/project_with_setup.egg-info/SOURCES.txt
+0
-0
tests/fixtures/project_with_setup/project_with_setup.egg-info/dependency_links.txt
+0
-0
tests/fixtures/project_with_setup/project_with_setup.egg-info/requires.txt
+0
-0
tests/fixtures/project_with_setup/project_with_setup.egg-info/top_level.txt
+0
-0
tests/fixtures/project_with_setup/setup.py
+1
-1
tests/installation/fixtures/with-directory-dependency-setuptools.test
+10
-10
tests/installation/test_installer.py
+1
-1
tests/installation/test_installer_old.py
+1
-1
No files found.
poetry/console/commands/show.py
View file @
cc8f59a3
...
...
@@ -35,8 +35,11 @@ lists all packages available."""
def
handle
(
self
):
from
clikit.utils.terminal
import
Terminal
from
poetry.core.semver
import
Version
from
poetry.io.null_io
import
NullIO
from
poetry.puzzle.solver
import
Solver
from
poetry.repositories.installed_repository
import
InstalledRepository
from
poetry.repositories.pool
import
Pool
from
poetry.repositories.repository
import
Repository
from
poetry.utils.helpers
import
get_package_version_display_string
package
=
self
.
argument
(
"package"
)
...
...
@@ -48,7 +51,7 @@ lists all packages available."""
self
.
_args
.
set_option
(
"latest"
,
True
)
include_dev
=
not
self
.
option
(
"no-dev"
)
locked_repo
=
self
.
poetry
.
locker
.
locked_repository
(
include_dev
)
locked_repo
=
self
.
poetry
.
locker
.
locked_repository
(
True
)
# Show tree view if requested
if
self
.
option
(
"tree"
)
and
not
package
:
...
...
@@ -65,6 +68,25 @@ lists all packages available."""
table
=
self
.
table
(
style
=
"compact"
)
# table.style.line_vc_char = ""
locked_packages
=
locked_repo
.
packages
pool
=
Pool
()
pool
.
add_repository
(
locked_repo
)
solver
=
Solver
(
self
.
poetry
.
package
,
pool
=
pool
,
installed
=
Repository
(),
locked
=
locked_repo
,
io
=
NullIO
(),
)
solver
.
provider
.
load_deferred
(
False
)
with
solver
.
use_environment
(
self
.
env
):
ops
=
solver
.
solve
()
required_locked_packages
=
set
([
op
.
package
for
op
in
ops
if
not
op
.
skipped
])
if
self
.
option
(
"no-dev"
):
required_locked_packages
=
[
p
for
p
in
locked_packages
if
p
.
category
==
"main"
]
if
package
:
pkg
=
None
...
...
@@ -110,19 +132,10 @@ lists all packages available."""
latest_packages
=
{}
latest_statuses
=
{}
installed_repo
=
InstalledRepository
.
load
(
self
.
env
)
skipped
=
[]
python
=
Version
.
parse
(
"."
.
join
([
str
(
i
)
for
i
in
self
.
env
.
version_info
[:
3
]]))
# Computing widths
for
locked
in
locked_packages
:
python_constraint
=
locked
.
python_constraint
if
not
python_constraint
.
allows
(
python
)
or
not
self
.
env
.
is_valid_for_marker
(
locked
.
marker
):
skipped
.
append
(
locked
)
if
not
show_all
:
if
locked
not
in
required_locked_packages
and
not
show_all
:
continue
current_length
=
len
(
locked
.
pretty_name
)
...
...
@@ -179,7 +192,7 @@ lists all packages available."""
color
=
"cyan"
name
=
locked
.
pretty_name
install_marker
=
""
if
locked
in
skipped
:
if
locked
not
in
required_locked_packages
:
if
not
show_all
:
continue
...
...
poetry/mixology/version_solver.py
View file @
cc8f59a3
...
...
@@ -340,7 +340,12 @@ class VersionSolver:
# only has one version to choose from.
return
1
if
dependency
.
name
in
self
.
_locked
:
locked
=
self
.
_get_locked
(
dependency
)
if
locked
and
(
dependency
.
constraint
.
allows
(
locked
.
version
)
or
locked
.
is_prerelease
()
and
dependency
.
constraint
.
allows
(
locked
.
version
.
next_patch
)
):
return
1
# VCS, URL, File or Directory dependencies
...
...
@@ -377,8 +382,6 @@ class VersionSolver:
version
=
packages
[
0
]
except
IndexError
:
version
=
None
else
:
version
=
locked
if
version
is
None
:
# If there are no versions that satisfy the constraint,
...
...
@@ -388,6 +391,8 @@ class VersionSolver:
)
return
dependency
.
complete_name
else
:
version
=
locked
version
=
self
.
_provider
.
complete_package
(
version
)
...
...
@@ -451,10 +456,10 @@ class VersionSolver:
)
def
_get_locked
(
self
,
dependency
):
# type: (Dependency) -> Union[Package, None]
if
dependency
.
complete_
name
in
self
.
_use_latest
:
if
dependency
.
name
in
self
.
_use_latest
:
return
locked
=
self
.
_locked
.
get
(
dependency
.
complete_
name
)
locked
=
self
.
_locked
.
get
(
dependency
.
name
)
if
not
locked
:
return
...
...
poetry/puzzle/provider.py
View file @
cc8f59a3
...
...
@@ -67,6 +67,7 @@ class Provider:
self
.
_in_progress
=
False
self
.
_overrides
=
{}
self
.
_deferred_cache
=
{}
self
.
_load_deferred
=
True
@property
def
pool
(
self
):
# type: () -> Pool
...
...
@@ -78,6 +79,9 @@ class Provider:
def
set_overrides
(
self
,
overrides
):
self
.
_overrides
=
overrides
def
load_deferred
(
self
,
load_deferred
):
# type: (bool) -> None
self
.
_load_deferred
=
load_deferred
@contextmanager
def
use_environment
(
self
,
env
):
# type: (Env) -> Provider
original_env
=
self
.
_env
...
...
@@ -436,6 +440,7 @@ class Provider:
else
:
requires
=
package
.
requires
if
self
.
_load_deferred
:
# Retrieving constraints for deferred dependencies
for
r
in
requires
:
if
r
.
is_directory
():
...
...
poetry/puzzle/solver.py
View file @
cc8f59a3
...
...
@@ -386,9 +386,11 @@ class PackageNode(DFSNode):
continue
for
pkg
in
self
.
packages
:
if
(
pkg
.
complete_name
==
dependency
.
complete_name
and
dependency
.
constraint
.
allows
(
pkg
.
version
)
if
pkg
.
complete_name
==
dependency
.
complete_name
and
(
dependency
.
constraint
.
allows
(
pkg
.
version
)
or
dependency
.
allows_prereleases
()
and
pkg
.
version
.
is_prerelease
()
and
dependency
.
constraint
.
allows
(
pkg
.
version
.
stable
)
):
# If there is already a child with this name
# we merge the requirements
...
...
poetry/repositories/repository.py
View file @
cc8f59a3
...
...
@@ -44,7 +44,7 @@ class Repository(BaseRepository):
if
not
isinstance
(
constraint
,
VersionConstraint
):
constraint
=
parse_constraint
(
constraint
)
allow_prereleases
=
dependency
.
allows_prereleases
allow_prereleases
=
dependency
.
allows_prereleases
()
if
isinstance
(
constraint
,
VersionRange
):
if
(
constraint
.
max
is
not
None
...
...
@@ -68,7 +68,10 @@ class Repository(BaseRepository):
ignored_pre_release_packages
.
append
(
package
)
continue
if
constraint
.
allows
(
package
.
version
):
if
constraint
.
allows
(
package
.
version
)
or
(
package
.
is_prerelease
()
and
constraint
.
allows
(
package
.
version
.
next_patch
)
):
packages
.
append
(
package
)
return
packages
or
ignored_pre_release_packages
...
...
tests/console/commands/test_show.py
View file @
cc8f59a3
This diff is collapsed.
Click to expand it.
tests/fixtures/project_with_local_dependencies/pyproject.toml
View file @
cc8f59a3
...
...
@@ -27,7 +27,7 @@ python = "~2.7 || ^3.4"
demo
=
{
path
=
"../distributions/demo-0.1.0-py2.py3-none-any.whl"
}
# Dir dependency with setup.py
my-package
=
{
path
=
"../project_with_setup/"
}
project-with-setup
=
{
path
=
"../project_with_setup/"
}
[tool.poetry.scripts]
...
...
tests/fixtures/project_with_setup/
my_package
.egg-info/PKG-INFO
→
tests/fixtures/project_with_setup/
project_with_setup
.egg-info/PKG-INFO
View file @
cc8f59a3
Metadata-Version: 1.0
Name:
my-package
Name:
project-with-setup
Version: 0.1.2
Summary: Demo project.
Home-page: https://github.com/demo/demo
...
...
tests/fixtures/project_with_setup/
my_package
.egg-info/SOURCES.txt
→
tests/fixtures/project_with_setup/
project_with_setup
.egg-info/SOURCES.txt
View file @
cc8f59a3
File moved
tests/fixtures/project_with_setup/
my_package
.egg-info/dependency_links.txt
→
tests/fixtures/project_with_setup/
project_with_setup
.egg-info/dependency_links.txt
View file @
cc8f59a3
File moved
tests/fixtures/project_with_setup/
my_package
.egg-info/requires.txt
→
tests/fixtures/project_with_setup/
project_with_setup
.egg-info/requires.txt
View file @
cc8f59a3
File moved
tests/fixtures/project_with_setup/
my_package
.egg-info/top_level.txt
→
tests/fixtures/project_with_setup/
project_with_setup
.egg-info/top_level.txt
View file @
cc8f59a3
File moved
tests/fixtures/project_with_setup/setup.py
View file @
cc8f59a3
...
...
@@ -4,7 +4,7 @@ from setuptools import setup
kwargs
=
dict
(
name
=
"
my-package
"
,
name
=
"
project-with-setup
"
,
license
=
"MIT"
,
version
=
"0.1.2"
,
description
=
"Demo project."
,
...
...
tests/installation/fixtures/with-directory-dependency-setuptools.test
View file @
cc8f59a3
...
...
@@ -7,7 +7,15 @@ optional = false
python
-
versions
=
"*"
[[
package
]]
name
=
"my-package"
name
=
"pendulum"
version
=
"1.4.4"
description
=
""
category
=
"main"
optional
=
false
python
-
versions
=
"*"
[[
package
]]
name
=
"project-with-setup"
version
=
"0.1.2"
develop
=
false
description
=
"Demo project."
...
...
@@ -23,14 +31,6 @@ url = "tests/fixtures/project_with_setup"
cachy
=
{
version
=
">=0.2.0"
,
extras
=
[
"msgpack"
]}
pendulum
=
">=1.4.4"
[[
package
]]
name
=
"pendulum"
version
=
"1.4.4"
description
=
""
category
=
"main"
optional
=
false
python
-
versions
=
"*"
[
metadata
]
python
-
versions
=
"*"
lock
-
version
=
"1.1"
...
...
@@ -38,5 +38,5 @@ content-hash = "123456789"
[
metadata
.
files
]
cachy
=
[]
my
-
package
=
[]
project
-
with
-
setup
=
[]
pendulum
=
[]
tests/installation/test_installer.py
View file @
cc8f59a3
...
...
@@ -891,7 +891,7 @@ def test_run_installs_with_local_setuptools_directory(
):
file_path
=
fixtures_dir
/
"project_with_setup/"
package
.
add_dependency
(
Factory
.
create_dependency
(
"
my-package
"
,
{
"path"
:
str
(
file_path
)})
Factory
.
create_dependency
(
"
project-with-setup
"
,
{
"path"
:
str
(
file_path
)})
)
repo
.
add_package
(
get_package
(
"pendulum"
,
"1.4.4"
))
...
...
tests/installation/test_installer_old.py
View file @
cc8f59a3
...
...
@@ -859,7 +859,7 @@ def test_run_installs_with_local_setuptools_directory(
):
file_path
=
fixtures_dir
/
"project_with_setup/"
package
.
add_dependency
(
Factory
.
create_dependency
(
"
my-package
"
,
{
"path"
:
str
(
file_path
)})
Factory
.
create_dependency
(
"
project-with-setup
"
,
{
"path"
:
str
(
file_path
)})
)
repo
.
add_package
(
get_package
(
"pendulum"
,
"1.4.4"
))
...
...
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