euscan: cleanups

Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
This commit is contained in:
Corentin Chary 2012-05-28 07:02:41 +02:00
parent a224cb27cb
commit 3437cf5e4b

View File

@ -7,7 +7,6 @@ from portage.dbapi import porttree
import gentoolkit.pprinter as pp import gentoolkit.pprinter as pp
from gentoolkit.query import Query from gentoolkit.query import Query
from gentoolkit.package import Package from gentoolkit.package import Package
from gentoolkit.eclean.search import (port_settings)
from euscan import CONFIG, BLACKLIST_PACKAGES from euscan import CONFIG, BLACKLIST_PACKAGES
from euscan import handlers, helpers, output from euscan import handlers, helpers, output
@ -92,10 +91,15 @@ def scan_upstream_urls(cpv, urls, on_progress):
# gentoolkit stores PORTDB, so even if we modify it to add an overlay # gentoolkit stores PORTDB, so even if we modify it to add an overlay
# it will still use the old dbapi # it will still use the old dbapi
def reload_gentoolkit(): def reload_gentoolkit():
from gentoolkit import dbapi
import gentoolkit.package import gentoolkit.package
import gentoolkit.query import gentoolkit.query
PORTDB = portage.db[portage.root]["porttree"].dbapi PORTDB = portage.db[portage.root]["porttree"].dbapi
dbapi.PORTDB = PORTDB
if hasattr(dbapi, 'PORTDB'):
dbapi.PORTDB = PORTDB
if hasattr(gentoolkit.package, 'PORTDB'): if hasattr(gentoolkit.package, 'PORTDB'):
gentoolkit.package.PORTDB = PORTDB gentoolkit.package.PORTDB = PORTDB
if hasattr(gentoolkit.query, 'PORTDB'): if hasattr(gentoolkit.query, 'PORTDB'):
@ -179,10 +183,10 @@ def scan_upstream(query, on_progress=None):
cpv = pkg.cpv cpv = pkg.cpv
metadata = { metadata = {
"EAPI": port_settings["EAPI"], "EAPI": portage.settings["EAPI"],
"SRC_URI": pkg.environment("SRC_URI", False), "SRC_URI": pkg.environment("SRC_URI", False),
} }
use = frozenset(port_settings["PORTAGE_USE"].split()) use = frozenset(portage.settings["PORTAGE_USE"].split())
try: try:
alist = porttree._parse_uri_map(cpv, metadata, use=use) alist = porttree._parse_uri_map(cpv, metadata, use=use)
aalist = porttree._parse_uri_map(cpv, metadata) aalist = porttree._parse_uri_map(cpv, metadata)