Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
38 lines (34 sloc) 1.09 KB
#!/usr/bin/env python3
import github3
import requests
import json
import os
import sys
index = os.getenv("CRATES_INDEX")
log_file = open("repos.txt", "w")
no_repo = open("no_repos.txt", "w")
unlic = open("unlic.txt", "w")
def handle_crate(name):
crate = requests.get("{}".format(name))
j = crate.json()
if "errors" in j:
j = j["crate"]
if "license" in j:
if j["license"] is None:
print(name, file=unlic)
mit = "MIT" in j["license"]
apache = "Apache-2.0" in j["license"]
print("{} license: {}, {}, {}".format(name, mit, apache, j["license"]))
if mit ^ apache:
if "repository" in j and j["repository"] is not None and "" in j["repository"]:
print("{} needs to be handled".format(name))
print(j["repository"], file=log_file)
print(name, file=no_repo)
print(name, file=unlic)
for dname, subdirs, files in os.walk(index):
for fname in files:
You can’t perform that action at this time.