File tree Expand file tree Collapse file tree 6 files changed +42
-5
lines changed Expand file tree Collapse file tree 6 files changed +42
-5
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,7 @@ jobs:
128
128
job :
129
129
- diffcov
130
130
- docs
131
+ - check-extern
131
132
runs-on : ubuntu-latest
132
133
steps :
133
134
- uses : actions/checkout@v4
Original file line number Diff line number Diff line change @@ -9,5 +9,7 @@ jaraco.text==3.7.0
9
9
importlib_resources==5.10.2
10
10
# required for importlib_resources on older Pythons
11
11
zipp==3.7.0
12
+ # required for jaraco.functools
13
+ more_itertools==10.2.0
12
14
# required for jaraco.context on older Pythons
13
15
backports.tarfile
Original file line number Diff line number Diff line change @@ -70,12 +70,21 @@ def install(self):
70
70
sys .meta_path .append (self )
71
71
72
72
73
+ # [[[cog
74
+ # import cog
75
+ # from tools.vendored import yield_root_package
76
+ # names = "\n".join(f" {x!r}," for x in yield_root_package('pkg_resources'))
77
+ # cog.outl(f"names = (\n{names}\n)")
78
+ # ]]]
73
79
names = (
74
80
'packaging' ,
75
81
'platformdirs' ,
82
+ 'typing_extensions' ,
76
83
'jaraco' ,
77
84
'importlib_resources' ,
85
+ 'zipp' ,
78
86
'more_itertools' ,
79
87
'backports' ,
80
88
)
89
+ # [[[end]]]
81
90
VendorImporter (__name__ , names ).install ()
Original file line number Diff line number Diff line change @@ -70,16 +70,23 @@ def install(self):
70
70
sys .meta_path .append (self )
71
71
72
72
73
+ # [[[cog
74
+ # import cog
75
+ # from tools.vendored import yield_root_package
76
+ # names = "\n".join(f" {x!r}," for x in yield_root_package('setuptools'))
77
+ # cog.outl(f"names = (\n{names}\n)")
78
+ # ]]]
73
79
names = (
74
80
'packaging' ,
75
81
'ordered_set' ,
76
82
'more_itertools' ,
77
- 'importlib_metadata' ,
78
- 'zipp' ,
79
- 'importlib_resources' ,
80
83
'jaraco' ,
84
+ 'importlib_resources' ,
85
+ 'importlib_metadata' ,
81
86
'typing_extensions' ,
87
+ 'zipp' ,
82
88
'tomli' ,
83
89
'backports' ,
84
90
)
91
+ # [[[end]]]
85
92
VendorImporter (__name__ , names , 'setuptools._vendor' ).install ()
Original file line number Diff line number Diff line change @@ -166,4 +166,18 @@ def update_setuptools():
166
166
rewrite_more_itertools (vendor / "more_itertools" )
167
167
168
168
169
+ def yield_root_package (name ):
170
+ """Useful when defining the MetaPathFinder
171
+ >>> examples = set(yield_root_package("setuptools")) & {"jaraco", "backports"}
172
+ >>> list(sorted(examples))
173
+ ['backports', 'jaraco']
174
+ """
175
+ vendored = Path (f"{ name } /_vendor/vendored.txt" )
176
+ yield from (
177
+ line .partition ("=" )[0 ].partition ("." )[0 ].replace ("-" , "_" )
178
+ for line in vendored .read_text (encoding = "utf-8" ).splitlines ()
179
+ if line and not line .startswith ("#" )
180
+ )
181
+
182
+
169
183
__name__ == '__main__' and update_vendored ()
Original file line number Diff line number Diff line change @@ -69,12 +69,16 @@ pass_env = *
69
69
commands =
70
70
python tools/finalize.py
71
71
72
- [testenv:vendor]
72
+ [testenv:{ vendor,check-extern} ]
73
73
skip_install = True
74
+ allowlist_externals = sh
74
75
deps =
75
76
path
77
+ cogapp
76
78
commands =
77
- python -m tools.vendored
79
+ vendor: python -m tools.vendored
80
+ vendor: sh -c " git grep -l -F '\[\[\[cog' | xargs cog -I {toxinidir} -r" # update `*.extern`
81
+ check-extern: sh -c " git grep -l -F '\[\[\[cog' | xargs cog -I {toxinidir} --check"
78
82
79
83
[testenv:generate-validation-code]
80
84
skip_install = True
You can’t perform that action at this time.
0 commit comments