* [PATCH 00/16] Python 3 support (the beginning)
@ 2016-05-11 7:37 Ed Bartosh
2016-05-11 7:37 ` [PATCH 01/16] toaster: Remove DATABASE_URL being passed around as an environment var Ed Bartosh
` (15 more replies)
0 siblings, 16 replies; 17+ messages in thread
From: Ed Bartosh @ 2016-05-11 7:37 UTC (permalink / raw)
To: toaster
Hi,
This is first series of patches to make Toaster working in Python 3.
The series should not break Python 2 support. The code should be able to
work in both Python 2 and Python 3.
This patchset doesn't change build code as it uses bitbake from master.
This means that Toaster is not able to run builds in python 3 environment yet.
Build machinery will be addressed in the next series.
Test instructions:
1. fetch the branch and checkout to it: git fetch contrib ed/toaster/python3 && git checkout -b python3 contrib/ed/toaster/python3
2. Test if Toaster still works in current Python 2 setup.
3. Setup python 3 virtual environment: mkvirtualenv --python=/usr/bin/python3 toaster3
4. deactivate it as next step can't be done in python 3 environment: deactivate
5. initialize build environment: . oe-oe-init-build-env
6. switch to python3 virtual env: workon toaster3
7. move toaster database: mv toaster.sqlite toaster.sqlite.backup
7. run toaster: . ../bitbake/bin/toaster start
8. Check if toaster script starts properly, fetches the layers etc
9. Check if UI is accessible, that project can be created and basic functionality(excluding building)
is not broken.
The following changes since commit 0b717a9551d23579f5293e83655bc21e139bdaa2:
toaster: tests browser Add test for creating a project (2016-05-10 12:03:44 +0100)
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib ed/toaster/python3
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=ed/toaster/python3
Ed Bartosh (14):
toaster: use force_text instead of force_bytes
toaster: use print function in toaster script
toaster: get rid of using reduce
toaster: fix imports to work for python 3
toaster: fix local imports
toaster: modified list of dependencies
toaster: use decode('utf-8') for binary data
toaster: use items and range instead of old APIs
toaster: replace map with list comprehensions
toaster: use 'in' instead of has_key
toaster: use re.sub() instead of translate()
toaster: use new syntax of except statement
toaster: read timezone files in binary mode
toaster: moved import bb.server.xmlrpc
Michael Wood (1):
toaster: Remove DATABASE_URL being passed around as an environment var
Richard Purdie (1):
bin, toaster: Fix print and exception syntax
bitbake/bin/bitbake-diffsigs | 6 +-
bitbake/bin/bitbake-dumpsig | 4 +-
bitbake/bin/toaster | 6 +-
bitbake/lib/bb/ui/buildinfohelper.py | 20 +--
bitbake/lib/bb/utils.py | 6 +-
bitbake/lib/toaster/bldcontrol/bbcontroller.py | 4 +-
.../toaster/bldcontrol/localhostbecontroller.py | 4 +-
.../management/commands/checksettings.py | 20 +--
.../bldcontrol/management/commands/loadconf.py | 4 +-
.../bldcontrol/management/commands/runbuilds.py | 4 +-
bitbake/lib/toaster/bldcontrol/models.py | 4 +-
bitbake/lib/toaster/bldcontrol/tests.py | 4 +-
bitbake/lib/toaster/contrib/tts/config.py | 2 +-
.../contrib/tts/toasteruitest/run_toastertests.py | 4 +-
.../tts/toasteruitest/toaster_automation_test.py | 186 ++++++++++-----------
bitbake/lib/toaster/orm/models.py | 22 ++-
bitbake/lib/toaster/toastergui/api.py | 3 +-
bitbake/lib/toaster/toastergui/tablefilter.py | 2 +-
bitbake/lib/toaster/toastergui/tables.py | 3 +-
bitbake/lib/toaster/toastergui/views.py | 119 +++++++------
bitbake/lib/toaster/toastergui/widgets.py | 25 +--
.../toastermain/management/commands/builddelete.py | 2 +-
.../toastermain/management/commands/buildslist.py | 2 +-
.../toastermain/management/commands/get-dburl.py | 9 -
.../toastermain/management/commands/perf.py | 6 +-
bitbake/lib/toaster/toastermain/settings.py | 78 ++-------
bitbake/lib/toaster/toastermain/urls.py | 2 +-
bitbake/toaster-requirements.txt | 4 +-
28 files changed, 264 insertions(+), 291 deletions(-)
delete mode 100644 bitbake/lib/toaster/toastermain/management/commands/get-dburl.py
--
Regards,
Ed
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 01/16] toaster: Remove DATABASE_URL being passed around as an environment var
2016-05-11 7:37 [PATCH 00/16] Python 3 support (the beginning) Ed Bartosh
@ 2016-05-11 7:37 ` Ed Bartosh
2016-05-11 7:37 ` [PATCH 02/16] bin, toaster: Fix print and exception syntax Ed Bartosh
` (14 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Ed Bartosh @ 2016-05-11 7:37 UTC (permalink / raw)
To: toaster
From: Michael Wood <michael.g.wood@intel.com>
We don't need to pass the DATABASE_URL around and read it back if we
setup the django framework in the correct way.
We make the default sqlite database path a full path so that the
database isn't being assumed to be in CWD.
Also add some more useful comments on the database settings.
This is preparation work to migrate the build tests and be able to
trigger builds on differently configured databases.
Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
bitbake/bin/toaster | 2 -
bitbake/lib/bb/ui/buildinfohelper.py | 20 +++----
.../toastermain/management/commands/get-dburl.py | 9 ---
bitbake/lib/toaster/toastermain/settings.py | 67 ++++------------------
4 files changed, 20 insertions(+), 78 deletions(-)
delete mode 100644 bitbake/lib/toaster/toastermain/management/commands/get-dburl.py
diff --git a/bitbake/bin/toaster b/bitbake/bin/toaster
index 987d53c1..91716e6 100755
--- a/bitbake/bin/toaster
+++ b/bitbake/bin/toaster
@@ -100,7 +100,6 @@ stop_system()
fi
webserverKillAll
# unset exported variables
- unset DATABASE_URL
unset TOASTER_CONF
unset TOASTER_DIR
unset BITBAKE_UI
@@ -278,7 +277,6 @@ case $CMD in
return 4
fi
export BITBAKE_UI='toasterui'
- export DATABASE_URL=`$MANAGE get-dburl`
$MANAGE runbuilds & echo $! >${BUILDDIR}/.runbuilds.pid
# set fail safe stop system on terminal exit
trap stop_system SIGHUP
diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py
index 9397905..b07dc81 100644
--- a/bitbake/lib/bb/ui/buildinfohelper.py
+++ b/bitbake/lib/bb/ui/buildinfohelper.py
@@ -21,19 +21,19 @@ import bb
import re
import os
-os.environ["DJANGO_SETTINGS_MODULE"] = "toaster.toastermain.settings"
-
-
import django
from django.utils import timezone
+import toaster
+# Add toaster module to the search path to help django.setup() find the right
+# modules
+sys.path.insert(0, os.path.dirname(toaster.__file__))
-def _configure_toaster():
- """ Add toaster to sys path for importing modules
- """
- sys.path.append(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), 'toaster'))
-_configure_toaster()
-
+#Set the DJANGO_SETTINGS_MODULE if it's not already set
+os.environ["DJANGO_SETTINGS_MODULE"] =\
+ os.environ.get("DJANGO_SETTINGS_MODULE",
+ "toaster.toastermain.settings")
+# Setup django framework (needs to be done before importing modules)
django.setup()
from orm.models import Build, Task, Recipe, Layer_Version, Layer, Target, LogMessage, HelpText
@@ -54,11 +54,11 @@ from datetime import datetime, timedelta
from django.db import transaction, connection
+
# pylint: disable=invalid-name
# the logger name is standard throughout BitBake
logger = logging.getLogger("ToasterLogger")
-
class NotExisting(Exception):
pass
diff --git a/bitbake/lib/toaster/toastermain/management/commands/get-dburl.py b/bitbake/lib/toaster/toastermain/management/commands/get-dburl.py
deleted file mode 100644
index 22b3eb7..0000000
--- a/bitbake/lib/toaster/toastermain/management/commands/get-dburl.py
+++ /dev/null
@@ -1,9 +0,0 @@
-from toastermain.settings import getDATABASE_URL
-from django.core.management.base import NoArgsCommand
-
-class Command(NoArgsCommand):
- args = ""
- help = "get database url"
-
- def handle_noargs(self,**options):
- print getDATABASE_URL()
diff --git a/bitbake/lib/toaster/toastermain/settings.py b/bitbake/lib/toaster/toastermain/settings.py
index 74ab604..bb8503b 100644
--- a/bitbake/lib/toaster/toastermain/settings.py
+++ b/bitbake/lib/toaster/toastermain/settings.py
@@ -21,7 +21,7 @@
# Django settings for Toaster project.
-import os, re
+import os
DEBUG = True
TEMPLATE_DEBUG = DEBUG
@@ -38,14 +38,19 @@ ADMINS = (
MANAGERS = ADMINS
+TOASTER_SQLITE_DEFAULT_DIR = os.path.join(os.environ.get('TOASTER_DIR', ''),
+ 'build')
+
DATABASES = {
'default': {
- 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
- 'NAME': 'toaster.sqlite', # Or path to database file if using sqlite3.
+ # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
+ 'ENGINE': 'django.db.backends.sqlite3',
+ # DB name or full path to database file if using sqlite3.
+ 'NAME': "%s/toaster.sqlite" % TOASTER_SQLITE_DEFAULT_DIR,
'USER': '',
'PASSWORD': '',
- 'HOST': '127.0.0.1', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.
- 'PORT': '3306', # Set to empty string for default.
+ #'HOST': '127.0.0.1', # e.g. mysql server
+ #'PORT': '3306', # e.g. mysql port
}
}
@@ -55,58 +60,6 @@ DATABASES = {
if 'sqlite' in DATABASES['default']['ENGINE']:
DATABASES['default']['OPTIONS'] = { 'timeout': 20 }
-# Reinterpret database settings if we have DATABASE_URL environment variable defined
-
-if 'DATABASE_URL' in os.environ:
- dburl = os.environ['DATABASE_URL']
-
- if dburl.startswith('sqlite3://'):
- result = re.match('sqlite3://(.*)', dburl)
- if result is None:
- raise Exception("ERROR: Could not read sqlite database url: %s" % dburl)
- DATABASES['default'] = {
- 'ENGINE': 'django.db.backends.sqlite3',
- 'NAME': result.group(1),
- 'USER': '',
- 'PASSWORD': '',
- 'HOST': '',
- 'PORT': '',
- }
- elif dburl.startswith('mysql://'):
- # URL must be in this form: mysql://user:pass@host:port/name
- result = re.match(r"mysql://([^:]*):([^@]*)@([^:]*):(\d*)/([^/]*)", dburl)
- if result is None:
- raise Exception("ERROR: Could not read mysql database url: %s" % dburl)
- DATABASES['default'] = {
- 'ENGINE': 'django.db.backends.mysql',
- 'NAME': result.group(5),
- 'USER': result.group(1),
- 'PASSWORD': result.group(2),
- 'HOST': result.group(3),
- 'PORT': result.group(4),
- }
- else:
- raise Exception("FIXME: Please implement missing database url schema for url: %s" % dburl)
-
-
-# Allows current database settings to be exported as a DATABASE_URL environment variable value
-
-def getDATABASE_URL():
- d = DATABASES['default']
- if d['ENGINE'] == 'django.db.backends.sqlite3':
- if d['NAME'] == ':memory:':
- return 'sqlite3://:memory:'
- elif d['NAME'].startswith("/"):
- return 'sqlite3://' + d['NAME']
- return "sqlite3://" + os.path.join(os.getcwd(), d['NAME'])
-
- elif d['ENGINE'] == 'django.db.backends.mysql':
- return "mysql://" + d['USER'] + ":" + d['PASSWORD'] + "@" + d['HOST'] + ":" + d['PORT'] + "/" + d['NAME']
-
- raise Exception("FIXME: Please implement missing database url schema for engine: %s" % d['ENGINE'])
-
-
-
# Hosts/domain names that are valid for this site; required if DEBUG is False
# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
ALLOWED_HOSTS = []
--
2.1.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 02/16] bin, toaster: Fix print and exception syntax
2016-05-11 7:37 [PATCH 00/16] Python 3 support (the beginning) Ed Bartosh
2016-05-11 7:37 ` [PATCH 01/16] toaster: Remove DATABASE_URL being passed around as an environment var Ed Bartosh
@ 2016-05-11 7:37 ` Ed Bartosh
2016-05-11 7:37 ` [PATCH 03/16] toaster: use force_text instead of force_bytes Ed Bartosh
` (13 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Ed Bartosh @ 2016-05-11 7:37 UTC (permalink / raw)
To: toaster
From: Richard Purdie <richard.purdie@linuxfoundation.org>
This updates the print "" syntax to print() and fixes some exception
handling syntax such that its compatible with python v2 and v3.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
bitbake/bin/bitbake-diffsigs | 6 +-
bitbake/bin/bitbake-dumpsig | 4 +-
.../management/commands/checksettings.py | 18 +-
bitbake/lib/toaster/bldcontrol/tests.py | 4 +-
.../contrib/tts/toasteruitest/run_toastertests.py | 4 +-
.../tts/toasteruitest/toaster_automation_test.py | 186 ++++++++++-----------
bitbake/lib/toaster/toastergui/views.py | 2 +-
.../toastermain/management/commands/builddelete.py | 2 +-
.../toastermain/management/commands/buildslist.py | 2 +-
.../toastermain/management/commands/perf.py | 6 +-
bitbake/lib/toaster/toastermain/settings.py | 2 +-
11 files changed, 118 insertions(+), 118 deletions(-)
diff --git a/bitbake/bin/bitbake-diffsigs b/bitbake/bin/bitbake-diffsigs
index 196f0b7..67c60db 100755
--- a/bitbake/bin/bitbake-diffsigs
+++ b/bitbake/bin/bitbake-diffsigs
@@ -95,7 +95,7 @@ def find_compare_task(bbhandler, pn, taskname):
# Recurse into signature comparison
output = bb.siggen.compare_sigfiles(latestfiles[0], latestfiles[1], recursecb)
if output:
- print '\n'.join(output)
+ print('\n'.join(output))
sys.exit(0)
@@ -130,9 +130,9 @@ else:
except IOError as e:
logger.error(str(e))
sys.exit(1)
- except cPickle.UnpicklingError, EOFError:
+ except (pickle.UnpicklingError, EOFError):
logger.error('Invalid signature data - ensure you are specifying sigdata/siginfo files')
sys.exit(1)
if output:
- print '\n'.join(output)
+ print('\n'.join(output))
diff --git a/bitbake/bin/bitbake-dumpsig b/bitbake/bin/bitbake-dumpsig
index 656d93a..ffaed1f 100755
--- a/bitbake/bin/bitbake-dumpsig
+++ b/bitbake/bin/bitbake-dumpsig
@@ -57,9 +57,9 @@ else:
except IOError as e:
logger.error(str(e))
sys.exit(1)
- except cPickle.UnpicklingError, EOFError:
+ except (pickle.UnpicklingError, EOFError):
logger.error('Invalid signature data - ensure you are specifying a sigdata/siginfo file')
sys.exit(1)
if output:
- print '\n'.join(output)
+ print('\n'.join(output))
diff --git a/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py b/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py
index 5e70437..6b1da1b 100644
--- a/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py
+++ b/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py
@@ -70,11 +70,11 @@ class Command(NoArgsCommand):
return True
if len(be.sourcedir) == 0:
- print "\n -- Validation: The layers checkout directory must be set."
+ print("\n -- Validation: The layers checkout directory must be set.")
is_changed = _update_sourcedir()
if not be.sourcedir.startswith("/"):
- print "\n -- Validation: The layers checkout directory must be set to an absolute path."
+ print("\n -- Validation: The layers checkout directory must be set to an absolute path.")
is_changed = _update_sourcedir()
if is_changed:
@@ -87,16 +87,16 @@ class Command(NoArgsCommand):
return True
if len(be.builddir) == 0:
- print "\n -- Validation: The build directory must be set."
+ print("\n -- Validation: The build directory must be set.")
is_changed = _update_builddir()
if not be.builddir.startswith("/"):
- print "\n -- Validation: The build directory must to be set to an absolute path."
+ print("\n -- Validation: The build directory must to be set to an absolute path.")
is_changed = _update_builddir()
if is_changed:
- print "\nBuild configuration saved"
+ print("\nBuild configuration saved")
be.save()
return True
@@ -104,20 +104,20 @@ class Command(NoArgsCommand):
if be.needs_import:
try:
config_file = os.environ.get('TOASTER_CONF')
- print "\nImporting file: %s" % config_file
+ print("\nImporting file: %s" % config_file)
from loadconf import Command as LoadConfigCommand
LoadConfigCommand()._import_layer_config(config_file)
# we run lsupdates after config update
- print "\nLayer configuration imported. Updating information from the layer sources, please wait.\nYou can re-update any time later by running bitbake/lib/toaster/manage.py lsupdates"
+ print("\nLayer configuration imported. Updating information from the layer sources, please wait.\nYou can re-update any time later by running bitbake/lib/toaster/manage.py lsupdates")
from django.core.management import call_command
call_command("lsupdates")
# we don't look for any other config files
return is_changed
except Exception as e:
- print "Failure while trying to import the toaster config file %s: %s" %\
- (config_file, e)
+ print("Failure while trying to import the toaster config file %s: %s" %\
+ (config_file, e))
traceback.print_exc(e)
return is_changed
diff --git a/bitbake/lib/toaster/bldcontrol/tests.py b/bitbake/lib/toaster/bldcontrol/tests.py
index f20cc7d..32985c3 100644
--- a/bitbake/lib/toaster/bldcontrol/tests.py
+++ b/bitbake/lib/toaster/bldcontrol/tests.py
@@ -53,7 +53,7 @@ class BEControllerTests(object):
# setting layers, skip any layer info
bc.setLayers(BITBAKE_LAYER, POKY_LAYERS)
except NotImplementedError:
- print "Test skipped due to command not implemented yet"
+ print("Test skipped due to command not implemented yet")
return True
# We are ok with the exception as we're handling the git already exists
except BuildSetupException:
@@ -79,7 +79,7 @@ class BEControllerTests(object):
# setting layers, skip any layer info
layerSet = bc.setLayers(BITBAKE_LAYER, POKY_LAYERS)
except NotImplementedError:
- print "Test skipped due to command not implemented yet"
+ print("Test skipped due to command not implemented yet")
return True
# We are ok with the exception as we're handling the git already exists
except BuildSetupException:
diff --git a/bitbake/lib/toaster/contrib/tts/toasteruitest/run_toastertests.py b/bitbake/lib/toaster/contrib/tts/toasteruitest/run_toastertests.py
index 754636f..8ca45a8 100755
--- a/bitbake/lib/toaster/contrib/tts/toasteruitest/run_toastertests.py
+++ b/bitbake/lib/toaster/contrib/tts/toasteruitest/run_toastertests.py
@@ -74,7 +74,7 @@ def get_tests_from_cfg(suite=None):
try:
tests_from_cfg = eval(config.get('toaster_test_' + target_suite, 'test_cases'))
except:
- print 'Failed to get test cases from cfg file. Make sure the format is correct.'
+ print('Failed to get test cases from cfg file. Make sure the format is correct.')
return None
prefix = 'toaster_automation_test.toaster_cases.test_'
@@ -100,7 +100,7 @@ def main():
testslist = get_tests_from_cfg()
if not testslist:
- print 'Failed to get test cases.'
+ print('Failed to get test cases.')
exit(1)
suite = unittest.TestSuite()
diff --git a/bitbake/lib/toaster/contrib/tts/toasteruitest/toaster_automation_test.py b/bitbake/lib/toaster/contrib/tts/toasteruitest/toaster_automation_test.py
index d8f838a..1a786fa 100755
--- a/bitbake/lib/toaster/contrib/tts/toasteruitest/toaster_automation_test.py
+++ b/bitbake/lib/toaster/contrib/tts/toasteruitest/toaster_automation_test.py
@@ -61,7 +61,7 @@ def get_log_root_dir():
break
if number == (max_depth - 1):
- print 'No log dir found. Please check'
+ print('No log dir found. Please check')
raise Exception
return log_root_dir
@@ -152,7 +152,7 @@ def is_list_sequenced(testlist):
return (sorted(list_number) == list_number)
else:
- print 'Unrecognized list type, please check'
+ print('Unrecognized list type, please check')
return False
@@ -201,7 +201,7 @@ def is_list_inverted(testlist):
return (sorted(list_number, reverse = True) == list_number)
else:
- print 'Unrecognized list type, please check'
+ print('Unrecognized list type, please check')
return False
def replace_file_content(filename, item, option):
@@ -361,7 +361,7 @@ class toaster_cases_base(unittest.TestCase):
def setup_browser(self, *browser_path):
self.browser = eval(self.parser.get('toaster_test_' + self.target_suite, 'test_browser'))
- print self.browser
+ print(self.browser)
if self.browser == "firefox":
driver = webdriver.Firefox()
elif self.browser == "chrome":
@@ -370,7 +370,7 @@ class toaster_cases_base(unittest.TestCase):
driver = webdriver.Ie()
else:
driver = None
- print "unrecognized browser type, please check"
+ print("unrecognized browser type, please check")
self.driver = driver
self.driver.implicitly_wait(30)
return self.driver
@@ -440,8 +440,8 @@ class toaster_cases_base(unittest.TestCase):
try:
table_element = self.get_table_element(table_id)
element = table_element.find_element_by_xpath("//*[text()='" + text_string + "']")
- except NoSuchElementException, e:
- print 'no element found'
+ except NoSuchElementException as e:
+ print('no element found')
raise
return element
@@ -454,8 +454,8 @@ class toaster_cases_base(unittest.TestCase):
try:
table_element = self.get_table_element(table_id)
element = table_element.find_element_by_link_text(link_text)
- except NoSuchElementException, e:
- print 'no element found'
+ except NoSuchElementException as e:
+ print('no element found')
raise
return element
@@ -467,8 +467,8 @@ class toaster_cases_base(unittest.TestCase):
try:
table_element = self.get_table_element(table_id)
element_list = table_element.find_elements_by_link_text(link_text)
- except NoSuchElementException, e:
- print 'no element found'
+ except NoSuchElementException as e:
+ print('no element found')
raise
return element_list
@@ -481,8 +481,8 @@ class toaster_cases_base(unittest.TestCase):
table_element = self.get_table_element(table_id)
element = table_element.find_element_by_partial_link_text(link_text)
return element
- except NoSuchElementException, e:
- print 'no element found'
+ except NoSuchElementException as e:
+ print('no element found')
raise
@@ -494,8 +494,8 @@ class toaster_cases_base(unittest.TestCase):
table_element = self.get_table_element(table_id)
element_list = table_element.find_elements_by_partial_link_text(link_text)
return element_list
- except NoSuchElementException, e:
- print 'no element found'
+ except NoSuchElementException as e:
+ print('no element found')
raise
@@ -506,8 +506,8 @@ class toaster_cases_base(unittest.TestCase):
try:
table_element = self.get_table_element(table_id)
element = table_element.find_element_by_xpath(xpath)
- except NoSuchElementException, e:
- print 'no element found'
+ except NoSuchElementException as e:
+ print('no element found')
raise
return element
@@ -519,8 +519,8 @@ class toaster_cases_base(unittest.TestCase):
try:
table_element = self.get_table_element(table_id)
element_list = table_element.find_elements_by_xpath(xpath)
- except NoSuchElementException, e:
- print 'no elements found'
+ except NoSuchElementException as e:
+ print('no elements found')
raise
return element_list
@@ -570,7 +570,7 @@ class toaster_cases_base(unittest.TestCase):
element_xpath = "//*[@id='" + table_id + "']"
try:
element = self.driver.find_element_by_xpath(element_xpath)
- except NoSuchElementException, e:
+ except NoSuchElementException as e:
raise
return element
row = coordinate[0]
@@ -580,7 +580,7 @@ class toaster_cases_base(unittest.TestCase):
element_xpath = "//*[@id='" + table_id + "']/tbody/tr[" + str(row) + "]"
try:
element = self.driver.find_element_by_xpath(element_xpath)
- except NoSuchElementException, e:
+ except NoSuchElementException as e:
return False
return element
#now we are looking for an element with specified X and Y
@@ -589,7 +589,7 @@ class toaster_cases_base(unittest.TestCase):
element_xpath = "//*[@id='" + table_id + "']/tbody/tr[" + str(row) + "]/td[" + str(column) + "]"
try:
element = self.driver.find_element_by_xpath(element_xpath)
- except NoSuchElementException, e:
+ except NoSuchElementException as e:
return False
return element
@@ -607,7 +607,7 @@ class toaster_cases_base(unittest.TestCase):
column = column + 1
print("row_content=",row_content)
Lists.extend(row_content)
- print Lists[row-1][0]
+ print(Lists[row-1][0])
row = row + 1
return Lists
@@ -617,7 +617,7 @@ class toaster_cases_base(unittest.TestCase):
def is_text_present (self, patterns):
for pattern in patterns:
if str(pattern) not in self.driver.page_source:
- print 'Text "'+pattern+'" is missing'
+ print('Text "'+pattern+'" is missing')
return False
return True
@@ -625,15 +625,15 @@ class toaster_cases_base(unittest.TestCase):
def is_element_present(self, how, what):
try:
self.driver.find_element(how, what)
- except NoSuchElementException, e:
- print 'Could not find element '+str(what)+' by ' + str(how)
+ except NoSuchElementException as e:
+ print('Could not find element '+str(what)+' by ' + str(how))
return False
return True
def is_alert_present(self):
try: self.driver.switch_to_alert()
- except NoAlertPresentException, e: return False
+ except NoAlertPresentException as e: return False
return True
@@ -658,7 +658,7 @@ class toaster_cases_base(unittest.TestCase):
try:
caseno = int(caseno_str)
except ValueError:
- print "get case number error! please check if func name is test_xxx"
+ print("get case number error! please check if func name is test_xxx")
return False
return caseno
@@ -706,7 +706,7 @@ class toaster_cases(toaster_cases_base):
for key in table_head_dict:
try:
self.driver.find_element_by_link_text(key).click()
- except Exception, e:
+ except Exception as e:
self.log.error("%s cannot be found on page" % key)
raise
column_list = self.get_table_column_text("class", table_head_dict[key])
@@ -736,7 +736,7 @@ class toaster_cases(toaster_cases_base):
patterns = ["minimal", "sato"]
for pattern in patterns:
ori_target_column_texts = self.get_table_column_text("class", "target")
- print ori_target_column_texts
+ print(ori_target_column_texts)
self.driver.find_element_by_id("search").clear()
self.driver.find_element_by_id("search").send_keys(pattern)
self.driver.find_element_by_id("search-button").click()
@@ -771,7 +771,7 @@ class toaster_cases(toaster_cases_base):
temp_element = self.find_element_by_text_in_table('otable', item)
# this is how we find "filter icon" in the same level as temp_element(where "a" means clickable, "i" means icon)
self.assertTrue(temp_element.find_element_by_xpath("..//*/a/i[@class='icon-filter filtered']"))
- except Exception,e:
+ except Exception as e:
self.assertFalse(True, msg=(" %s cannot be found! %s" % (item, e)))
raise
# step 5-6
@@ -812,7 +812,7 @@ class toaster_cases(toaster_cases_base):
self.table_name = 'otable'
# This is how we find the "default" rows-number!
rows_displayed = int(Select(self.driver.find_element_by_css_selector("select.pagesize")).first_selected_option.text)
- print rows_displayed
+ print(rows_displayed)
self.assertTrue(self.get_table_element(self.table_name, rows_displayed), msg=("not enough rows displayed"))
self.assertFalse(self.get_table_element(self.table_name, rows_displayed + 1), \
msg=("more rows displayed than expected"))
@@ -888,7 +888,7 @@ class toaster_cases(toaster_cases_base):
temp_element.find_element_by_xpath("..//*[@class='icon-filter filtered']").click()
avail_options = self.driver.find_elements_by_xpath("//*[@id='" + filter_dict[key] + "']//*[@name='filter'][not(@disabled)]")
except:
- print "in exception"
+ print("in exception")
self.find_element_by_text("Show all tasks").click()
# self.driver.find_element_by_xpath("//*[@id='searchform']/button[2]").click()
temp_element = self.find_element_by_link_text_in_table(self.table_name, key)
@@ -899,9 +899,9 @@ class toaster_cases(toaster_cases_base):
for item in ['order', 'task_name', 'executed', 'outcome', 'recipe_name', 'recipe_version']:
try:
self.find_element_by_xpath_in_table(self.table_name, "./tbody/tr[1]/*[@class='" + item + "']/a").click()
- except NoSuchElementException, e:
+ except NoSuchElementException as e:
# let it go...
- print 'no item in the colum' + item
+ print('no item in the colum' + item)
# insert screen shot here
self.save_screenshot(screenshot_type='selenium', append_name='step11')
self.driver.back()
@@ -992,13 +992,13 @@ class toaster_cases(toaster_cases_base):
self.table_name = 'otable'
# This is how we find the "default" rows-number!
rows_displayed = int(Select(self.driver.find_element_by_css_selector("select.pagesize")).first_selected_option.text)
- print rows_displayed
+ print(rows_displayed)
self.assertTrue(self.get_table_element(self.table_name, rows_displayed))
self.assertFalse(self.get_table_element(self.table_name, rows_displayed + 1))
# Check the default table is sorted by Recipe
tasks_column_count = len(self.driver.find_elements_by_xpath("/html/body/div[2]/div/div[2]/div[2]/table/tbody/tr/td[1]"))
- print tasks_column_count
+ print(tasks_column_count)
default_column_list = self.get_table_column_text_by_column_number(self.table_name, 1)
#print default_column_list
@@ -1095,7 +1095,7 @@ class toaster_cases(toaster_cases_base):
# Bug 5919
for key in table_head_dict:
- print key
+ print(key)
self.find_element_by_link_text_in_table(self.table_name, key).click()
self.driver.find_element_by_id("edit-columns-button").click()
self.driver.find_element_by_id(table_head_dict[key]).click()
@@ -1167,7 +1167,7 @@ class toaster_cases(toaster_cases_base):
check_list = ['Dependencies', 'Layer branch', 'Layer commit', 'Reverse dependencies']
head_list = self.get_table_head_text('otable')
time.sleep(2)
- print head_list
+ print(head_list)
for item in check_list:
self.assertTrue(item in head_list, msg=("item %s not in head row" % item))
# un-check 'em all
@@ -1226,8 +1226,8 @@ class toaster_cases(toaster_cases_base):
tasks_row_count = len(driver.find_elements_by_xpath("//*[@id='"+self.table_name+"']/table/tbody/tr/td[1]"))
tasks_column_count = len(driver.find_elements_by_xpath("//*[@id='"+self.table_name+"']/table/tbody/tr[1]/td"))
- print 'rows: '+str(tasks_row_count)
- print 'columns: '+str(tasks_column_count)
+ print('rows: '+str(tasks_row_count))
+ print('columns: '+str(tasks_column_count))
Tasks_column = self.get_table_column_text_by_column_number(self.table_name, 2)
print ("Tasks_column=", Tasks_column)
@@ -1253,9 +1253,9 @@ class toaster_cases(toaster_cases_base):
driver.find_element_by_partial_link_text("Packages (").click()
packages_name = driver.find_element_by_partial_link_text("Packages (").text
- print packages_name
+ print(packages_name)
packages_num = int(filter(str.isdigit, repr(packages_name)))
- print packages_num
+ print(packages_num)
#switch the table to show more than 10 rows at a time
self.driver.find_element_by_xpath("//*[@id='packages-built']/div[1]/div/select").click()
@@ -1263,7 +1263,7 @@ class toaster_cases(toaster_cases_base):
self.driver.find_element_by_xpath("//*[@id='packages-built']/div[1]/div/select").send_keys(Keys.ENTER)
packages_row_count = len(driver.find_elements_by_xpath("//*[@id='otable']/tbody/tr/td[1]"))
- print packages_row_count
+ print(packages_row_count)
if packages_num != packages_row_count:
print ("Error! The packages number is not correct")
@@ -1272,20 +1272,20 @@ class toaster_cases(toaster_cases_base):
driver.find_element_by_partial_link_text("Build dependencies (").click()
depends_name = driver.find_element_by_partial_link_text("Build dependencies (").text
- print depends_name
- depends_num = int(filter(str.isdigit, repr(depends_name)))
- print depends_num
+ print(depends_name)
+ depends_num = int(list(filter(str.isdigit, repr(depends_name))))
+ print(depends_num)
if depends_num == 0:
depends_message = repr(driver.find_element_by_css_selector("div.alert.alert-info").text)
- print depends_message
+ print(depends_message)
if depends_message.find("has no build dependencies.") < 0:
print ("Error! The message isn't expected.")
else:
print ("The message is expected")
else:
depends_row_count = len(driver.find_elements_by_xpath("//*[@id='dependencies']/table/tbody/tr/td[1]"))
- print depends_row_count
+ print(depends_row_count)
if depends_num != depends_row_count:
print ("Error! The dependent packages number is not correct")
else:
@@ -1293,13 +1293,13 @@ class toaster_cases(toaster_cases_base):
driver.find_element_by_partial_link_text("Reverse build dependencies (").click()
rdepends_name = driver.find_element_by_partial_link_text("Reverse build dependencies (").text
- print rdepends_name
+ print(rdepends_name)
rdepends_num = int(filter(str.isdigit, repr(rdepends_name)))
- print rdepends_num
+ print(rdepends_num)
if rdepends_num == 0:
rdepends_message = repr(driver.find_element_by_css_selector("#brought-in-by > div.alert.alert-info").text)
- print rdepends_message
+ print(rdepends_message)
if rdepends_message.find("has no reverse build dependencies.") < 0:
print ("Error! The message isn't expected.")
else:
@@ -1319,8 +1319,8 @@ class toaster_cases(toaster_cases_base):
native_tasks_row_count = len(driver.find_elements_by_xpath("//*[@id='information']/table/tbody/tr/td[1]"))
native_tasks_column_count = len(driver.find_elements_by_xpath("//*[@id='information']/table/tbody/tr[1]/td"))
- print native_tasks_row_count
- print native_tasks_column_count
+ print(native_tasks_row_count)
+ print(native_tasks_column_count)
Native_Tasks_column = self.get_table_column_text_by_column_number(self.table_name, 2)
print ("Native_Tasks_column=", Native_Tasks_column)
@@ -1346,15 +1346,15 @@ class toaster_cases(toaster_cases_base):
driver.find_element_by_partial_link_text("Packages (").click()
native_packages_name = driver.find_element_by_partial_link_text("Packages (").text
- print native_packages_name
+ print(native_packages_name)
native_packages_num = int(filter(str.isdigit, repr(native_packages_name)))
- print native_packages_num
+ print(native_packages_num)
if native_packages_num != 0:
print ("Error! Native task shouldn't have any packages.")
else:
native_package_message = repr(driver.find_element_by_css_selector("#packages-built > div.alert.alert-info").text)
- print native_package_message
+ print(native_package_message)
if native_package_message.find("does not build any packages.") < 0:
print ("Error! The message for native task isn't expected.")
else:
@@ -1362,12 +1362,12 @@ class toaster_cases(toaster_cases_base):
driver.find_element_by_partial_link_text("Build dependencies (").click()
native_depends_name = driver.find_element_by_partial_link_text("Build dependencies (").text
- print native_depends_name
+ print(native_depends_name)
native_depends_num = int(filter(str.isdigit, repr(native_depends_name)))
- print native_depends_num
+ print(native_depends_num)
native_depends_row_count = len(driver.find_elements_by_xpath("//*[@id='dependencies']/table/tbody/tr/td[1]"))
- print native_depends_row_count
+ print(native_depends_row_count)
if native_depends_num != native_depends_row_count:
print ("Error! The dependent packages number is not correct")
@@ -1376,12 +1376,12 @@ class toaster_cases(toaster_cases_base):
driver.find_element_by_partial_link_text("Reverse build dependencies (").click()
native_rdepends_name = driver.find_element_by_partial_link_text("Reverse build dependencies (").text
- print native_rdepends_name
+ print(native_rdepends_name)
native_rdepends_num = int(filter(str.isdigit, repr(native_rdepends_name)))
- print native_rdepends_num
+ print(native_rdepends_num)
native_rdepends_row_count = len(driver.find_elements_by_xpath("//*[@id='brought-in-by']/table/tbody/tr/td[1]"))
- print native_rdepends_row_count
+ print(native_rdepends_row_count)
if native_rdepends_num != native_rdepends_row_count:
print ("Error! The reverse dependent packages number is not correct")
@@ -1413,8 +1413,8 @@ class toaster_cases(toaster_cases_base):
# step 5
self.driver.find_element_by_css_selector("i.icon-remove").click()
head_list = self.get_table_head_text('otable')
- print head_list
- print len(head_list)
+ print(head_list)
+ print(len(head_list))
self.assertTrue(head_list == ['Variable', 'Value', 'Set in file', 'Description'], \
msg=("head row contents wrong"))
# step 8
@@ -1830,7 +1830,7 @@ class toaster_cases(toaster_cases_base):
try:
self.driver.find_element_by_partial_link_text("Packages included")
self.driver.find_element_by_partial_link_text("Directory structure")
- except Exception,e:
+ except Exception as e:
self.log.error(e)
self.assertFalse(True)
# step 4
@@ -2014,13 +2014,13 @@ class toaster_cases(toaster_cases_base):
for i in range(0,4):
data[i] = data[i][0]
data.sort()
- print data
+ print(data)
json_parse = json.loads(open('toasterconf.json').read())
json_data = []
for i in range (0,4):
json_data.append(json_parse['releases'][i]['name'])
json_data.sort()
- print json_data
+ print(json_data)
self.failUnless(data == json_data)
##############
@@ -2036,11 +2036,11 @@ class toaster_cases(toaster_cases_base):
data = cursor.fetchall()
for i in range(0,6):
data[i] = data[i][0]
- print data
+ print(data)
json_parse = json.loads(open('toasterconf.json').read())
json_data=json_parse['config']
json_data = json_data.values()
- print json_data
+ print(json_data)
self.failUnless(data == json_data)
@@ -2057,12 +2057,12 @@ class toaster_cases(toaster_cases_base):
data = cursor.fetchall()
for i in range(0,3):
data[i] = data[i][0]
- print data
+ print(data)
json_parse = json.loads(open('toasterconf.json').read())
json_data = []
for i in range(0,3):
json_data.append(json_parse['layersources'][i]['name'])
- print json_data
+ print(json_data)
self.failUnless(set(data) == set(json_data))
##############
@@ -2077,10 +2077,10 @@ class toaster_cases(toaster_cases_base):
cursor.execute(query)
data = cursor.fetchall()
data = data[0][0]
- print data
+ print(data)
json_parse = json.loads(open('toasterconf.json').read())
json_data = json_parse['defaultrelease']
- print json_data
+ print(json_data)
self.failUnless(set(data) == set(json_data))
##############
@@ -2090,7 +2090,7 @@ class toaster_cases(toaster_cases_base):
self.case_no = self.get_case_number()
self.log.info(' CASE %s log: ' % str(self.case_no))
- print 'Checking branches for "Local Yocto Project"'
+ print('Checking branches for "Local Yocto Project"')
con=sqlite.connect('toaster.sqlite')
cursor = con.cursor()
query = "select name from orm_branch where layer_source_id=1;"
@@ -2102,15 +2102,15 @@ class toaster_cases(toaster_cases_base):
data[i] = data[i][0]
except:
pass
- print data
+ print(data)
json_parse = json.loads(open('toasterconf.json').read())
json_location = json_parse['layersources'][0]['name']
- print json_location
+ print(json_location)
json_data = json_parse['layersources'][0]['branches']
- print json_data
+ print(json_data)
self.failUnless(set(data) == set(json_data))
- print 'Checking branches for "OpenEmbedded"'
+ print('Checking branches for "OpenEmbedded"')
con=sqlite.connect('toaster.sqlite')
cursor = con.cursor()
query = "select name from orm_branch where layer_source_id=3;"
@@ -2119,15 +2119,15 @@ class toaster_cases(toaster_cases_base):
lenght = len(data)
for i in range(0,lenght):
data[i] = data[i][0]
- print data
+ print(data)
json_parse = json.loads(open('toasterconf.json').read())
json_location = json_parse['layersources'][1]['name']
- print json_location
+ print(json_location)
json_data = json_parse['layersources'][1]['branches']
- print json_data
+ print(json_data)
self.failUnless(set(data) == set(json_data))
- print 'Checking branches for "Imported layers"'
+ print('Checking branches for "Imported layers"')
con=sqlite.connect('toaster.sqlite')
cursor = con.cursor()
query = "select name from orm_branch where layer_source_id=2;"
@@ -2136,12 +2136,12 @@ class toaster_cases(toaster_cases_base):
lenght = len(data)
for i in range(0,lenght):
data[i] = data[i][0]
- print data
+ print(data)
json_parse = json.loads(open('toasterconf.json').read())
json_location = json_parse['layersources'][2]['name']
- print json_location
+ print(json_location)
json_data = json_parse['layersources'][2]['branches']
- print json_data
+ print(json_data)
self.failUnless(set(data) == set(json_data))
@@ -2158,12 +2158,12 @@ class toaster_cases(toaster_cases_base):
data = cursor.fetchall()
for i in range(0,4):
data[i] = data[i][0]
- print data
+ print(data)
json_parse = json.loads(open('toasterconf.json').read())
json_data = []
for i in range(0,4):
json_data.append(json_parse['bitbake'][i]['name'])
- print json_data
+ print(json_data)
self.failUnless(set(data) == set(json_data))
##############
@@ -2182,7 +2182,7 @@ class toaster_cases(toaster_cases_base):
query = "select count(name) from orm_project where name = 'new-test-project';"
cursor.execute(query)
data = cursor.fetchone()
- print 'data: %s' % data
+ print('data: %s' % data)
self.failUnless(data >= 1)
##############
@@ -2275,7 +2275,7 @@ class toaster_cases(toaster_cases_base):
data = data[0][0]
except:
pass
- print data
+ print(data)
self.failUnless(data == 'toaster_admin')
##############
@@ -2324,7 +2324,7 @@ class toaster_cases(toaster_cases_base):
query = "select a.name, a.value from orm_projectvariable a, orm_project b where a.project_id = b.id and b.name = 'new-default-project';"
cursor.execute(query)
data = dict(cursor.fetchall())
- print data
+ print(data)
default_values = {u'IMAGE_INSTALL_append': u'', u'PACKAGE_CLASSES': u'package_rpm', u'MACHINE': u'qemux86', u'SDKMACHINE': u'x86_64', u'DISTRO': u'poky', u'IMAGE_FSTYPES': u'ext3 jffs2 tar.bz2'}
self.failUnless(data == default_values)
@@ -2341,7 +2341,7 @@ class toaster_cases(toaster_cases_base):
query = "select layercommit_id from orm_projectlayer a, orm_project b where a.project_id=b.id and b.name='new-default-project';"
cursor.execute(query)
data_initial = cursor.fetchall()
- print data_initial
+ print(data_initial)
self.driver.maximize_window()
self.driver.get('localhost:8000')#self.base_url)
@@ -2362,7 +2362,7 @@ class toaster_cases(toaster_cases_base):
query = "select layercommit_id from orm_projectlayer a, orm_project b where a.project_id=b.id and b.name='new-default-project';"
cursor.execute(query)
data_changed = cursor.fetchall()
- print data_changed
+ print(data_changed)
#resetting release to default
self.driver.find_element_by_id('release-change-toggle').click()
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index bd5bf63..b7c674a 100755
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -910,7 +910,7 @@ def _get_dir_entries(build_id, target_id, start):
response.append(entry)
except Exception as e:
- print "Exception ", e
+ print("Exception ", e)
traceback.print_exc(e)
# sort by directories first, then by name
diff --git a/bitbake/lib/toaster/toastermain/management/commands/builddelete.py b/bitbake/lib/toaster/toastermain/management/commands/builddelete.py
index ff93e54..0bef8d4 100644
--- a/bitbake/lib/toaster/toastermain/management/commands/builddelete.py
+++ b/bitbake/lib/toaster/toastermain/management/commands/builddelete.py
@@ -15,7 +15,7 @@ class Command(BaseCommand):
try:
b = Build.objects.get(pk = bid)
except ObjectDoesNotExist:
- print 'build %s does not exist, skipping...' %(bid)
+ print('build %s does not exist, skipping...' %(bid))
continue
# theoretically, just b.delete() would suffice
# however SQLite runs into problems when you try to
diff --git a/bitbake/lib/toaster/toastermain/management/commands/buildslist.py b/bitbake/lib/toaster/toastermain/management/commands/buildslist.py
index cad987f..8dfef0a 100644
--- a/bitbake/lib/toaster/toastermain/management/commands/buildslist.py
+++ b/bitbake/lib/toaster/toastermain/management/commands/buildslist.py
@@ -10,4 +10,4 @@ class Command(NoArgsCommand):
def handle_noargs(self,**options):
for b in Build.objects.all():
- print "%d: %s %s %s" % (b.pk, b.machine, b.distro, ",".join([x.target for x in b.target_set.all()]))
+ print("%d: %s %s %s" % (b.pk, b.machine, b.distro, ",".join([x.target for x in b.target_set.all()])))
diff --git a/bitbake/lib/toaster/toastermain/management/commands/perf.py b/bitbake/lib/toaster/toastermain/management/commands/perf.py
index 71a48e9..6b450bb 100644
--- a/bitbake/lib/toaster/toastermain/management/commands/perf.py
+++ b/bitbake/lib/toaster/toastermain/management/commands/perf.py
@@ -25,7 +25,7 @@ class Command(BaseCommand):
info = self.url_info(full_url)
status_code = info[0]
load_time = info[1]
- print 'Trying \'' + full_url + '\', ' + str(status_code) + ', ' + str(load_time)
+ print('Trying \'' + full_url + '\', ' + str(status_code) + ', ' + str(load_time))
def get_full_url(self, url_patt, url_root_res):
full_url = str(url_patt).split('^')[1].replace('$>', '').replace('(?P<file_path>(?:/[', '/bin/busybox').replace('.*', '')
@@ -54,5 +54,5 @@ class Command(BaseCommand):
def error(self, *args):
for arg in args:
- print >>sys.stderr, arg,
- print >>sys.stderr
+ print(arg, end=' ', file=sys.stderr)
+ print(file=sys.stderr)
diff --git a/bitbake/lib/toaster/toastermain/settings.py b/bitbake/lib/toaster/toastermain/settings.py
index bb8503b..adcf707 100644
--- a/bitbake/lib/toaster/toastermain/settings.py
+++ b/bitbake/lib/toaster/toastermain/settings.py
@@ -91,7 +91,7 @@ else:
try:
if pytz.timezone(zonename) is not None:
zonefilelist[hashlib.md5(open(filepath).read()).hexdigest()] = zonename
- except UnknownTimeZoneError, ValueError:
+ except UnknownTimeZoneError as ValueError:
# we expect timezone failures here, just move over
pass
except ImportError:
--
2.1.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 03/16] toaster: use force_text instead of force_bytes
2016-05-11 7:37 [PATCH 00/16] Python 3 support (the beginning) Ed Bartosh
2016-05-11 7:37 ` [PATCH 01/16] toaster: Remove DATABASE_URL being passed around as an environment var Ed Bartosh
2016-05-11 7:37 ` [PATCH 02/16] bin, toaster: Fix print and exception syntax Ed Bartosh
@ 2016-05-11 7:37 ` Ed Bartosh
2016-05-11 7:37 ` [PATCH 04/16] toaster: use print function in toaster script Ed Bartosh
` (12 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Ed Bartosh @ 2016-05-11 7:37 UTC (permalink / raw)
To: toaster
Usage of force_bytes in BuildRequest.__str__ method caused
python 3 to throw "__str__ returned non-string (type bytes)"
error.
Replaced force_bytes with force_text to make the code working
on both python 2 and python 3.
[YOCTO #9584]
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py | 4 ++--
bitbake/lib/toaster/bldcontrol/models.py | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py b/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py
index 27289be..f7cb581 100644
--- a/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py
+++ b/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py
@@ -54,8 +54,8 @@ class Command(NoArgsCommand):
logger.debug("runbuilds: No build env")
return
- logger.debug("runbuilds: starting build %s, environment %s" % \
- (str(br).decode('utf-8'), bec.be))
+ logger.info("runbuilds: starting build %s, environment %s" % \
+ (br, bec.be))
# let the build request know where it is being executed
br.environment = bec.be
diff --git a/bitbake/lib/toaster/bldcontrol/models.py b/bitbake/lib/toaster/bldcontrol/models.py
index cb49a58..827e80d 100644
--- a/bitbake/lib/toaster/bldcontrol/models.py
+++ b/bitbake/lib/toaster/bldcontrol/models.py
@@ -1,7 +1,7 @@
from __future__ import unicode_literals
from django.db import models
from django.core.validators import MaxValueValidator, MinValueValidator
-from django.utils.encoding import force_bytes
+from django.utils.encoding import force_text
from orm.models import Project, ProjectLayer, ProjectVariable, ProjectTarget, Build, Layer_Version
import logging
@@ -121,7 +121,7 @@ class BuildRequest(models.Model):
return self.brvariable_set.get(name="MACHINE").value
def __str__(self):
- return force_bytes('%s %s' % (self.project, self.get_state_display()))
+ return force_text('%s %s' % (self.project, self.get_state_display()))
# These tables specify the settings for running an actual build.
# They MUST be kept in sync with the tables in orm.models.Project*
--
2.1.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 04/16] toaster: use print function in toaster script
2016-05-11 7:37 [PATCH 00/16] Python 3 support (the beginning) Ed Bartosh
` (2 preceding siblings ...)
2016-05-11 7:37 ` [PATCH 03/16] toaster: use force_text instead of force_bytes Ed Bartosh
@ 2016-05-11 7:37 ` Ed Bartosh
2016-05-11 7:37 ` [PATCH 05/16] toaster: get rid of using reduce Ed Bartosh
` (11 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Ed Bartosh @ 2016-05-11 7:37 UTC (permalink / raw)
To: toaster
Used print() function instead of print statement
to make toaster script to work with both python 2 and python 3
[YOCTO #9584]
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
bitbake/bin/toaster | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/bitbake/bin/toaster b/bitbake/bin/toaster
index 91716e6..05b7935 100755
--- a/bitbake/bin/toaster
+++ b/bitbake/bin/toaster
@@ -111,7 +111,7 @@ stop_system()
verify_prereq() {
# Verify Django version
- reqfile=$(python -c "import os; print os.path.realpath('$BBBASEDIR/toaster-requirements.txt')")
+ reqfile=$(python -c "import os; print(os.path.realpath('$BBBASEDIR/toaster-requirements.txt'))")
exp='s/Django\([><=]\+\)\([^,]\+\),\([><=]\+\)\(.\+\)/'
exp=$exp'import sys,django;version=django.get_version().split(".");'
exp=$exp'sys.exit(not (version \1 "\2".split(".") and version \3 "\4".split(".")))/p'
@@ -162,7 +162,7 @@ fi
if [ "$TOASTER_CONF" = "" ]; then
TOASTER_CONF="$TEMPLATECONF/toasterconf.json"
- export TOASTER_CONF=$(python -c "import os; print os.path.realpath('$TOASTER_CONF')")
+ export TOASTER_CONF=$(python -c "import os; print(os.path.realpath('$TOASTER_CONF'))")
fi
if [ ! -f $TOASTER_CONF ]; then
--
2.1.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 05/16] toaster: get rid of using reduce
2016-05-11 7:37 [PATCH 00/16] Python 3 support (the beginning) Ed Bartosh
` (3 preceding siblings ...)
2016-05-11 7:37 ` [PATCH 04/16] toaster: use print function in toaster script Ed Bartosh
@ 2016-05-11 7:37 ` Ed Bartosh
2016-05-11 7:38 ` [PATCH 06/16] toaster: fix imports to work for python 3 Ed Bartosh
` (10 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Ed Bartosh @ 2016-05-11 7:37 UTC (permalink / raw)
To: toaster
Replaced compicated calls of reduce with more clear code.
As reduce was removed from python 3 this change is mandatory
for the code to work on both pythons.
Here is an example change for illustration purposes:
original code:
querydict = dict(zip(or_keys, or_values))
query = reduce(operator.or_, map(lambda x: __get_q_for_val(x, querydict[x]), [k for k in querydict])))
replaced with:
query = None
for key, val in zip(or_keys, or_values):
x = __get_q_for_val(k, val)
query = query | x if query else x
[YOCTO #9584]
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
bitbake/lib/toaster/toastergui/views.py | 64 +++++++++++++++++++++----------
bitbake/lib/toaster/toastergui/widgets.py | 21 ++++++----
2 files changed, 57 insertions(+), 28 deletions(-)
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index b7c674a..a94bfa0 100755
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -229,10 +229,18 @@ OR_VALUE_SEPARATOR = "|"
DESCENDING = "-"
def __get_q_for_val(name, value):
- if "OR" in value:
- return reduce(operator.or_, map(lambda x: __get_q_for_val(name, x), [ x for x in value.split("OR") ]))
+ if "OR" in value or "AND" in value:
+ result = None
+ for x in value.split("OR"):
+ x = __get_q_for_val(name, x)
+ result = result | x if result else x
+ return result
if "AND" in value:
- return reduce(operator.and_, map(lambda x: __get_q_for_val(name, x), [ x for x in value.split("AND") ]))
+ result = None
+ for x in value.split("AND"):
+ x = __get_q_for_val(name, x)
+ result = result & x if result else x
+ return result
if value.startswith("NOT"):
value = value[3:]
if value == 'None':
@@ -251,14 +259,18 @@ def _get_filtering_query(filter_string):
and_keys = search_terms[0].split(AND_VALUE_SEPARATOR)
and_values = search_terms[1].split(AND_VALUE_SEPARATOR)
- and_query = []
+ and_query = None
for kv in zip(and_keys, and_values):
or_keys = kv[0].split(OR_VALUE_SEPARATOR)
or_values = kv[1].split(OR_VALUE_SEPARATOR)
- querydict = dict(zip(or_keys, or_values))
- and_query.append(reduce(operator.or_, map(lambda x: __get_q_for_val(x, querydict[x]), [k for k in querydict])))
+ query = None
+ for key, val in zip(or_keys, or_values):
+ x = __get_q_for_val(k, val)
+ query = query | x if query else x
- return reduce(operator.and_, [k for k in and_query])
+ and_query = and_query & query if and_query else query
+
+ return and_query
def _get_toggle_order(request, orderkey, toggle_reverse = False):
if toggle_reverse:
@@ -295,21 +307,24 @@ def _validate_input(field_input, model):
# Check we are looking for a valid field
valid_fields = model._meta.get_all_field_names()
for field in field_input_list[0].split(AND_VALUE_SEPARATOR):
- if not reduce(lambda x, y: x or y, [ field.startswith(x) for x in valid_fields ]):
- return None, (field, [ x for x in valid_fields ])
+ if True in [field.startswith(x) for x in valid_fields]:
+ break
+ else:
+ return None, (field, valid_fields)
return field_input, invalid
# uses search_allowed_fields in orm/models.py to create a search query
# for these fields with the supplied input text
def _get_search_results(search_term, queryset, model):
- search_objects = []
+ search_object = None
for st in search_term.split(" "):
- q_map = map(lambda x: Q(**{x+'__icontains': st}),
- model.search_allowed_fields)
+ queries = None
+ for field in model.search_allowed_fields:
+ query = Q(**{x+'__icontains': st})
+ queries = queries | query if queries else query
- search_objects.append(reduce(operator.or_, q_map))
- search_object = reduce(operator.and_, search_objects)
+ search_object = search_object & queries if search_object else queries
queryset = queryset.filter(search_object)
return queryset
@@ -1938,10 +1953,10 @@ if True:
if ptype == "build":
mandatory_fields.append('projectversion')
# make sure we have values for all mandatory_fields
- if reduce( lambda x, y: x or y, map(lambda x: len(request.POST.get(x, '')) == 0, mandatory_fields)):
- # set alert for missing fields
- raise BadParameterException("Fields missing: " +
- ", ".join([x for x in mandatory_fields if len(request.POST.get(x, '')) == 0 ]))
+ missing = [field for field in mandatory_fields if len(request.POST.get(field, '')) == 0]
+ if missing:
+ # set alert for missing fields
+ raise BadParameterException("Fields missing: %s" % ", ".join(missing))
if not request.user.is_authenticated():
user = authenticate(username = request.POST.get('username', '_anonuser'), password = 'nopass')
@@ -2035,13 +2050,22 @@ if True:
from collections import Counter
freqtargets = []
try:
- freqtargets += map(lambda x: x.target, reduce(lambda x, y: x + y, map(lambda x: list(x.target_set.all()), Build.objects.filter(project = prj, outcome__lt = Build.IN_PROGRESS))))
- freqtargets += map(lambda x: x.target, reduce(lambda x, y: x + y, map(lambda x: list(x.brtarget_set.all()), BuildRequest.objects.filter(project = prj, state = BuildRequest.REQ_FAILED))))
+ btargets = sum(build.target_set.all() for build in Build.objects.filter(project=prj, outcome__lt=Build.IN_PROGRESS))
+ brtargets = sum(br.brtarget_set.all() for br in BuildRequest.objects.filter(project = prj, state = BuildRequest.REQ_FAILED))
+ freqtargets = [x.target for x in btargets] + [x.target for x in brtargets]
except TypeError:
pass
freqtargets = Counter(freqtargets)
freqtargets = sorted(freqtargets, key = lambda x: freqtargets[x], reverse=True)
+ layers = [{"id": x.layercommit.pk, "orderid": x.pk, "name" : x.layercommit.layer.name,
+ "vcs_url": x.layercommit.layer.vcs_url, "vcs_reference" : x.layercommit.get_vcs_reference(),
+ "url": x.layercommit.layer.layer_index_url, "layerdetailurl": x.layercommit.get_detailspage_url(prj.pk),
+ # This branch name is actually the release
+ "branch" : {"name" : x.layercommit.get_vcs_reference(),
+ "layersource" : x.layercommit.up_branch.layer_source.name if x.layercommit.up_branch != None else None}
+ } for x in prj.projectlayer_set.all().order_by("id")]
+
context = {
"project" : prj,
"lvs_nos" : Layer_Version.objects.all().count(),
diff --git a/bitbake/lib/toaster/toastergui/widgets.py b/bitbake/lib/toaster/toastergui/widgets.py
index d2ef5d3..0f10350 100644
--- a/bitbake/lib/toaster/toastergui/widgets.py
+++ b/bitbake/lib/toaster/toastergui/widgets.py
@@ -243,18 +243,23 @@ class ToasterTable(TemplateView):
raise Exception("Search fields aren't defined in the model %s"
% self.queryset.model)
- search_queries = []
+ search_queries = None
for st in search_term.split(" "):
- q_map = [Q(**{field + '__icontains': st})
- for field in self.queryset.model.search_allowed_fields]
-
- search_queries.append(reduce(operator.or_, q_map))
-
- search_queries = reduce(operator.and_, search_queries)
+ queries = None
+ for field in self.queryset.model.search_allowed_fields:
+ query = Q(**{field + '__icontains': st})
+ if queries:
+ queries |= query
+ else:
+ queries = query
+
+ if search_queries:
+ search_queries &= queries
+ else:
+ search_queries = queries
self.queryset = self.queryset.filter(search_queries)
-
def get_data(self, request, **kwargs):
"""
Returns the data for the page requested with the specified
--
2.1.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 06/16] toaster: fix imports to work for python 3
2016-05-11 7:37 [PATCH 00/16] Python 3 support (the beginning) Ed Bartosh
` (4 preceding siblings ...)
2016-05-11 7:37 ` [PATCH 05/16] toaster: get rid of using reduce Ed Bartosh
@ 2016-05-11 7:38 ` Ed Bartosh
2016-05-11 7:38 ` [PATCH 07/16] toaster: fix local imports Ed Bartosh
` (9 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Ed Bartosh @ 2016-05-11 7:38 UTC (permalink / raw)
To: toaster
Some APIs have been moved to other modules in python 3:
getstatusoutput: moved from commands to subproces
urlopen: moved from urllib2 to urllib.request
urlparse: moved from urlparse to urllib.parse
Made the imports work for both python versions by
catching ImportError and importing APIs from different
modules.
[YOCTO #9584]
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
bitbake/lib/bb/utils.py | 6 +++++-
bitbake/lib/toaster/orm/models.py | 16 ++++++++++++----
2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
index 5e735d3..92bed77 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/lib/bb/utils.py
@@ -36,10 +36,14 @@ import traceback
import errno
import signal
import ast
-from commands import getstatusoutput
from contextlib import contextmanager
from ctypes import cdll
+try:
+ from subprocess import getstatusoutput
+except ImportError:
+ from commands import getstatusoutput
+
logger = logging.getLogger("BitBake.Util")
python_extensions = [e for e, _, _ in imp.get_suffixes()]
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py
index 2669606..95a3dc7 100644
--- a/bitbake/lib/toaster/orm/models.py
+++ b/bitbake/lib/toaster/orm/models.py
@@ -1146,18 +1146,26 @@ class LayerIndexLayerSource(LayerSource):
assert self.apiurl is not None
from django.db import transaction, connection
- import urllib2, urlparse, json
+ import json
import os
+
+ try:
+ from urllib.request import urlopen, URLError
+ from urllib.parse import urlparse
+ except ImportError:
+ from urllib2 import urlopen, URLError
+ from urlparse import urlparse
+
proxy_settings = os.environ.get("http_proxy", None)
oe_core_layer = 'openembedded-core'
def _get_json_response(apiurl = self.apiurl):
- _parsedurl = urlparse.urlparse(apiurl)
+ _parsedurl = urlparse(apiurl)
path = _parsedurl.path
try:
- res = urllib2.urlopen(apiurl)
- except urllib2.URLError as e:
+ res = urlopen(apiurl)
+ except URLError as e:
raise Exception("Failed to read %s: %s" % (path, e.reason))
return json.loads(res.read())
--
2.1.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 07/16] toaster: fix local imports
2016-05-11 7:37 [PATCH 00/16] Python 3 support (the beginning) Ed Bartosh
` (5 preceding siblings ...)
2016-05-11 7:38 ` [PATCH 06/16] toaster: fix imports to work for python 3 Ed Bartosh
@ 2016-05-11 7:38 ` Ed Bartosh
2016-05-11 7:38 ` [PATCH 08/16] toaster: modified list of dependencies Ed Bartosh
` (8 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Ed Bartosh @ 2016-05-11 7:38 UTC (permalink / raw)
To: toaster
Replaced local imports with absolute imports.
Used .module for local imports.
This should make the code to work on python 2 and python 3.
[YOCTO #9584]
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
bitbake/lib/toaster/bldcontrol/bbcontroller.py | 2 +-
bitbake/lib/toaster/bldcontrol/localhostbecontroller.py | 2 +-
bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py | 2 +-
bitbake/lib/toaster/bldcontrol/management/commands/loadconf.py | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/bitbake/lib/toaster/bldcontrol/bbcontroller.py b/bitbake/lib/toaster/bldcontrol/bbcontroller.py
index d09ac17..9bddadb 100644
--- a/bitbake/lib/toaster/bldcontrol/bbcontroller.py
+++ b/bitbake/lib/toaster/bldcontrol/bbcontroller.py
@@ -79,7 +79,7 @@ def getBuildEnvironmentController(**kwargs):
The return object MUST always be a BuildEnvironmentController.
"""
- from localhostbecontroller import LocalhostBEController
+ from bldcontrol.localhostbecontroller import LocalhostBEController
be = BuildEnvironment.objects.filter(Q(**kwargs))[0]
if be.betype == BuildEnvironment.TYPE_LOCAL:
diff --git a/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py b/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py
index 7def1f3..e670926 100644
--- a/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py
+++ b/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py
@@ -32,7 +32,7 @@ import subprocess
from toastermain import settings
-from bbcontroller import BuildEnvironmentController, ShellCmdException, BuildSetupException, BitbakeController
+from bldcontrol.bbcontroller import BuildEnvironmentController, ShellCmdException, BuildSetupException, BitbakeController
import logging
logger = logging.getLogger("toaster")
diff --git a/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py b/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py
index 6b1da1b..2407e1b 100644
--- a/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py
+++ b/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py
@@ -105,7 +105,7 @@ class Command(NoArgsCommand):
try:
config_file = os.environ.get('TOASTER_CONF')
print("\nImporting file: %s" % config_file)
- from loadconf import Command as LoadConfigCommand
+ from .loadconf import Command as LoadConfigCommand
LoadConfigCommand()._import_layer_config(config_file)
# we run lsupdates after config update
diff --git a/bitbake/lib/toaster/bldcontrol/management/commands/loadconf.py b/bitbake/lib/toaster/bldcontrol/management/commands/loadconf.py
index 5022b59..6d25df9 100644
--- a/bitbake/lib/toaster/bldcontrol/management/commands/loadconf.py
+++ b/bitbake/lib/toaster/bldcontrol/management/commands/loadconf.py
@@ -4,7 +4,7 @@ from orm.models import BitbakeVersion, Release, ReleaseDefaultLayer, ReleaseLaye
from django.db import IntegrityError
import os
-from checksettings import DN
+from .checksettings import DN
import logging
logger = logging.getLogger("toaster")
--
2.1.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 08/16] toaster: modified list of dependencies
2016-05-11 7:37 [PATCH 00/16] Python 3 support (the beginning) Ed Bartosh
` (6 preceding siblings ...)
2016-05-11 7:38 ` [PATCH 07/16] toaster: fix local imports Ed Bartosh
@ 2016-05-11 7:38 ` Ed Bartosh
2016-05-11 7:38 ` [PATCH 09/16] toaster: use decode('utf-8') for binary data Ed Bartosh
` (7 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Ed Bartosh @ 2016-05-11 7:38 UTC (permalink / raw)
To: toaster
Removed dependency to argparse and wsgiref as they're in
standard python library.
wsgiref crashes during installation with python 3 as it's not
compatible with python 3.
Added dependency to pytz as it's used in the toaster code.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
bitbake/toaster-requirements.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/bitbake/toaster-requirements.txt b/bitbake/toaster-requirements.txt
index 0e8c742..987dc92 100644
--- a/bitbake/toaster-requirements.txt
+++ b/bitbake/toaster-requirements.txt
@@ -1,4 +1,4 @@
Django>1.8,<1.9
-argparse==1.2.1
-wsgiref==0.1.2
beautifulsoup4>=4.4.0
+wsgiref==0.1.2
+pytz
--
2.1.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 09/16] toaster: use decode('utf-8') for binary data
2016-05-11 7:37 [PATCH 00/16] Python 3 support (the beginning) Ed Bartosh
` (7 preceding siblings ...)
2016-05-11 7:38 ` [PATCH 08/16] toaster: modified list of dependencies Ed Bartosh
@ 2016-05-11 7:38 ` Ed Bartosh
2016-05-11 7:38 ` [PATCH 10/16] toaster: use items and range instead of old APIs Ed Bartosh
` (6 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Ed Bartosh @ 2016-05-11 7:38 UTC (permalink / raw)
To: toaster
Decoded binary data to utf-8 to fix the following
error when runnign on python 3:
TypeError: Type str doesn't support the buffer API
[YOCTO #9584]
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
bitbake/lib/toaster/bldcontrol/localhostbecontroller.py | 2 +-
bitbake/lib/toaster/bldcontrol/management/commands/loadconf.py | 2 +-
bitbake/lib/toaster/orm/models.py | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py b/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py
index e670926..5287e8d 100644
--- a/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py
+++ b/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py
@@ -70,7 +70,7 @@ class LocalhostBEController(BuildEnvironmentController):
raise ShellCmdException(err)
else:
logger.debug("localhostbecontroller: shellcmd success")
- return out
+ return out.decode('utf-8')
def getGitCloneDirectory(self, url, branch):
"""Construct unique clone directory name out of url and branch."""
diff --git a/bitbake/lib/toaster/bldcontrol/management/commands/loadconf.py b/bitbake/lib/toaster/bldcontrol/management/commands/loadconf.py
index 6d25df9..173e3ce 100644
--- a/bitbake/lib/toaster/bldcontrol/management/commands/loadconf.py
+++ b/bitbake/lib/toaster/bldcontrol/management/commands/loadconf.py
@@ -54,7 +54,7 @@ class Command(BaseCommand):
(out,err) = cmd.communicate()
if cmd.returncode != 0:
logging.warning("Error while importing layer vcs_url: git error: %s" % err)
- for line in out.split("\n"):
+ for line in out.decode('utf-8').split("\n"):
try:
(name, path) = line.split("\t", 1)
if name == remote_name:
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py
index 95a3dc7..8c383c8 100644
--- a/bitbake/lib/toaster/orm/models.py
+++ b/bitbake/lib/toaster/orm/models.py
@@ -1168,7 +1168,7 @@ class LayerIndexLayerSource(LayerSource):
except URLError as e:
raise Exception("Failed to read %s: %s" % (path, e.reason))
- return json.loads(res.read())
+ return json.loads(res.read().decode('utf-8'))
# verify we can get the basic api
try:
--
2.1.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 10/16] toaster: use items and range instead of old APIs
2016-05-11 7:37 [PATCH 00/16] Python 3 support (the beginning) Ed Bartosh
` (8 preceding siblings ...)
2016-05-11 7:38 ` [PATCH 09/16] toaster: use decode('utf-8') for binary data Ed Bartosh
@ 2016-05-11 7:38 ` Ed Bartosh
2016-05-11 7:38 ` [PATCH 11/16] toaster: replace map with list comprehensions Ed Bartosh
` (5 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Ed Bartosh @ 2016-05-11 7:38 UTC (permalink / raw)
To: toaster
Used items() and range() APIs instead of iteritems() and
xrange() as latter don't exist in python 3
[YOCTO #9584]
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
bitbake/lib/toaster/contrib/tts/config.py | 2 +-
bitbake/lib/toaster/orm/models.py | 2 +-
bitbake/lib/toaster/toastergui/tablefilter.py | 2 +-
bitbake/lib/toaster/toastergui/views.py | 2 +-
bitbake/lib/toaster/toastergui/widgets.py | 4 ++--
5 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/bitbake/lib/toaster/contrib/tts/config.py b/bitbake/lib/toaster/contrib/tts/config.py
index 40d45f3..87b427c 100644
--- a/bitbake/lib/toaster/contrib/tts/config.py
+++ b/bitbake/lib/toaster/contrib/tts/config.py
@@ -74,7 +74,7 @@ BACKLOGFILE = os.path.join(os.path.dirname(__file__), "backlog.txt")
# task states
def enum(*sequential, **named):
enums = dict(zip(sequential, range(len(sequential))), **named)
- reverse = dict((value, key) for key, value in enums.iteritems())
+ reverse = dict((value, key) for key, value in enums.items())
enums['reverse_mapping'] = reverse
return type('Enum', (), enums)
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py
index 8c383c8..bcb8f7c 100644
--- a/bitbake/lib/toaster/orm/models.py
+++ b/bitbake/lib/toaster/orm/models.py
@@ -103,7 +103,7 @@ class GitURLValidator(validators.URLValidator):
def GitURLField(**kwargs):
r = models.URLField(**kwargs)
- for i in xrange(len(r.validators)):
+ for i in range(len(r.validators)):
if isinstance(r.validators[i], validators.URLValidator):
r.validators[i] = GitURLValidator()
return r
diff --git a/bitbake/lib/toaster/toastergui/tablefilter.py b/bitbake/lib/toaster/toastergui/tablefilter.py
index 9d15bcf..65454e1 100644
--- a/bitbake/lib/toaster/toastergui/tablefilter.py
+++ b/bitbake/lib/toaster/toastergui/tablefilter.py
@@ -286,7 +286,7 @@ class TableFilterMap(object):
def to_json(self, queryset):
data = {}
- for filter_name, table_filter in self.__filters.iteritems():
+ for filter_name, table_filter in self.__filters.items():
data[filter_name] = table_filter.to_json()
return data
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index a94bfa0..9e0225c 100755
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -2279,7 +2279,7 @@ if True:
# Strip trailing/leading whitespace from all values
# put into a new dict because POST one is immutable
post_data = dict()
- for key,val in request.POST.iteritems():
+ for key,val in request.POST.items():
post_data[key] = val.strip()
diff --git a/bitbake/lib/toaster/toastergui/widgets.py b/bitbake/lib/toaster/toastergui/widgets.py
index 0f10350..c02f9f5 100644
--- a/bitbake/lib/toaster/toastergui/widgets.py
+++ b/bitbake/lib/toaster/toastergui/widgets.py
@@ -281,12 +281,12 @@ class ToasterTable(TemplateView):
# Make a unique cache name
cache_name = self.__class__.__name__
- for key, val in request.GET.iteritems():
+ for key, val in request.GET.items():
if key == 'nocache':
continue
cache_name = cache_name + str(key) + str(val)
- for key, val in kwargs.iteritems():
+ for key, val in kwargs.items():
cache_name = cache_name + str(key) + str(val)
# No special chars allowed in the cache name apart from dash
--
2.1.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 11/16] toaster: replace map with list comprehensions
2016-05-11 7:37 [PATCH 00/16] Python 3 support (the beginning) Ed Bartosh
` (9 preceding siblings ...)
2016-05-11 7:38 ` [PATCH 10/16] toaster: use items and range instead of old APIs Ed Bartosh
@ 2016-05-11 7:38 ` Ed Bartosh
2016-05-11 7:38 ` [PATCH 12/16] toaster: use 'in' instead of has_key Ed Bartosh
` (4 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Ed Bartosh @ 2016-05-11 7:38 UTC (permalink / raw)
To: toaster
map returns map object in python 3. Replaced calls of
map to equivalent list comprehensions in the code which
requires lists.
[YOCTO #9584]
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
bitbake/lib/toaster/orm/models.py | 2 +-
bitbake/lib/toaster/toastergui/tables.py | 3 +--
bitbake/lib/toaster/toastergui/views.py | 45 +++++++++++++-------------------
3 files changed, 20 insertions(+), 30 deletions(-)
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py
index bcb8f7c..6defcaf 100644
--- a/bitbake/lib/toaster/orm/models.py
+++ b/bitbake/lib/toaster/orm/models.py
@@ -1182,7 +1182,7 @@ class LayerIndexLayerSource(LayerSource):
# update branches; only those that we already have names listed in the
# Releases table
- whitelist_branch_names = map(lambda x: x.branch_name, Release.objects.all())
+ whitelist_branch_names = [rel.branch_name for rel in Release.objects.all()]
if len(whitelist_branch_names) == 0:
raise Exception("Failed to make list of branches to fetch")
diff --git a/bitbake/lib/toaster/toastergui/tables.py b/bitbake/lib/toaster/toastergui/tables.py
index eb876ec..079c30c 100644
--- a/bitbake/lib/toaster/toastergui/tables.py
+++ b/bitbake/lib/toaster/toastergui/tables.py
@@ -344,8 +344,7 @@ class RecipesTable(ToasterTable):
context = super(RecipesTable, self).get_context_data(**kwargs)
context['project'] = project
-
- context['projectlayers'] = map(lambda prjlayer: prjlayer.layercommit.id, ProjectLayer.objects.filter(project=context['project']))
+ context['projectlayers'] = [player.layercommit.id for player in ProjectLayer.objects.filter(project=context['project'])]
return context
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index 9e0225c..ecc8f80 100755
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -967,18 +967,19 @@ def dirinfo(request, build_id, target_id, file_path=None):
return render(request, template, context)
def _find_task_dep(task_object):
- return map(lambda x: x.depends_on, Task_Dependency.objects.filter(task=task_object).filter(depends_on__order__gt = 0).exclude(depends_on__outcome = Task.OUTCOME_NA).select_related("depends_on"))
-
+ tdeps = Task_Dependency.objects.filter(task=task_object).filter(depends_on__order__gt=0)
+ tdeps = tdeps.exclude(depends_on__outcome=Task.OUTCOME_NA).select_related("depends_on")
+ return [x.depends_on for x in tdeps]
def _find_task_revdep(task_object):
- tp = []
- tp = map(lambda t: t.task, Task_Dependency.objects.filter(depends_on=task_object).filter(task__order__gt=0).exclude(task__outcome = Task.OUTCOME_NA).select_related("task", "task__recipe", "task__build"))
- return tp
+ tdeps = Task_Dependency.objects.filter(depends_on=task_object).filter(task__order__gt=0)
+ tdeps = tdeps.exclude(task__outcome = Task.OUTCOME_NA).select_related("task", "task__recipe", "task__build")
+ return [tdep.task for tdep in tdeps]
def _find_task_revdep_list(tasklist):
- tp = []
- tp = map(lambda t: t.task, Task_Dependency.objects.filter(depends_on__in=tasklist).filter(task__order__gt=0).exclude(task__outcome = Task.OUTCOME_NA).select_related("task", "task__recipe", "task__build"))
- return tp
+ tdeps = Task_Dependency.objects.filter(depends_on__in=tasklist).filter(task__order__gt=0)
+ tdeps = tdeps.exclude(task__outcome=Task.OUTCOME_NA).select_related("task", "task__recipe", "task__build")
+ return [tdep.task for tdep in tdeps]
def _find_task_provider(task_object):
task_revdeps = _find_task_revdep(task_object)
@@ -1979,7 +1980,8 @@ if True:
except (IntegrityError, BadParameterException) as e:
# fill in page with previously submitted values
- map(lambda x: context.__setitem__(x, request.POST.get(x, "-- missing")), mandatory_fields)
+ for field in mandatory_fields:
+ context.__setitem__(field, request.POST.get(field, "-- missing"))
if isinstance(e, IntegrityError) and "username" in str(e):
context['alert'] = "Your chosen username is already used"
else:
@@ -2073,21 +2075,11 @@ if True:
"prj" : {"name": prj.name, },
"buildrequests" : prj.build_set.filter(outcome=Build.IN_PROGRESS),
"builds" : Build.get_recent(prj),
- "layers" : map(lambda x: {
- "id": x.layercommit.pk,
- "orderid": x.pk,
- "name" : x.layercommit.layer.name,
- "vcs_url": x.layercommit.layer.vcs_url,
- "vcs_reference" : x.layercommit.get_vcs_reference(),
- "url": x.layercommit.layer.layer_index_url,
- "layerdetailurl": x.layercommit.get_detailspage_url(prj.pk),
- # This branch name is actually the release
- "branch" : { "name" : x.layercommit.get_vcs_reference(), "layersource" : x.layercommit.up_branch.layer_source.name if x.layercommit.up_branch != None else None}},
- prj.projectlayer_set.all().order_by("id")),
- "targets" : map(lambda x: {"target" : x.target, "task" : x.task, "pk": x.pk}, prj.projecttarget_set.all()),
- "variables": map(lambda x: (x.name, x.value), prj.projectvariable_set.all()),
+ "layers" : layers,
+ "targets" : [{"target" : x.target, "task" : x.task, "pk": x.pk} for x in prj.projecttarget_set.all()],
+ "variables": [(x.name, x.value) for x in prj.projectvariable_set.all()],
"freqtargets": freqtargets[:5],
- "releases": map(lambda x: {"id": x.pk, "name": x.name, "description":x.description}, Release.objects.all()),
+ "releases": [{"id": x.pk, "name": x.name, "description":x.description} for x in Release.objects.all()],
"project_html": 1,
"recipesTypeAheadUrl": reverse('xhr_recipestypeahead', args=(prj.pk,)),
"projectBuildsUrl": reverse('projectbuilds', args=(prj.pk,)),
@@ -2178,8 +2170,7 @@ if True:
retval.append(project)
return response({"error":"ok",
- "rows" : map( _lv_to_dict(prj),
- map(lambda x: x.layercommit, retval ))
+ "rows": [_lv_to_dict(prj) for y in [x.layercommit for x in retval]]
})
except Exception as e:
@@ -2225,7 +2216,7 @@ if True:
return_data = {
"error": "ok",
- 'configvars' : map(lambda x: (x.name, x.value, x.pk), configvars_query),
+ 'configvars': [(x.name, x.value, x.pk) for x in configvars_query]
}
try:
return_data['distro'] = ProjectVariable.objects.get(project = prj, name = "DISTRO").value,
@@ -2848,7 +2839,7 @@ if True:
"vcs_url": dep.layer.vcs_url,
"vcs_reference": dep.get_vcs_reference()} \
for dep in layer_version.get_alldeps(project.id)]},
- 'projectlayers': map(lambda prjlayer: prjlayer.layercommit.id, ProjectLayer.objects.filter(project=project))
+ 'projectlayers': [player.layercommit.id for player in ProjectLayer.objects.filter(project=project)]
}
return context
--
2.1.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 12/16] toaster: use 'in' instead of has_key
2016-05-11 7:37 [PATCH 00/16] Python 3 support (the beginning) Ed Bartosh
` (10 preceding siblings ...)
2016-05-11 7:38 ` [PATCH 11/16] toaster: replace map with list comprehensions Ed Bartosh
@ 2016-05-11 7:38 ` Ed Bartosh
2016-05-11 7:38 ` [PATCH 13/16] toaster: use re.sub() instead of translate() Ed Bartosh
` (3 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Ed Bartosh @ 2016-05-11 7:38 UTC (permalink / raw)
To: toaster
Dictionary method has_key is deprecated in python 2 and absent
in python 3.
Used '<key> in <dict>' statement to make the code working on
both python 2 and python 3.
[YOCTO #9584]
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
bitbake/lib/toaster/toastermain/settings.py | 2 +-
bitbake/lib/toaster/toastermain/urls.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/bitbake/lib/toaster/toastermain/settings.py b/bitbake/lib/toaster/toastermain/settings.py
index adcf707..c7edff2 100644
--- a/bitbake/lib/toaster/toastermain/settings.py
+++ b/bitbake/lib/toaster/toastermain/settings.py
@@ -274,7 +274,7 @@ currentdir = os.path.dirname(__file__)
for t in os.walk(os.path.dirname(currentdir)):
modulename = os.path.basename(t[0])
#if we have a virtualenv skip it to avoid incorrect imports
- if os.environ.has_key('VIRTUAL_ENV') and os.environ['VIRTUAL_ENV'] in t[0]:
+ if 'VIRTUAL_ENV' in os.environ and os.environ['VIRTUAL_ENV'] in t[0]:
continue
if ("views.py" in t[2] or "models.py" in t[2]) and not modulename in INSTALLED_APPS:
diff --git a/bitbake/lib/toaster/toastermain/urls.py b/bitbake/lib/toaster/toastermain/urls.py
index 534679d..fd385cc 100644
--- a/bitbake/lib/toaster/toastermain/urls.py
+++ b/bitbake/lib/toaster/toastermain/urls.py
@@ -71,7 +71,7 @@ import os
currentdir = os.path.dirname(__file__)
for t in os.walk(os.path.dirname(currentdir)):
#if we have a virtualenv skip it to avoid incorrect imports
- if os.environ.has_key('VIRTUAL_ENV') and os.environ['VIRTUAL_ENV'] in t[0]:
+ if 'VIRTUAL_ENV' in os.environ and os.environ['VIRTUAL_ENV'] in t[0]:
continue
if "urls.py" in t[2] and t[0] != currentdir:
--
2.1.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 13/16] toaster: use re.sub() instead of translate()
2016-05-11 7:37 [PATCH 00/16] Python 3 support (the beginning) Ed Bartosh
` (11 preceding siblings ...)
2016-05-11 7:38 ` [PATCH 12/16] toaster: use 'in' instead of has_key Ed Bartosh
@ 2016-05-11 7:38 ` Ed Bartosh
2016-05-11 7:38 ` [PATCH 14/16] toaster: use new syntax of except statement Ed Bartosh
` (2 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Ed Bartosh @ 2016-05-11 7:38 UTC (permalink / raw)
To: toaster
translate has different set of parameters in python 3 and
can't be used the way it's used in toaster api module.
Replacing it with re.sub() should make the code work in
both python 2 and python 3.
[YOCTO #9584]
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
bitbake/lib/toaster/toastergui/api.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/bitbake/lib/toaster/toastergui/api.py b/bitbake/lib/toaster/toastergui/api.py
index 42901f75..961b594 100644
--- a/bitbake/lib/toaster/toastergui/api.py
+++ b/bitbake/lib/toaster/toastergui/api.py
@@ -18,6 +18,7 @@
# Temporary home for the UI's misc API
+import re
from orm.models import Project, ProjectTarget, Build
from bldcontrol.models import BuildRequest
@@ -92,7 +93,7 @@ class XhrBuildRequest(View):
if 'targets' in request.POST:
ProjectTarget.objects.filter(project = project).delete()
s = str(request.POST['targets'])
- for t in s.translate(None, ";%|\"").split(" "):
+ for t in re.sub(r'[;%|"]', '', s).split(" "):
if ":" in t:
target, task = t.split(":")
else:
--
2.1.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 14/16] toaster: use new syntax of except statement
2016-05-11 7:37 [PATCH 00/16] Python 3 support (the beginning) Ed Bartosh
` (12 preceding siblings ...)
2016-05-11 7:38 ` [PATCH 13/16] toaster: use re.sub() instead of translate() Ed Bartosh
@ 2016-05-11 7:38 ` Ed Bartosh
2016-05-11 7:38 ` [PATCH 15/16] toaster: read timezone files in binary mode Ed Bartosh
2016-05-11 7:38 ` [PATCH 16/16] toaster: moved import bb.server.xmlrpc Ed Bartosh
15 siblings, 0 replies; 17+ messages in thread
From: Ed Bartosh @ 2016-05-11 7:38 UTC (permalink / raw)
To: toaster
Used except 'except (<exception1>, <exception2>):' syntax as it's
supported by python 2 and pythone 3.
Old syntax 'except <exception1>, <exception2>:' is not supported
by python 3.
[YOCTO #9584]
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
bitbake/lib/toaster/toastergui/views.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index ecc8f80..657ce0c 100755
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -2902,7 +2902,7 @@ if True:
else:
context['dl_dir'] = ProjectVariable.objects.get(project = prj, name = "DL_DIR").value
context['dl_dir_defined'] = "1"
- except ProjectVariable.DoesNotExist,BuildEnvironment.DoesNotExist:
+ except (ProjectVariable.DoesNotExist, BuildEnvironment.DoesNotExist):
pass
try:
context['fstypes'] = ProjectVariable.objects.get(project = prj, name = "IMAGE_FSTYPES").value
@@ -2930,7 +2930,7 @@ if True:
else:
context['sstate_dir'] = ProjectVariable.objects.get(project = prj, name = "SSTATE_DIR").value
context['sstate_dir_defined'] = "1"
- except ProjectVariable.DoesNotExist, BuildEnvironment.DoesNotExist:
+ except (ProjectVariable.DoesNotExist, BuildEnvironment.DoesNotExist):
pass
return context
@@ -2993,5 +2993,5 @@ if True:
return response
else:
return render(request, "unavailable_artifact.html")
- except ObjectDoesNotExist, IOError:
+ except (ObjectDoesNotExist, IOError):
return render(request, "unavailable_artifact.html")
--
2.1.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 15/16] toaster: read timezone files in binary mode
2016-05-11 7:37 [PATCH 00/16] Python 3 support (the beginning) Ed Bartosh
` (13 preceding siblings ...)
2016-05-11 7:38 ` [PATCH 14/16] toaster: use new syntax of except statement Ed Bartosh
@ 2016-05-11 7:38 ` Ed Bartosh
2016-05-11 7:38 ` [PATCH 16/16] toaster: moved import bb.server.xmlrpc Ed Bartosh
15 siblings, 0 replies; 17+ messages in thread
From: Ed Bartosh @ 2016-05-11 7:38 UTC (permalink / raw)
To: toaster
Used 'rb' mode to open files to avoid unicode error when code
runs on python 3:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80
in position 44: invalid start byte
[YOCTO #9584]
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
bitbake/lib/toaster/toastermain/settings.py | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/bitbake/lib/toaster/toastermain/settings.py b/bitbake/lib/toaster/toastermain/settings.py
index c7edff2..3dfa2b2 100644
--- a/bitbake/lib/toaster/toastermain/settings.py
+++ b/bitbake/lib/toaster/toastermain/settings.py
@@ -87,17 +87,16 @@ else:
try:
import pytz
from pytz.exceptions import UnknownTimeZoneError
- pass
try:
if pytz.timezone(zonename) is not None:
- zonefilelist[hashlib.md5(open(filepath).read()).hexdigest()] = zonename
+ zonefilelist[hashlib.md5(open(filepath, 'rb').read()).hexdigest()] = zonename
except UnknownTimeZoneError as ValueError:
# we expect timezone failures here, just move over
pass
except ImportError:
- zonefilelist[hashlib.md5(open(filepath).read()).hexdigest()] = zonename
+ zonefilelist[hashlib.md5(open(filepath, 'rb').read()).hexdigest()] = zonename
- TIME_ZONE = zonefilelist[hashlib.md5(open('/etc/localtime').read()).hexdigest()]
+ TIME_ZONE = zonefilelist[hashlib.md5(open('/etc/localtime', 'rb').read()).hexdigest()]
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
--
2.1.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 16/16] toaster: moved import bb.server.xmlrpc
2016-05-11 7:37 [PATCH 00/16] Python 3 support (the beginning) Ed Bartosh
` (14 preceding siblings ...)
2016-05-11 7:38 ` [PATCH 15/16] toaster: read timezone files in binary mode Ed Bartosh
@ 2016-05-11 7:38 ` Ed Bartosh
15 siblings, 0 replies; 17+ messages in thread
From: Ed Bartosh @ 2016-05-11 7:38 UTC (permalink / raw)
To: toaster
Moved import xmlrpc module to the place where it's used
to avoid toaster crashes when importing bitbake code.
NOTE: This patch is made to be able to partly test toaster
with bitbake from master. It can be removed as soon as bb.server.xmlrpc
is ported to python 3.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
bitbake/lib/toaster/bldcontrol/bbcontroller.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bitbake/lib/toaster/bldcontrol/bbcontroller.py b/bitbake/lib/toaster/bldcontrol/bbcontroller.py
index 9bddadb..912f67b 100644
--- a/bitbake/lib/toaster/bldcontrol/bbcontroller.py
+++ b/bitbake/lib/toaster/bldcontrol/bbcontroller.py
@@ -30,7 +30,6 @@ from bldcontrol.models import BuildEnvironment, BRLayer, BRVariable, BRTarget, B
# load Bitbake components
path = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
sys.path.insert(0, path)
-import bb.server.xmlrpc
class BitbakeController(object):
""" This is the basic class that controlls a bitbake server.
@@ -38,6 +37,7 @@ class BitbakeController(object):
"""
def __init__(self, be):
+ import bb.server.xmlrpc
self.connection = bb.server.xmlrpc._create_server(be.bbaddress,
int(be.bbport))[0]
--
2.1.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
end of thread, other threads:[~2016-05-11 9:59 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-11 7:37 [PATCH 00/16] Python 3 support (the beginning) Ed Bartosh
2016-05-11 7:37 ` [PATCH 01/16] toaster: Remove DATABASE_URL being passed around as an environment var Ed Bartosh
2016-05-11 7:37 ` [PATCH 02/16] bin, toaster: Fix print and exception syntax Ed Bartosh
2016-05-11 7:37 ` [PATCH 03/16] toaster: use force_text instead of force_bytes Ed Bartosh
2016-05-11 7:37 ` [PATCH 04/16] toaster: use print function in toaster script Ed Bartosh
2016-05-11 7:37 ` [PATCH 05/16] toaster: get rid of using reduce Ed Bartosh
2016-05-11 7:38 ` [PATCH 06/16] toaster: fix imports to work for python 3 Ed Bartosh
2016-05-11 7:38 ` [PATCH 07/16] toaster: fix local imports Ed Bartosh
2016-05-11 7:38 ` [PATCH 08/16] toaster: modified list of dependencies Ed Bartosh
2016-05-11 7:38 ` [PATCH 09/16] toaster: use decode('utf-8') for binary data Ed Bartosh
2016-05-11 7:38 ` [PATCH 10/16] toaster: use items and range instead of old APIs Ed Bartosh
2016-05-11 7:38 ` [PATCH 11/16] toaster: replace map with list comprehensions Ed Bartosh
2016-05-11 7:38 ` [PATCH 12/16] toaster: use 'in' instead of has_key Ed Bartosh
2016-05-11 7:38 ` [PATCH 13/16] toaster: use re.sub() instead of translate() Ed Bartosh
2016-05-11 7:38 ` [PATCH 14/16] toaster: use new syntax of except statement Ed Bartosh
2016-05-11 7:38 ` [PATCH 15/16] toaster: read timezone files in binary mode Ed Bartosh
2016-05-11 7:38 ` [PATCH 16/16] toaster: moved import bb.server.xmlrpc Ed Bartosh
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.