Remove a number of unneeded import os/bb calls
PATCH 1/1 Remove a number of unneeded import os/bb calls
The bb and os modules are always imported so having these extra import calls are a waste of space/execution time. They also set a bad example for people copy and pasting code so clean them up.
Signed-off-by Richard Purdie <[email protected]>
---
meta/classes/archiver.bbclass +0 -3
@@ -76,7 +76,6 @@ def tar_filter(d): def get_bb_inc(d): '''create a directory "script-logs" including .bb and .inc file in ${WORKDIR}''' import re - import os import shutil bbinc = []
@@ -154,7 +153,6 @@ def get_series(d): def get_applying_patches(d): """only copy applying patches to a pointed directory which will be archived to tarball""" - import os import shutil
@@ -174,7 +172,6 @@ def get_applying_patches(d): def not_tarball(d): '''packages including key words 'work-shared','native', 'task-' will be passed''' - import os workdir = d.getVar('WORKDIR',True) s = d.getVar('S',True)
meta/classes/base.bbclass +4 -6
@@ -14,7 +14,7 @@ OE_IMPORTS += "os sys time oe.path oe.utils oe.data oe.packagegroup oe.sstatesig OE_IMPORTS[type] = "list" def oe_import(d): - import os, sys + import sys bbpath = d.getVar("BBPATH", True).split(":") sys.path[0:0] = [os.path.join(dir, "lib") for dir in bbpath]
@@ -117,11 +117,9 @@ GIT_CONFIG_PATH = "${STAGING_DIR_NATIVE}/etc" GIT_CONFIG = "${GIT_CONFIG_PATH}/gitconfig" def generate_git_config(e): - from bb import data - - if data.getVar('GIT_CORE_CONFIG', e.data, True): + if e.data.getVar('GIT_CORE_CONFIG', True): gitconfig_path = e.data.getVar('GIT_CONFIG', True) - proxy_command = " gitProxy = %s\n" % data.getVar('OE_GIT_PROXY_COMMAND', e.data, True) + proxy_command = " gitProxy = %s\n" % e.data.getVar('OE_GIT_PROXY_COMMAND', True) bb.mkdirhier(e.data.expand("${GIT_CONFIG_PATH}")) if (os.path.exists(gitconfig_path)):
@@ -129,7 +127,7 @@ def generate_git_config(e): f = open(gitconfig_path, 'w') f.write("[core]\n") - ignore_hosts = data.getVar('GIT_PROXY_IGNORE', e.data, True).split() + ignore_hosts = e.data.getVar('GIT_PROXY_IGNORE', True).split() for ignore_host in ignore_hosts: f.write(" gitProxy = none for %s\n" % ignore_host) f.write(proxy_command)
meta/classes/bugzilla.bbclass +1 -1
@@ -72,7 +72,7 @@ def bugzilla_add_comment(debug_file, server, args, bug_number, text): addhandler bugzilla_eventhandler python bugzilla_eventhandler() { - import bb, os, glob + import glob import xmlrpclib, httplib class ProxiedTransport(xmlrpclib.Transport):
meta/classes/buildhistory.bbclass +0 -3
@@ -414,9 +414,6 @@ buildhistory_commit() { } python buildhistory_eventhandler() { - import bb.build - import bb.event - if isinstance(e, bb.event.BuildCompleted): if e.data.getVar('BUILDHISTORY_FEATURES', True).strip(): if e.data.getVar("BUILDHISTORY_COMMIT", True) == "1":
meta/classes/copyleft_compliance.bbclass +0 -1
@@ -58,7 +58,6 @@ def copyleft_should_include(d): python do_prepare_copyleft_sources () { """Populate a tree of the recipe sources and emit patch series files""" - import os.path import shutil p = d.getVar('P', True)
meta/classes/distrodata.bbclass +0 -3
@@ -654,7 +654,6 @@ do_distro_check[nostamp] = "1" python do_distro_check() { """checks if the package is present in other public Linux distros""" import oe.distro_check as dc - import bb import shutil if bb.data.inherits_class('native', d) or bb.data.inherits_class('cross', d) or bb.data.inherits_class('sdk', d) or bb.data.inherits_class('crosssdk', d) or bb.data.inherits_class('nativesdk',d): return
@@ -704,8 +703,6 @@ python checklicense_eventhandler() { addtask checklicense do_checklicense[nostamp] = "1" python do_checklicense() { - import os - import bb import shutil logpath = d.getVar('LOG_DIR', True) bb.utils.mkdirhier(logpath)
meta/classes/imagetest-qemu.bbclass +0 -1
@@ -26,7 +26,6 @@ do_qemuimagetest_standalone[depends] += "qemu-native:do_populate_sysroot" def qemuimagetest_main(d): import sys import re - import os import shutil import subprocess
meta/classes/kernel-yocto.bbclass +1 -1
@@ -188,7 +188,7 @@ do_kernel_configme() { } python do_kernel_configcheck() { - import bb, re, string, sys, commands + import re, string, sys, commands bb.plain("NOTE: validating kernel configuration")
meta/classes/libc-package.bbclass +1 -1
@@ -118,7 +118,7 @@ do_collect_bins_from_locale_tree() { inherit qemu python package_do_split_gconvs () { - import os, re + import re if (d.getVar('PACKAGE_NO_GCONV', True) == '1'): bb.note("package requested not splitting gconvs") return
meta/classes/license.bbclass +0 -2
@@ -143,8 +143,6 @@ python do_populate_lic() { """ Populate LICENSE_DIRECTORY with licenses. """ - import os - import bb import shutil import oe.license
meta/classes/package.bbclass +1 -1
@@ -444,7 +444,7 @@ python perform_packagecopy () { # seeding this list with reasonable defaults, then load from # the fs-perms.txt files python fixup_perms () { - import os, pwd, grp + import pwd, grp # init using a string with the same format as a line as documented in # the fs-perms.txt file
meta/classes/package_rpm.bbclass +0 -3
@@ -637,7 +637,6 @@ python write_specfile () { array.append("%s: %s" % (tag, dep)) def walk_files(walkpath, target, conffiles): - import os for rootpath, dirs, files in os.walk(walkpath): path = rootpath.replace(walkpath, "") for dir in dirs:
@@ -1019,8 +1018,6 @@ python write_specfile () { } python do_package_rpm () { - import os - def creat_srpm_dir(d): if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) and d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True).upper() == 'SRPM': clean_licenses = get_licenses(d)
meta/classes/qemu.bbclass +0 -2
@@ -4,8 +4,6 @@ # def qemu_target_binary(data): - import bb - target_arch = data.getVar("TARGET_ARCH", True) if target_arch in ("i486", "i586", "i686"): target_arch = "i386"
meta/classes/recipe_sanity.bbclass +1 -4
@@ -55,7 +55,6 @@ def can_use_autotools_base(cfgdata, d): if cfg.find(i) != -1: return False - import os for clsfile in d.getVar("__inherit_cache", 0): (base, _) = os.path.splitext(os.path.basename(clsfile)) if cfg.find("%s_do_configure" % base) != -1:
@@ -146,9 +145,7 @@ do_recipe_sanity_all () { addtask recipe_sanity_all after do_recipe_sanity python recipe_sanity_eh () { - from bb.event import getName - - if getName(e) != "ConfigParsed": + if bb.event.getName(e) != "ConfigParsed": return d = e.data
meta/classes/sanity.bbclass +2 -5
@@ -254,8 +254,6 @@ def check_supported_distro(sanity_data): # Checks we should only make if MACHINE is set correctly def check_sanity_validmachine(sanity_data): - from bb import data - messages = "" # Check TUNE_ARCH is set
@@ -291,7 +289,6 @@ def check_sanity_validmachine(sanity_data): def check_sanity(sanity_data): - from bb import note, error, data, __version__ import subprocess try:
@@ -319,8 +316,8 @@ def check_sanity(sanity_data): if sys.hexversion < 0x020600F0: messages = messages + 'The system requires at least Python 2.6 to run. Please update your Python interpreter.\n' - if (LooseVersion(__version__) < LooseVersion(minversion)): - messages = messages + 'Bitbake version %s is required and version %s was found\n' % (minversion, __version__) + if (LooseVersion(bb.__version__) < LooseVersion(minversion)): + messages = messages + 'Bitbake version %s is required and version %s was found\n' % (minversion, bb.__version__) # Check that the MACHINE is valid, if it is set if sanity_data.getVar('MACHINE', True):
meta/classes/tinderclient.bbclass +43 -55
212 lines not on this page · raw message
meta/conf/distro/include/csl-versions.inc +0 -2
@@ -38,7 +38,6 @@ def csl_get_gcc_version(d): return version def csl_get_libc_version(d): - import os,bb syspath = d.expand('${EXTERNAL_TOOLCHAIN}/${CSL_TARGET_SYS}') if not syspath: return 'UNKNOWN'
@@ -54,7 +53,6 @@ def csl_get_libc_version(d): return 'UNKNOWN' def csl_get_kernel_version(d): - import os,bb syspath = d.expand('${EXTERNAL_TOOLCHAIN}/${CSL_TARGET_SYS}') if not syspath: return 'UNKNOWN'
meta/conf/distro/include/tcmode-external-sourcery.inc +0 -1
@@ -104,7 +104,6 @@ addhandler toolchain_setup def populate_toolchain_links(d): import errno - import os from glob import glob d = d.createCopy()
meta/lib/oe/data.py +0 -1
@@ -1,5 +1,4 @@ import oe.maketype -import bb.msg def typed_value(key, d): """Construct a value for the specified metadata variable, using its flags
meta/lib/oe/maketype.py +0 -1
@@ -5,7 +5,6 @@ variable. Other flags may be utilized in the construction of the types. See the arguments of the type's factory for details. """ -import bb import inspect import types
meta/lib/oe/packagedata.py +0 -2
@@ -1,5 +1,3 @@ -import os -import bb.data import codecs def packaged(pkg, d):
meta/lib/oe/patch.py +0 -2
@@ -1,6 +1,4 @@ import oe.path -import os -import bb.utils, bb.msg, bb.data, bb.fetch2 class NotFoundError(bb.BBHandledException): def __init__(self, path):
meta/lib/oe/path.py +0 -2
@@ -1,7 +1,5 @@ -import bb import errno import glob -import os import shutil import subprocess
meta/lib/oe/prservice.py +0 -1
@@ -1,4 +1,3 @@ -import bb def prserv_make_conn(d, check = False): import prserv.serv
meta/lib/oe/terminal.py +0 -1
@@ -1,5 +1,4 @@ import logging -import os import oe.classutils import shlex from bb.process import Popen, ExecutionError
meta/lib/oe/utils.py +0 -2
@@ -1,5 +1,3 @@ -import bb, bb.data - def read_file(filename): try: f = file( filename, "r" )
meta/recipes-core/eglibc/eglibc_2.15.bb +1 -1
@@ -58,7 +58,7 @@ FILESPATH = "${@base_set_filespath([ '${FILE_DIRNAME}/eglibc-${PV}', '${FILE_DIR # python __anonymous () { - import bb, re + import re uc_os = (re.match('.*uclibc$', d.getVar('TARGET_OS', True)) != None) if uc_os: raise bb.parse.SkipPackage("incompatible with target %s" %
meta/recipes-core/eglibc/eglibc_2.16.bb +1 -1
@@ -53,7 +53,7 @@ FILESPATH = "${@base_set_filespath([ '${FILE_DIRNAME}/eglibc-${PV}', '${FILE_DIR # python __anonymous () { - import bb, re + import re uc_os = (re.match('.*uclibc$', d.getVar('TARGET_OS', True)) != None) if uc_os: raise bb.parse.SkipPackage("incompatible with target %s" %
meta/recipes-core/tasks/task-base.bb +0 -2
@@ -124,8 +124,6 @@ python __anonymous () { # If Distro want wifi and machine feature wifi/pci/pcmcia/usbhost (one of them) # then include task-base-wifi in task-base - import bb - distro_features = set(d.getVar("DISTRO_FEATURES", True).split()) machine_features= set(d.getVar("MACHINE_FEATURES", True).split())
meta/recipes-devtools/apt/apt-package.inc +0 -1
@@ -40,7 +40,6 @@ def get_files_apt_doc(d, bb, manpages): return manpages def get_commands_apt_doc(d, bb, manpages): - import os s = list() __dir_cache__ = list() for m in manpages.split():
meta/recipes-extended/pam/libpam_1.1.5.bb +0 -2
@@ -53,8 +53,6 @@ RDEPENDS_${PN}-xtests = "libpam pam-plugin-access pam-plugin-debug pam-plugin-cr RRECOMMENDS_${PN} = "libpam-runtime" python populate_packages_prepend () { - import os.path - def pam_plugin_append_file(pn, dir, file): nf = os.path.join(dir, file) of = d.getVar('FILES_' + pn, True)
meta/recipes-gnome/gtk+/gtk+_2.12.7.bb +0 -2
@@ -32,8 +32,6 @@ LIBV = "2.10.0" PACKAGES_DYNAMIC += "gdk-pixbuf-loader-* gtk-immodule-* gtk-printbackend-*" python populate_packages_prepend () { - import os.path - prologue = d.getVar("postinst_prologue", True) postinst_pixbufloader = d.getVar("postinst_pixbufloader", True)
meta/recipes-gnome/gtk+/gtk+_2.16.6.bb +0 -2
@@ -32,8 +32,6 @@ LIBV = "2.10.0" PACKAGES_DYNAMIC += "gdk-pixbuf-loader-* gtk-immodule-* gtk-printbackend-*" python populate_packages_prepend () { - import os.path - prologue = d.getVar("postinst_prologue", True) postinst_pixbufloader = d.getVar("postinst_pixbufloader", True)
meta/recipes-gnome/gtk+/gtk+_2.24.8.bb +0 -2
@@ -39,8 +39,6 @@ LIBV = "2.10.0" PACKAGES_DYNAMIC += "gtk-immodule-* gtk-printbackend-*" python populate_packages_prepend () { - import os.path - prologue = d.getVar("postinst_prologue", True) gtk_libdir = d.expand('${libdir}/gtk-2.0/${LIBV}')
meta/recipes-gnome/gtk-engines/gtk-engines_2.20.2.bb +0 -2
@@ -29,8 +29,6 @@ CFLAGS_prepend = "-DHAVE_ANIMATION " inherit gnome python populate_packages_prepend() { - import os.path - engines_root = os.path.join(d.getVar('libdir', True), "gtk-2.0/2.10.0/engines") themes_root = os.path.join(d.getVar('datadir', True), "themes")
meta/recipes-graphics/directfb/directfb.inc +0 -1
@@ -35,7 +35,6 @@ EXTRA_OECONF = "\ #PACKAGES_DYNAMIC = "directfb-inputdrivers-*" # #python populate_packages_prepend () { -# import os.path # inputdrivers_libdir = d.expand('${libdir}/directfb-${RV}/inputdrivers') # do_split_packages(d, inputdrivers_libdir, '*.so$', 'directfb-inputdrivers-%s', 'Directfb plugin for %s') #}
meta/recipes-graphics/mesa/mesa-dri.inc +0 -2
@@ -11,8 +11,6 @@ DRIDRIVERS_append_x86-64 = ",i915,i965" EXTRA_OECONF += "--with-driver=dri --disable-egl --disable-gallium --without-gallium-drivers --with-dri-drivers=${DRIDRIVERS}" python populate_packages_prepend() { - import os.path - dri_drivers_root = os.path.join(d.getVar('libdir', True), "dri") do_split_packages(d, dri_drivers_root, '^(.*)_dri\.so$', 'mesa-dri-driver-%s', 'Mesa %s DRI driver', extra_depends='')
meta/recipes-kernel/linux/linux-dtb.inc +0 -2
@@ -3,8 +3,6 @@ FILES_kernel-devicetree = "/boot/devicetree*" KERNEL_DEVICETREE_FLAGS = "-R 8 -p 0x3000" python __anonymous () { - import bb - devicetree = d.getVar("KERNEL_DEVICETREE", True) or '' if devicetree: depends = d.getVar("DEPENDS", True)
meta/recipes-qt/qt-apps/qmmp_0.5.2.bb +0 -1
@@ -30,7 +30,6 @@ PACKAGES_DYNAMIC = "qmmp-plugin-* " python populate_packages_prepend () { - import os qmmp_libdir = d.expand('${libdir}/qmmp') gd = d.expand('${D}/${libdir}/qmmp') plug_dirs = os.listdir(gd)
meta/recipes-qt/qt4/qt4.inc +1 -3
@@ -38,8 +38,6 @@ QT_LIB_NAMES = "Qt3Support QtAssistantClient QtCLucene QtCore QtDBus QtDesigner QT_EXTRA_LIBS = "pvrQWSWSEGL" python __anonymous () { - import bb - lib_packages = [] dev_packages = [] dbg_packages = []
@@ -280,7 +278,7 @@ python populate_packages_prepend() { phrasebook_dir = d.expand('${datadir}/${QT_DIR_NAME}/phrasebooks/') phrasebook_name = d.expand('${QT_BASE_NAME}-phrasebook-%s') - import os; + if os.path.exists("%s%s" % (d.expand('${D}'), phrasebook_dir)): do_split_packages(d, phrasebook_dir, '^(.*)\.qph$', phrasebook_name, '${PN} phrasebook for %s', extra_depends='' ) else:
meta/recipes-sato/puzzles/oh-puzzles_git.bb +0 -1
@@ -59,7 +59,6 @@ FILES_${PN}-dbg += "/usr/games/.debug/*" FILES_${PN}-extra = "/usr/games/ /usr/share/applications /etc/gconf/schemas" python __anonymous () { - import bb var = bb.data.expand("FILES_${PN}", d, 1) data = d.getVar(var, True) for name in ("bridges", "fifteen", "inertia", "map", "samegame", "slant"):
meta/recipes-support/boost/boost.inc +0 -2
@@ -47,8 +47,6 @@ BOOST_LIBS = "\ # Make a package for each library, plus -dev PACKAGES = "${PN}-dbg ${BOOST_PACKAGES}" python __anonymous () { - import bb - packages = [] extras = [] for lib in d.getVar('BOOST_LIBS', True).split( ):
meta/recipes-support/pth/pth_2.0.7.bb +1 -1
@@ -6,7 +6,7 @@ LIC_FILES_CHKSUM = "file://COPYING;beginline=12;endline=15;md5=a48af114a80c222ca PR = "r2" python __anonymous () { - import bb, re + import re uc_os = (re.match('.*uclibc*', d.getVar('TARGET_OS', True)) != None) if uc_os: raise bb.parse.SkipPackage("incompatible with uClibc")