Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
6f46a4b7
Commit
6f46a4b7
authored
Nov 26, 2019
by
Benoit Pierre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix support for easy_install's find-links option in setup.cfg
parent
e84f616a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
2 deletions
+50
-2
changelog.d/1921.change.txt
changelog.d/1921.change.txt
+1
-0
setuptools/installer.py
setuptools/installer.py
+11
-2
setuptools/tests/test_easy_install.py
setuptools/tests/test_easy_install.py
+38
-0
No files found.
changelog.d/1921.change.txt
0 → 100644
View file @
6f46a4b7
Fix support for easy_install's ``find-links`` option in ``setup.cfg``.
setuptools/installer.py
View file @
6f46a4b7
...
...
@@ -7,11 +7,20 @@ from distutils.errors import DistutilsError
import
pkg_resources
from
setuptools.command.easy_install
import
easy_install
from
setuptools.extern
import
six
from
setuptools.wheel
import
Wheel
from
.py31compat
import
TemporaryDirectory
def
_fixup_find_links
(
find_links
):
"""Ensure find-links option end-up being a list of strings."""
if
isinstance
(
find_links
,
six
.
string_types
):
return
find_links
.
split
()
assert
isinstance
(
find_links
,
(
tuple
,
list
))
return
find_links
def
_legacy_fetch_build_egg
(
dist
,
req
):
"""Fetch an egg needed for building.
...
...
@@ -31,7 +40,7 @@ def _legacy_fetch_build_egg(dist, req):
if
dist
.
dependency_links
:
links
=
dist
.
dependency_links
[:]
if
'find_links'
in
opts
:
links
=
opts
[
'find_links'
][
1
]
+
links
links
=
_fixup_find_links
(
opts
[
'find_links'
][
1
])
+
links
opts
[
'find_links'
]
=
(
'setup'
,
links
)
install_dir
=
dist
.
get_egg_cache_dir
()
cmd
=
easy_install
(
...
...
@@ -84,7 +93,7 @@ def fetch_build_egg(dist, req):
else
:
index_url
=
None
if
'find_links'
in
opts
:
find_links
=
opts
[
'find_links'
][
1
]
[:]
find_links
=
_fixup_find_links
(
opts
[
'find_links'
][
1
])
[:]
else
:
find_links
=
[]
if
dist
.
dependency_links
:
...
...
setuptools/tests/test_easy_install.py
View file @
6f46a4b7
...
...
@@ -744,6 +744,44 @@ class TestSetupRequires:
eggs
=
list
(
map
(
str
,
pkg_resources
.
find_distributions
(
os
.
path
.
join
(
test_pkg
,
'.eggs'
))))
assert
eggs
==
[
'dep 1.0'
]
@
pytest
.
mark
.
parametrize
(
'use_legacy_installer,with_dependency_links_in_setup_py'
,
itertools
.
product
((
False
,
True
),
(
False
,
True
)))
def
test_setup_requires_with_find_links_in_setup_cfg
(
self
,
monkeypatch
,
use_legacy_installer
,
with_dependency_links_in_setup_py
):
monkeypatch
.
setenv
(
str
(
'PIP_RETRIES'
),
str
(
'0'
))
monkeypatch
.
setenv
(
str
(
'PIP_TIMEOUT'
),
str
(
'0'
))
with
contexts
.
save_pkg_resources_state
():
with
contexts
.
tempdir
()
as
temp_dir
:
make_trivial_sdist
(
os
.
path
.
join
(
temp_dir
,
'python-xlib-42.tar.gz'
),
'python-xlib'
,
'42'
)
test_pkg
=
os
.
path
.
join
(
temp_dir
,
'test_pkg'
)
test_setup_py
=
os
.
path
.
join
(
test_pkg
,
'setup.py'
)
test_setup_cfg
=
os
.
path
.
join
(
test_pkg
,
'setup.cfg'
)
os
.
mkdir
(
test_pkg
)
with
open
(
test_setup_py
,
'w'
)
as
fp
:
if
with_dependency_links_in_setup_py
:
dependency_links
=
[
os
.
path
.
join
(
temp_dir
,
'links'
)]
else
:
dependency_links
=
[]
fp
.
write
(
DALS
(
'''
from setuptools import installer, setup
if {use_legacy_installer}:
installer.fetch_build_egg = installer._legacy_fetch_build_egg
setup(setup_requires='python-xlib==42',
dependency_links={dependency_links!r})
'''
).
format
(
use_legacy_installer
=
use_legacy_installer
,
dependency_links
=
dependency_links
))
with
open
(
test_setup_cfg
,
'w'
)
as
fp
:
fp
.
write
(
DALS
(
'''
[easy_install]
index_url = {index_url}
find_links = {find_links}
'''
).
format
(
index_url
=
os
.
path
.
join
(
temp_dir
,
'index'
),
find_links
=
temp_dir
))
run_setup
(
test_setup_py
,
[
str
(
'--version'
)])
def
make_trivial_sdist
(
dist_path
,
distname
,
version
):
"""
...
...
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