}

accepted_modes = {
    "pypi-scrape-crawl": ["pypi-scrape-crawl", "pypi-scrape", "pypi-explicit"],
    "pypi-scrape": ["pypi-scrape", "pypi-explicit"],
    "pypi-explicit": ["pypi-explicit"],
}

store.open()
for desired_mode, names in data.iteritems():
    if desired_mode == "pypi-scrape-crawl":
        continue  # We don't need to do any processing for pypi-scrape-crawl

    for name in names:
        packages = store.find_package(name)
        if not packages:
            continue  # This doesn't exist

        assert safe_name(name).lower() == safe_name(packages[0]).lower()
        name = packages[0]

        current_mode = store.get_package_hosting_mode(name)

        if current_mode not in accepted_modes[desired_mode]:
            store.set_package_hosting_mode(name, desired_mode)
            processed[desired_mode].add(name)
store.commit()

with open("migrated.pkl", "wb") as pkl:
    pickle.dump(processed, pkl)
accepted_modes = {
    "pypi-scrape-crawl": ["pypi-scrape-crawl", "pypi-scrape", "pypi-explicit"],
    "pypi-scrape": ["pypi-scrape", "pypi-explicit"],
    "pypi-explicit": ["pypi-explicit"],
}


store.open()
for desired_mode, names in data.iteritems():
    if desired_mode == "pypi-scrape-crawl":
        continue  # We don't need to do any processing for pypi-scrape-crawl

    for name in names:
        packages = store.find_package(name)
        if not packages:
            continue  # This doesn't exist

        assert safe_name(name).lower() == safe_name(packages[0]).lower()
        name = packages[0]

        current_mode = store.get_package_hosting_mode(name)

        if current_mode not in accepted_modes[desired_mode]:
            store.set_package_hosting_mode(name, desired_mode)
            processed[desired_mode].add(name)
store.commit()

with open("migrated.pkl", "wb") as pkl:
    pickle.dump(processed, pkl)
sent = []

# Email each user
server = smtplib.SMTP(config.smtp_hostname)
if config.smtp_starttls:
    server.starttls()
if config.smtp_auth:
    server.login(config.smtp_login, config.smtp_password)
for i, (package, users) in enumerate(package_users.iteritems()):
    fpackage = store.find_package(package)

    if not fpackage:
        continue

    package = fpackage[0]
    hosting_mode = store.get_package_hosting_mode(package)

    if hosting_mode != "pypi-scrape-crawl":
        continue

    users = sorted(set(users))

    emails = []
    for username in users:
        user = store.get_user(username)
        if user["email"]:
            emails.append(user["email"])

    msg = MIMEText(EMAIL_BODY % {"project": package})
    msg["Subject"] = "Important Information about %s on PyPI" % package
    msg["From"] = "*****@*****.**"
Beispiel #4
0
sent = []

# Email each user
server = smtplib.SMTP(config.smtp_hostname)
if config.smtp_starttls:
    server.starttls()
if config.smtp_auth:
    server.login(config.smtp_login, config.smtp_password)
for i, (package, users) in enumerate(package_users.iteritems()):
    fpackage = store.find_package(package)

    if not fpackage:
        continue

    package = fpackage[0]
    hosting_mode = store.get_package_hosting_mode(package)

    if hosting_mode != "pypi-scrape-crawl":
        continue

    users = sorted(set(users))

    emails = []
    for username in users:
        user = store.get_user(username)
        if user["email"]:
            emails.append(user["email"])

    msg = MIMEText(EMAIL_BODY % {"project": package})
    msg["Subject"] = "Important Information about %s on PyPI" % package
    msg["From"] = "*****@*****.**"