Skip to content

Commit eb7b4ed

Browse files
committed
Update vendored pkg_resources
1 parent e3e7bc3 commit eb7b4ed

File tree

9 files changed

+303
-200
lines changed

9 files changed

+303
-200
lines changed

news/pkg_resources.vendor.rst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Patch pkg_resources to remove dependency on ``jaraco.text``.

news/setuptools.vendor.rst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update pkg_resources (via setuptools) to 65.6.3

pyproject.toml

+2
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ drop = [
5050
"easy_install.py",
5151
"setuptools",
5252
"pkg_resources/_vendor/",
53+
"_distutils_hack",
54+
"distutils-precedence.pth",
5355
"pkg_resources/extern/",
5456
# trim vendored pygments styles and lexers
5557
"pygments/styles/[!_]*.py",
+109
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
"""Functions brought over from jaraco.text.
2+
3+
These functions are not supposed to be used within `pip._internal`. These are
4+
helper functions brought over from `jaraco.text` to enable vendoring newer
5+
copies of `pkg_resources` without having to vendor `jaraco.text` and its entire
6+
dependency cone; something that our vendoring setup is not currently capable of
7+
handling.
8+
9+
License reproduced from original source below:
10+
11+
Copyright Jason R. Coombs
12+
13+
Permission is hereby granted, free of charge, to any person obtaining a copy
14+
of this software and associated documentation files (the "Software"), to
15+
deal in the Software without restriction, including without limitation the
16+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
17+
sell copies of the Software, and to permit persons to whom the Software is
18+
furnished to do so, subject to the following conditions:
19+
20+
The above copyright notice and this permission notice shall be included in
21+
all copies or substantial portions of the Software.
22+
23+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
29+
IN THE SOFTWARE.
30+
"""
31+
32+
import functools
33+
import itertools
34+
35+
36+
def _nonblank(str):
37+
return str and not str.startswith("#")
38+
39+
40+
@functools.singledispatch
41+
def yield_lines(iterable):
42+
r"""
43+
Yield valid lines of a string or iterable.
44+
45+
>>> list(yield_lines(''))
46+
[]
47+
>>> list(yield_lines(['foo', 'bar']))
48+
['foo', 'bar']
49+
>>> list(yield_lines('foo\nbar'))
50+
['foo', 'bar']
51+
>>> list(yield_lines('\nfoo\n#bar\nbaz #comment'))
52+
['foo', 'baz #comment']
53+
>>> list(yield_lines(['foo\nbar', 'baz', 'bing\n\n\n']))
54+
['foo', 'bar', 'baz', 'bing']
55+
"""
56+
return itertools.chain.from_iterable(map(yield_lines, iterable))
57+
58+
59+
@yield_lines.register(str)
60+
def _(text):
61+
return filter(_nonblank, map(str.strip, text.splitlines()))
62+
63+
64+
def drop_comment(line):
65+
"""
66+
Drop comments.
67+
68+
>>> drop_comment('foo # bar')
69+
'foo'
70+
71+
A hash without a space may be in a URL.
72+
73+
>>> drop_comment('http://example.com/foo#bar')
74+
'http://example.com/foo#bar'
75+
"""
76+
return line.partition(" #")[0]
77+
78+
79+
def join_continuation(lines):
80+
r"""
81+
Join lines continued by a trailing backslash.
82+
83+
>>> list(join_continuation(['foo \\', 'bar', 'baz']))
84+
['foobar', 'baz']
85+
>>> list(join_continuation(['foo \\', 'bar', 'baz']))
86+
['foobar', 'baz']
87+
>>> list(join_continuation(['foo \\', 'bar \\', 'baz']))
88+
['foobarbaz']
89+
90+
Not sure why, but...
91+
The character preceeding the backslash is also elided.
92+
93+
>>> list(join_continuation(['goo\\', 'dly']))
94+
['godly']
95+
96+
A terrible idea, but...
97+
If no line is available to continue, suppress the lines.
98+
99+
>>> list(join_continuation(['foo', 'bar\\', 'baz\\']))
100+
['foo']
101+
"""
102+
lines = iter(lines)
103+
for item in lines:
104+
while item.endswith("\\"):
105+
try:
106+
item = item[:-2].strip() + next(lines)
107+
except StopIteration:
108+
return
109+
yield item

src/pip/_vendor/pkg_resources/LICENSE

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
Copyright (C) 2016 Jason R Coombs <[email protected]>
1+
Copyright Jason R. Coombs
22

3-
Permission is hereby granted, free of charge, to any person obtaining a copy of
4-
this software and associated documentation files (the "Software"), to deal in
5-
the Software without restriction, including without limitation the rights to
6-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7-
of the Software, and to permit persons to whom the Software is furnished to do
8-
so, subject to the following conditions:
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to
5+
deal in the Software without restriction, including without limitation the
6+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7+
sell copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
99

10-
The above copyright notice and this permission notice shall be included in all
11-
copies or substantial portions of the Software.
10+
The above copyright notice and this permission notice shall be included in
11+
all copies or substantial portions of the Software.
1212

1313
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1414
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1515
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1616
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19-
SOFTWARE.
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19+
IN THE SOFTWARE.

0 commit comments

Comments
 (0)