@@ -130,29 +130,29 @@ async def list_repos_for_org(org):
130
130
return reps
131
131
132
132
133
- async def get_package_maintainers (package : str ) -> list [str ]:
133
+ async def get_package_maintainers (package : str ) -> tuple [ list [str ], bool ]:
134
134
"""Get the maintainers of a package from PyPI.
135
135
136
136
The json does not have the right information, so we need to scrape the page.
137
137
"""
138
138
url = f"https://pypi.org/project/{ package } /"
139
139
if package in cache :
140
140
print ("c" , end = "" , flush = True )
141
- return cache [package ]
141
+ return cache [package ], True
142
142
response = await asks .get (url )
143
143
if response .status_code == 200 :
144
144
html = response .text
145
145
soup = BeautifulSoup (html , "html.parser" )
146
146
maintainers = soup .find_all ("span" , class_ = "sidebar-section__maintainer" )
147
147
if not maintainers :
148
148
print ("x" , end = "" , flush = True )
149
- return set (["unknown (blocked by fastly?)" ])
149
+ return set (["unknown (blocked by fastly?)" ]), False
150
150
res = set (a .text .strip () for a in maintainers )
151
151
cache [package ] = res
152
152
print ("." , end = "" , flush = True )
153
- return res
153
+ return res , True
154
154
print ("f" , end = "" , flush = True )
155
- return set (["unknown (status code: " + str (response .status_code ) + ")" ])
155
+ return set (["unknown (status code: " + str (response .status_code ) + ")" ]), False
156
156
157
157
158
158
async def main (config_file : str = "all_repos.txt" ):
@@ -188,11 +188,12 @@ async def main(config_file: str = "all_repos.txt"):
188
188
async def _loc (targets , package_url ):
189
189
async with semaphore : # Wait for semaphore to be available
190
190
package = package_url .split ("/" )[- 1 ]
191
- maintainers = await get_package_maintainers (package )
191
+ maintainers , is_ok = await get_package_maintainers (package )
192
192
targets .append (
193
193
(
194
194
package_url ,
195
195
maintainers ,
196
+ is_ok ,
196
197
)
197
198
)
198
199
@@ -204,10 +205,12 @@ async def _loc(targets, package_url):
204
205
"TO add to PiPy org – they are listed on the config file, with a "
205
206
"corresponding Pypi package, but the package is not part of Pypi org:"
206
207
)
207
- for package_url , maintainers in targets :
208
- print (f" [red ]{ package_url } [/red ] maintained by" )
208
+ for package_url , maintainers , is_ok in targets :
209
+ print (f" [yellow ]{ package_url } [/yellow ] maintained by" )
209
210
for maintainer in maintainers :
210
- print (f" pypi: `@{ maintainer } `" )
211
+ color = "[green]" if is_ok else "[red]"
212
+ end = "[/green]" if is_ok else "[/red]"
213
+ print (f"{ color } pypi: `@{ maintainer } ` { end } " )
211
214
print ()
212
215
213
216
missing_from_github_org = set (packages_urls ) - set ([p for _ , p in known_mapping ])
0 commit comments