euscanwww: PEP8 fixes

Signed-off-by: volpino <fox91@anche.no>
This commit is contained in:
volpino 2013-01-07 20:38:32 +01:00
parent 541eb71188
commit 76c4090f92
3 changed files with 15 additions and 11 deletions

View File

@ -8,11 +8,11 @@ def _launch_command(cmd, env=None, logger=None):
""" """
Helper for launching shell commands inside tasks Helper for launching shell commands inside tasks
""" """
import sys
import subprocess import subprocess
import select import select
fp = subprocess.Popen(cmd, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE) fp = subprocess.Popen(cmd, env=env, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
mask = select.EPOLLIN | select.EPOLLHUP | select.EPOLLERR mask = select.EPOLLIN | select.EPOLLHUP | select.EPOLLERR
@ -71,8 +71,8 @@ def layman_sync(logger, cache=True):
from layman import Layman from layman import Layman
import shutil import shutil
l = Layman(stderr=sys.__stderr__, stdin=sys.__stdin__, stdout=sys.__stdout__, l = Layman(stderr=sys.__stderr__, stdin=sys.__stdin__,
config=settings.LAYMAN_CONFIG, root="/") stdout=sys.__stdout__, config=settings.LAYMAN_CONFIG, root="/")
installed_overlays = l.get_installed() installed_overlays = l.get_installed()

View File

@ -282,7 +282,9 @@ class ScanPortage(object):
.filter(version_count=0) .filter(version_count=0)
) )
packages = ( packages = (
Package.objects.filter(id__in=[package['id'] for package in packages]) Package.objects.filter(
id__in=[package['id'] for package in packages]
)
) )
for package in packages: for package in packages:
@ -312,7 +314,7 @@ class ScanPortage(object):
self.logger.info('- [v] %s' % (version)) self.logger.info('- [v] %s' % (version))
if version.packaged == False: if version.packaged == False:
continue # Not our job continue # Not our job
# Fix last_version_ stuff that is sometime broken # Fix last_version_ stuff that is sometime broken
self.version_hack(version) self.version_hack(version)
@ -343,13 +345,14 @@ class ScanPortage(object):
self.logger.info('Prefetching current objects...') self.logger.info('Prefetching current objects...')
ppackages = Package.objects.all() ppackages = Package.objects.all()
pversions = Version.objects.filter(packaged=True).select_related('package').all() pversions = Version.objects.filter(packaged=True)\
.select_related('package').all()
if category: if category:
ppackages = ppackages.filter(category=category) ppackages = ppackages.filter(category=category)
pversions = pversions.filter(package__category=category) pversions = pversions.filter(package__category=category)
if packages: if packages:
ids = [ package.id for package in packages ] ids = [package.id for package in packages]
ppackages = ppackages.filter(pk__in=ids) ppackages = ppackages.filter(pk__in=ids)
pversions = pversions.filter(package__pk__in=ids) pversions = pversions.filter(package__pk__in=ids)
@ -360,6 +363,7 @@ class ScanPortage(object):
self.logger.info('done') self.logger.info('done')
def populate_categories(logger): def populate_categories(logger):
# Populate Category and Overlay # Populate Category and Overlay
# TODO: - use portage.settings.categories() # TODO: - use portage.settings.categories()
@ -369,6 +373,7 @@ def populate_categories(logger):
if created: if created:
logger.info("+ [c] %s", cat["category"]) logger.info("+ [c] %s", cat["category"])
def populate_overlays(logger): def populate_overlays(logger):
# TODO: - get informations from layman and portage (path, url) # TODO: - get informations from layman and portage (path, url)
for overlay in Version.objects.values('overlay').distinct(): for overlay in Version.objects.values('overlay').distinct():
@ -414,7 +419,6 @@ def scan_portage(packages=None, category=None, no_log=False, upstream=False,
results.append(package) results.append(package)
prefetch_packages = results prefetch_packages = results
scan_handler.prefetch(prefetch_packages, category) scan_handler.prefetch(prefetch_packages, category)
if not packages and category: if not packages and category:

View File

@ -91,7 +91,7 @@ class ScanUpstream(object):
revision='r0', revision='r0',
version=ver, version=ver,
overlay='', overlay='',
defaults={"slot" : '', "urls": url, "packaged": False, defaults={"slot": '', "urls": url, "packaged": False,
"vtype": version_type, "handler": handler, "vtype": version_type, "handler": handler,
"confidence": confidence} "confidence": confidence}
) )
@ -130,7 +130,7 @@ class ScanUpstream(object):
versions = self._versions.difference(self._versions_seen) versions = self._versions.difference(self._versions_seen)
for version in versions: for version in versions:
if version.packaged == True: if version.packaged == True:
continue # Not our job continue # Not our job
VersionLog.objects.create( VersionLog.objects.create(
package=version.package, package=version.package,
action=VersionLog.VERSION_REMOVED, action=VersionLog.VERSION_REMOVED,