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
6f4aa21c
Unverified
Commit
6f4aa21c
authored
Jul 05, 2019
by
Sébastien Eustace
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix installation with non-PyPI default repository
Co-authored-by: rusty <rusty@spoqa.com>
parent
d78b57f2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
10 deletions
+33
-10
poetry/installation/pip_installer.py
+8
-10
tests/installation/test_pip_installer.py
+25
-0
No files found.
poetry/installation/pip_installer.py
View file @
6f4aa21c
...
@@ -3,10 +3,9 @@ import tempfile
...
@@ -3,10 +3,9 @@ import tempfile
from
subprocess
import
CalledProcessError
from
subprocess
import
CalledProcessError
from
clikit.api.io
import
IO
from
clikit.io
import
NullIO
from
clikit.io
import
NullIO
from
poetry.config
import
Config
from
poetry.utils.helpers
import
get_http_basic_auth
from
poetry.utils.helpers
import
safe_rmtree
from
poetry.utils.helpers
import
safe_rmtree
...
@@ -15,6 +14,7 @@ try:
...
@@ -15,6 +14,7 @@ try:
except
ImportError
:
except
ImportError
:
import
urlparse
import
urlparse
from
poetry.repositories.pool
import
Pool
from
poetry.utils._compat
import
encode
from
poetry.utils._compat
import
encode
from
poetry.utils.env
import
Env
from
poetry.utils.env
import
Env
...
@@ -22,12 +22,7 @@ from .base_installer import BaseInstaller
...
@@ -22,12 +22,7 @@ from .base_installer import BaseInstaller
class
PipInstaller
(
BaseInstaller
):
class
PipInstaller
(
BaseInstaller
):
def
__init__
(
def
__init__
(
self
,
env
,
io
,
pool
):
# type: (Env, IO, Pool) -> None
self
,
env
,
# type: Env
io
,
pool
,
):
# type: (...) -> None
self
.
_env
=
env
self
.
_env
=
env
self
.
_io
=
io
self
.
_io
=
io
self
.
_pool
=
pool
self
.
_pool
=
pool
...
@@ -60,8 +55,11 @@ class PipInstaller(BaseInstaller):
...
@@ -60,8 +55,11 @@ class PipInstaller(BaseInstaller):
args
+=
[
"--index-url"
,
index_url
]
args
+=
[
"--index-url"
,
index_url
]
if
self
.
_pool
.
has_default
():
if
self
.
_pool
.
has_default
():
if
repository
.
name
!=
self
.
_pool
.
default
.
name
:
if
repository
.
name
!=
self
.
_pool
.
repositories
[
0
]
.
name
:
args
+=
[
"--extra-index-url"
,
self
.
_pool
.
default
.
authenticated_url
]
args
+=
[
"--extra-index-url"
,
self
.
_pool
.
repositories
[
0
]
.
authenticated_url
,
]
if
update
:
if
update
:
args
.
append
(
"-U"
)
args
.
append
(
"-U"
)
...
...
tests/installation/test_pip_installer.py
View file @
6f4aa21c
from
poetry.installation.pip_installer
import
PipInstaller
from
poetry.installation.pip_installer
import
PipInstaller
from
poetry.io.null_io
import
NullIO
from
poetry.io.null_io
import
NullIO
from
poetry.packages.package
import
Package
from
poetry.packages.package
import
Package
from
poetry.repositories.legacy_repository
import
LegacyRepository
from
poetry.repositories.pool
import
Pool
from
poetry.repositories.pool
import
Pool
from
poetry.utils.env
import
NullEnv
from
poetry.utils.env
import
NullEnv
...
@@ -23,3 +24,27 @@ def test_requirement():
...
@@ -23,3 +24,27 @@ def test_requirement():
)
)
assert
expected
==
result
assert
expected
==
result
def
test_install_with_non_pypi_default_repository
():
pool
=
Pool
()
default
=
LegacyRepository
(
"default"
,
"https://default.com"
)
another
=
LegacyRepository
(
"another"
,
"https://another.com"
)
pool
.
add_repository
(
default
,
default
=
True
)
pool
.
add_repository
(
another
)
installer
=
PipInstaller
(
NullEnv
(),
NullIO
(),
pool
)
foo
=
Package
(
"foo"
,
"0.0.0"
)
foo
.
source_type
=
"legacy"
foo
.
source_reference
=
default
.
_name
foo
.
source_url
=
default
.
_url
bar
=
Package
(
"bar"
,
"0.1.0"
)
bar
.
source_type
=
"legacy"
bar
.
source_reference
=
another
.
_name
bar
.
source_url
=
another
.
_url
installer
.
install
(
foo
)
installer
.
install
(
bar
)
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