diff options
Diffstat (limited to 'bitbake/lib/bb/shell.py')
| -rw-r--r-- | bitbake/lib/bb/shell.py | 146 |
1 files changed, 73 insertions, 73 deletions
diff --git a/bitbake/lib/bb/shell.py b/bitbake/lib/bb/shell.py index 71dd599ed6..0dcf45dd5f 100644 --- a/bitbake/lib/bb/shell.py +++ b/bitbake/lib/bb/shell.py | |||
| @@ -98,7 +98,7 @@ class BitBakeShellCommands: | |||
| 98 | 98 | ||
| 99 | def _checkParsed( self ): | 99 | def _checkParsed( self ): |
| 100 | if not parsed: | 100 | if not parsed: |
| 101 | print "SHELL: This command needs to parse bbfiles..." | 101 | print("SHELL: This command needs to parse bbfiles...") |
| 102 | self.parse( None ) | 102 | self.parse( None ) |
| 103 | 103 | ||
| 104 | def _findProvider( self, item ): | 104 | def _findProvider( self, item ): |
| @@ -119,28 +119,28 @@ class BitBakeShellCommands: | |||
| 119 | """Register a new name for a command""" | 119 | """Register a new name for a command""" |
| 120 | new, old = params | 120 | new, old = params |
| 121 | if not old in cmds: | 121 | if not old in cmds: |
| 122 | print "ERROR: Command '%s' not known" % old | 122 | print("ERROR: Command '%s' not known" % old) |
| 123 | else: | 123 | else: |
| 124 | cmds[new] = cmds[old] | 124 | cmds[new] = cmds[old] |
| 125 | print "OK" | 125 | print("OK") |
| 126 | alias.usage = "<alias> <command>" | 126 | alias.usage = "<alias> <command>" |
| 127 | 127 | ||
| 128 | def buffer( self, params ): | 128 | def buffer( self, params ): |
| 129 | """Dump specified output buffer""" | 129 | """Dump specified output buffer""" |
| 130 | index = params[0] | 130 | index = params[0] |
| 131 | print self._shell.myout.buffer( int( index ) ) | 131 | print(self._shell.myout.buffer( int( index ) )) |
| 132 | buffer.usage = "<index>" | 132 | buffer.usage = "<index>" |
| 133 | 133 | ||
| 134 | def buffers( self, params ): | 134 | def buffers( self, params ): |
| 135 | """Show the available output buffers""" | 135 | """Show the available output buffers""" |
| 136 | commands = self._shell.myout.bufferedCommands() | 136 | commands = self._shell.myout.bufferedCommands() |
| 137 | if not commands: | 137 | if not commands: |
| 138 | print "SHELL: No buffered commands available yet. Start doing something." | 138 | print("SHELL: No buffered commands available yet. Start doing something.") |
| 139 | else: | 139 | else: |
| 140 | print "="*35, "Available Output Buffers", "="*27 | 140 | print("="*35, "Available Output Buffers", "="*27) |
| 141 | for index, cmd in enumerate( commands ): | 141 | for index, cmd in enumerate( commands ): |
| 142 | print "| %s %s" % ( str( index ).ljust( 3 ), cmd ) | 142 | print("| %s %s" % ( str( index ).ljust( 3 ), cmd )) |
| 143 | print "="*88 | 143 | print("="*88) |
| 144 | 144 | ||
| 145 | def build( self, params, cmd = "build" ): | 145 | def build( self, params, cmd = "build" ): |
| 146 | """Build a providee""" | 146 | """Build a providee""" |
| @@ -149,7 +149,7 @@ class BitBakeShellCommands: | |||
| 149 | self._checkParsed() | 149 | self._checkParsed() |
| 150 | names = globfilter( cooker.status.pkg_pn, globexpr ) | 150 | names = globfilter( cooker.status.pkg_pn, globexpr ) |
| 151 | if len( names ) == 0: names = [ globexpr ] | 151 | if len( names ) == 0: names = [ globexpr ] |
| 152 | print "SHELL: Building %s" % ' '.join( names ) | 152 | print("SHELL: Building %s" % ' '.join( names )) |
| 153 | 153 | ||
| 154 | td = taskdata.TaskData(cooker.configuration.abort) | 154 | td = taskdata.TaskData(cooker.configuration.abort) |
| 155 | localdata = data.createCopy(cooker.configuration.data) | 155 | localdata = data.createCopy(cooker.configuration.data) |
| @@ -174,16 +174,16 @@ class BitBakeShellCommands: | |||
| 174 | rq.execute_runqueue() | 174 | rq.execute_runqueue() |
| 175 | 175 | ||
| 176 | except Providers.NoProvider: | 176 | except Providers.NoProvider: |
| 177 | print "ERROR: No Provider" | 177 | print("ERROR: No Provider") |
| 178 | last_exception = Providers.NoProvider | 178 | last_exception = Providers.NoProvider |
| 179 | 179 | ||
| 180 | except runqueue.TaskFailure, fnids: | 180 | except runqueue.TaskFailure, fnids: |
| 181 | for fnid in fnids: | 181 | for fnid in fnids: |
| 182 | print "ERROR: '%s' failed" % td.fn_index[fnid] | 182 | print("ERROR: '%s' failed" % td.fn_index[fnid]) |
| 183 | last_exception = runqueue.TaskFailure | 183 | last_exception = runqueue.TaskFailure |
| 184 | 184 | ||
| 185 | except build.EventException, e: | 185 | except build.EventException, e: |
| 186 | print "ERROR: Couldn't build '%s'" % names | 186 | print("ERROR: Couldn't build '%s'" % names) |
| 187 | last_exception = e | 187 | last_exception = e |
| 188 | 188 | ||
| 189 | 189 | ||
| @@ -216,7 +216,7 @@ class BitBakeShellCommands: | |||
| 216 | if bbfile is not None: | 216 | if bbfile is not None: |
| 217 | os.system( "%s %s" % ( os.environ.get( "EDITOR", "vi" ), bbfile ) ) | 217 | os.system( "%s %s" % ( os.environ.get( "EDITOR", "vi" ), bbfile ) ) |
| 218 | else: | 218 | else: |
| 219 | print "ERROR: Nothing provides '%s'" % name | 219 | print("ERROR: Nothing provides '%s'" % name) |
| 220 | edit.usage = "<providee>" | 220 | edit.usage = "<providee>" |
| 221 | 221 | ||
| 222 | def environment( self, params ): | 222 | def environment( self, params ): |
| @@ -239,14 +239,14 @@ class BitBakeShellCommands: | |||
| 239 | global last_exception | 239 | global last_exception |
| 240 | name = params[0] | 240 | name = params[0] |
| 241 | bf = completeFilePath( name ) | 241 | bf = completeFilePath( name ) |
| 242 | print "SHELL: Calling '%s' on '%s'" % ( cmd, bf ) | 242 | print("SHELL: Calling '%s' on '%s'" % ( cmd, bf )) |
| 243 | 243 | ||
| 244 | try: | 244 | try: |
| 245 | cooker.buildFile(bf, cmd) | 245 | cooker.buildFile(bf, cmd) |
| 246 | except parse.ParseError: | 246 | except parse.ParseError: |
| 247 | print "ERROR: Unable to open or parse '%s'" % bf | 247 | print("ERROR: Unable to open or parse '%s'" % bf) |
| 248 | except build.EventException, e: | 248 | except build.EventException, e: |
| 249 | print "ERROR: Couldn't build '%s'" % name | 249 | print("ERROR: Couldn't build '%s'" % name) |
| 250 | last_exception = e | 250 | last_exception = e |
| 251 | 251 | ||
| 252 | fileBuild.usage = "<bbfile>" | 252 | fileBuild.usage = "<bbfile>" |
| @@ -270,62 +270,62 @@ class BitBakeShellCommands: | |||
| 270 | def fileReparse( self, params ): | 270 | def fileReparse( self, params ): |
| 271 | """(re)Parse a bb file""" | 271 | """(re)Parse a bb file""" |
| 272 | bbfile = params[0] | 272 | bbfile = params[0] |
| 273 | print "SHELL: Parsing '%s'" % bbfile | 273 | print("SHELL: Parsing '%s'" % bbfile) |
| 274 | parse.update_mtime( bbfile ) | 274 | parse.update_mtime( bbfile ) |
| 275 | cooker.bb_cache.cacheValidUpdate(bbfile) | 275 | cooker.bb_cache.cacheValidUpdate(bbfile) |
| 276 | fromCache = cooker.bb_cache.loadData(bbfile, cooker.configuration.data, cooker.status) | 276 | fromCache = cooker.bb_cache.loadData(bbfile, cooker.configuration.data, cooker.status) |
| 277 | cooker.bb_cache.sync() | 277 | cooker.bb_cache.sync() |
| 278 | if False: #fromCache: | 278 | if False: #fromCache: |
| 279 | print "SHELL: File has not been updated, not reparsing" | 279 | print("SHELL: File has not been updated, not reparsing") |
| 280 | else: | 280 | else: |
| 281 | print "SHELL: Parsed" | 281 | print("SHELL: Parsed") |
| 282 | fileReparse.usage = "<bbfile>" | 282 | fileReparse.usage = "<bbfile>" |
| 283 | 283 | ||
| 284 | def abort( self, params ): | 284 | def abort( self, params ): |
| 285 | """Toggle abort task execution flag (see bitbake -k)""" | 285 | """Toggle abort task execution flag (see bitbake -k)""" |
| 286 | cooker.configuration.abort = not cooker.configuration.abort | 286 | cooker.configuration.abort = not cooker.configuration.abort |
| 287 | print "SHELL: Abort Flag is now '%s'" % repr( cooker.configuration.abort ) | 287 | print("SHELL: Abort Flag is now '%s'" % repr( cooker.configuration.abort )) |
| 288 | 288 | ||
| 289 | def force( self, params ): | 289 | def force( self, params ): |
| 290 | """Toggle force task execution flag (see bitbake -f)""" | 290 | """Toggle force task execution flag (see bitbake -f)""" |
| 291 | cooker.configuration.force = not cooker.configuration.force | 291 | cooker.configuration.force = not cooker.configuration.force |
| 292 | print "SHELL: Force Flag is now '%s'" % repr( cooker.configuration.force ) | 292 | print("SHELL: Force Flag is now '%s'" % repr( cooker.configuration.force )) |
| 293 | 293 | ||
| 294 | def help( self, params ): | 294 | def help( self, params ): |
| 295 | """Show a comprehensive list of commands and their purpose""" | 295 | """Show a comprehensive list of commands and their purpose""" |
| 296 | print "="*30, "Available Commands", "="*30 | 296 | print("="*30, "Available Commands", "="*30) |
| 297 | for cmd in sorted(cmds): | 297 | for cmd in sorted(cmds): |
| 298 | function, numparams, usage, helptext = cmds[cmd] | 298 | function, numparams, usage, helptext = cmds[cmd] |
| 299 | print "| %s | %s" % (usage.ljust(30), helptext) | 299 | print("| %s | %s" % (usage.ljust(30), helptext)) |
| 300 | print "="*78 | 300 | print("="*78) |
| 301 | 301 | ||
| 302 | def lastError( self, params ): | 302 | def lastError( self, params ): |
| 303 | """Show the reason or log that was produced by the last BitBake event exception""" | 303 | """Show the reason or log that was produced by the last BitBake event exception""" |
| 304 | if last_exception is None: | 304 | if last_exception is None: |
| 305 | print "SHELL: No Errors yet (Phew)..." | 305 | print("SHELL: No Errors yet (Phew)...") |
| 306 | else: | 306 | else: |
| 307 | reason, event = last_exception.args | 307 | reason, event = last_exception.args |
| 308 | print "SHELL: Reason for the last error: '%s'" % reason | 308 | print("SHELL: Reason for the last error: '%s'" % reason) |
| 309 | if ':' in reason: | 309 | if ':' in reason: |
| 310 | msg, filename = reason.split( ':' ) | 310 | msg, filename = reason.split( ':' ) |
| 311 | filename = filename.strip() | 311 | filename = filename.strip() |
| 312 | print "SHELL: Dumping log file for last error:" | 312 | print("SHELL: Dumping log file for last error:") |
| 313 | try: | 313 | try: |
| 314 | print open( filename ).read() | 314 | print(open( filename ).read()) |
| 315 | except IOError: | 315 | except IOError: |
| 316 | print "ERROR: Couldn't open '%s'" % filename | 316 | print("ERROR: Couldn't open '%s'" % filename) |
| 317 | 317 | ||
| 318 | def match( self, params ): | 318 | def match( self, params ): |
| 319 | """Dump all files or providers matching a glob expression""" | 319 | """Dump all files or providers matching a glob expression""" |
| 320 | what, globexpr = params | 320 | what, globexpr = params |
| 321 | if what == "files": | 321 | if what == "files": |
| 322 | self._checkParsed() | 322 | self._checkParsed() |
| 323 | for key in globfilter( cooker.status.pkg_fn, globexpr ): print key | 323 | for key in globfilter( cooker.status.pkg_fn, globexpr ): print(key) |
| 324 | elif what == "providers": | 324 | elif what == "providers": |
| 325 | self._checkParsed() | 325 | self._checkParsed() |
| 326 | for key in globfilter( cooker.status.pkg_pn, globexpr ): print key | 326 | for key in globfilter( cooker.status.pkg_pn, globexpr ): print(key) |
| 327 | else: | 327 | else: |
| 328 | print "Usage: match %s" % self.print_.usage | 328 | print("Usage: match %s" % self.print_.usage) |
| 329 | match.usage = "<files|providers> <glob>" | 329 | match.usage = "<files|providers> <glob>" |
| 330 | 330 | ||
| 331 | def new( self, params ): | 331 | def new( self, params ): |
| @@ -335,15 +335,15 @@ class BitBakeShellCommands: | |||
| 335 | fulldirname = "%s/%s" % ( packages, dirname ) | 335 | fulldirname = "%s/%s" % ( packages, dirname ) |
| 336 | 336 | ||
| 337 | if not os.path.exists( fulldirname ): | 337 | if not os.path.exists( fulldirname ): |
| 338 | print "SHELL: Creating '%s'" % fulldirname | 338 | print("SHELL: Creating '%s'" % fulldirname) |
| 339 | os.mkdir( fulldirname ) | 339 | os.mkdir( fulldirname ) |
| 340 | if os.path.exists( fulldirname ) and os.path.isdir( fulldirname ): | 340 | if os.path.exists( fulldirname ) and os.path.isdir( fulldirname ): |
| 341 | if os.path.exists( "%s/%s" % ( fulldirname, filename ) ): | 341 | if os.path.exists( "%s/%s" % ( fulldirname, filename ) ): |
| 342 | print "SHELL: ERROR: %s/%s already exists" % ( fulldirname, filename ) | 342 | print("SHELL: ERROR: %s/%s already exists" % ( fulldirname, filename )) |
| 343 | return False | 343 | return False |
| 344 | print "SHELL: Creating '%s/%s'" % ( fulldirname, filename ) | 344 | print("SHELL: Creating '%s/%s'" % ( fulldirname, filename )) |
| 345 | newpackage = open( "%s/%s" % ( fulldirname, filename ), "w" ) | 345 | newpackage = open( "%s/%s" % ( fulldirname, filename ), "w" ) |
| 346 | print >>newpackage, """DESCRIPTION = "" | 346 | print("""DESCRIPTION = "" |
| 347 | SECTION = "" | 347 | SECTION = "" |
| 348 | AUTHOR = "" | 348 | AUTHOR = "" |
| 349 | HOMEPAGE = "" | 349 | HOMEPAGE = "" |
| @@ -370,7 +370,7 @@ SRC_URI = "" | |||
| 370 | #do_install() { | 370 | #do_install() { |
| 371 | # | 371 | # |
| 372 | #} | 372 | #} |
| 373 | """ | 373 | """, file=newpackage) |
| 374 | newpackage.close() | 374 | newpackage.close() |
| 375 | os.system( "%s %s/%s" % ( os.environ.get( "EDITOR" ), fulldirname, filename ) ) | 375 | os.system( "%s %s/%s" % ( os.environ.get( "EDITOR" ), fulldirname, filename ) ) |
| 376 | new.usage = "<directory> <filename>" | 376 | new.usage = "<directory> <filename>" |
| @@ -390,14 +390,14 @@ SRC_URI = "" | |||
| 390 | def pasteLog( self, params ): | 390 | def pasteLog( self, params ): |
| 391 | """Send the last event exception error log (if there is one) to http://rafb.net/paste""" | 391 | """Send the last event exception error log (if there is one) to http://rafb.net/paste""" |
| 392 | if last_exception is None: | 392 | if last_exception is None: |
| 393 | print "SHELL: No Errors yet (Phew)..." | 393 | print("SHELL: No Errors yet (Phew)...") |
| 394 | else: | 394 | else: |
| 395 | reason, event = last_exception.args | 395 | reason, event = last_exception.args |
| 396 | print "SHELL: Reason for the last error: '%s'" % reason | 396 | print("SHELL: Reason for the last error: '%s'" % reason) |
| 397 | if ':' in reason: | 397 | if ':' in reason: |
| 398 | msg, filename = reason.split( ':' ) | 398 | msg, filename = reason.split( ':' ) |
| 399 | filename = filename.strip() | 399 | filename = filename.strip() |
| 400 | print "SHELL: Pasting log file to pastebin..." | 400 | print("SHELL: Pasting log file to pastebin...") |
| 401 | 401 | ||
| 402 | file = open( filename ).read() | 402 | file = open( filename ).read() |
| 403 | sendToPastebin( "contents of " + filename, file ) | 403 | sendToPastebin( "contents of " + filename, file ) |
| @@ -419,23 +419,23 @@ SRC_URI = "" | |||
| 419 | cooker.buildDepgraph() | 419 | cooker.buildDepgraph() |
| 420 | global parsed | 420 | global parsed |
| 421 | parsed = True | 421 | parsed = True |
| 422 | 422 | print() | |
| 423 | 423 | ||
| 424 | def reparse( self, params ): | 424 | def reparse( self, params ): |
| 425 | """(re)Parse a providee's bb file""" | 425 | """(re)Parse a providee's bb file""" |
| 426 | bbfile = self._findProvider( params[0] ) | 426 | bbfile = self._findProvider( params[0] ) |
| 427 | if bbfile is not None: | 427 | if bbfile is not None: |
| 428 | print "SHELL: Found bbfile '%s' for '%s'" % ( bbfile, params[0] ) | 428 | print("SHELL: Found bbfile '%s' for '%s'" % ( bbfile, params[0] )) |
| 429 | self.fileReparse( [ bbfile ] ) | 429 | self.fileReparse( [ bbfile ] ) |
| 430 | else: | 430 | else: |
| 431 | print "ERROR: Nothing provides '%s'" % params[0] | 431 | print("ERROR: Nothing provides '%s'" % params[0]) |
| 432 | reparse.usage = "<providee>" | 432 | reparse.usage = "<providee>" |
| 433 | 433 | ||
| 434 | def getvar( self, params ): | 434 | def getvar( self, params ): |
| 435 | """Dump the contents of an outer BitBake environment variable""" | 435 | """Dump the contents of an outer BitBake environment variable""" |
| 436 | var = params[0] | 436 | var = params[0] |
| 437 | value = data.getVar( var, cooker.configuration.data, 1 ) | 437 | value = data.getVar( var, cooker.configuration.data, 1 ) |
| 438 | print value | 438 | print(value) |
| 439 | getvar.usage = "<variable>" | 439 | getvar.usage = "<variable>" |
| 440 | 440 | ||
| 441 | def peek( self, params ): | 441 | def peek( self, params ): |
| @@ -445,9 +445,9 @@ SRC_URI = "" | |||
| 445 | if bbfile is not None: | 445 | if bbfile is not None: |
| 446 | the_data = cooker.bb_cache.loadDataFull(bbfile, cooker.configuration.data) | 446 | the_data = cooker.bb_cache.loadDataFull(bbfile, cooker.configuration.data) |
| 447 | value = the_data.getVar( var, 1 ) | 447 | value = the_data.getVar( var, 1 ) |
| 448 | print value | 448 | print(value) |
| 449 | else: | 449 | else: |
| 450 | print "ERROR: Nothing provides '%s'" % name | 450 | print("ERROR: Nothing provides '%s'" % name) |
| 451 | peek.usage = "<providee> <variable>" | 451 | peek.usage = "<providee> <variable>" |
| 452 | 452 | ||
| 453 | def poke( self, params ): | 453 | def poke( self, params ): |
| @@ -455,7 +455,7 @@ SRC_URI = "" | |||
| 455 | name, var, value = params | 455 | name, var, value = params |
| 456 | bbfile = self._findProvider( name ) | 456 | bbfile = self._findProvider( name ) |
| 457 | if bbfile is not None: | 457 | if bbfile is not None: |
| 458 | print "ERROR: Sorry, this functionality is currently broken" | 458 | print("ERROR: Sorry, this functionality is currently broken") |
| 459 | #d = cooker.pkgdata[bbfile] | 459 | #d = cooker.pkgdata[bbfile] |
| 460 | #data.setVar( var, value, d ) | 460 | #data.setVar( var, value, d ) |
| 461 | 461 | ||
| @@ -463,7 +463,7 @@ SRC_URI = "" | |||
| 463 | #cooker.pkgdata.setDirty(bbfile, d) | 463 | #cooker.pkgdata.setDirty(bbfile, d) |
| 464 | #print "OK" | 464 | #print "OK" |
| 465 | else: | 465 | else: |
| 466 | print "ERROR: Nothing provides '%s'" % name | 466 | print("ERROR: Nothing provides '%s'" % name) |
| 467 | poke.usage = "<providee> <variable> <value>" | 467 | poke.usage = "<providee> <variable> <value>" |
| 468 | 468 | ||
| 469 | def print_( self, params ): | 469 | def print_( self, params ): |
| @@ -471,12 +471,12 @@ SRC_URI = "" | |||
| 471 | what = params[0] | 471 | what = params[0] |
| 472 | if what == "files": | 472 | if what == "files": |
| 473 | self._checkParsed() | 473 | self._checkParsed() |
| 474 | for key in cooker.status.pkg_fn: print key | 474 | for key in cooker.status.pkg_fn: print(key) |
| 475 | elif what == "providers": | 475 | elif what == "providers": |
| 476 | self._checkParsed() | 476 | self._checkParsed() |
| 477 | for key in cooker.status.providers: print key | 477 | for key in cooker.status.providers: print(key) |
| 478 | else: | 478 | else: |
| 479 | print "Usage: print %s" % self.print_.usage | 479 | print("Usage: print %s" % self.print_.usage) |
| 480 | print_.usage = "<files|providers>" | 480 | print_.usage = "<files|providers>" |
| 481 | 481 | ||
| 482 | def python( self, params ): | 482 | def python( self, params ): |
| @@ -496,7 +496,7 @@ SRC_URI = "" | |||
| 496 | """Set an outer BitBake environment variable""" | 496 | """Set an outer BitBake environment variable""" |
| 497 | var, value = params | 497 | var, value = params |
| 498 | data.setVar( var, value, cooker.configuration.data ) | 498 | data.setVar( var, value, cooker.configuration.data ) |
| 499 | print "OK" | 499 | print("OK") |
| 500 | setVar.usage = "<variable> <value>" | 500 | setVar.usage = "<variable> <value>" |
| 501 | 501 | ||
| 502 | def rebuild( self, params ): | 502 | def rebuild( self, params ): |
| @@ -508,7 +508,7 @@ SRC_URI = "" | |||
| 508 | def shell( self, params ): | 508 | def shell( self, params ): |
| 509 | """Execute a shell command and dump the output""" | 509 | """Execute a shell command and dump the output""" |
| 510 | if params != "": | 510 | if params != "": |
| 511 | print commands.getoutput( " ".join( params ) ) | 511 | print(commands.getoutput( " ".join( params ) )) |
| 512 | shell.usage = "<...>" | 512 | shell.usage = "<...>" |
| 513 | 513 | ||
| 514 | def stage( self, params ): | 514 | def stage( self, params ): |
| @@ -518,17 +518,17 @@ SRC_URI = "" | |||
| 518 | 518 | ||
| 519 | def status( self, params ): | 519 | def status( self, params ): |
| 520 | """<just for testing>""" | 520 | """<just for testing>""" |
| 521 | print "-" * 78 | 521 | print("-" * 78) |
| 522 | print "building list = '%s'" % cooker.building_list | 522 | print("building list = '%s'" % cooker.building_list) |
| 523 | print "build path = '%s'" % cooker.build_path | 523 | print("build path = '%s'" % cooker.build_path) |
| 524 | print "consider_msgs_cache = '%s'" % cooker.consider_msgs_cache | 524 | print("consider_msgs_cache = '%s'" % cooker.consider_msgs_cache) |
| 525 | print "build stats = '%s'" % cooker.stats | 525 | print("build stats = '%s'" % cooker.stats) |
| 526 | if last_exception is not None: print "last_exception = '%s'" % repr( last_exception.args ) | 526 | if last_exception is not None: print("last_exception = '%s'" % repr( last_exception.args )) |
| 527 | print "memory output contents = '%s'" % self._shell.myout._buffer | 527 | print("memory output contents = '%s'" % self._shell.myout._buffer) |
| 528 | 528 | ||
| 529 | def test( self, params ): | 529 | def test( self, params ): |
| 530 | """<just for testing>""" | 530 | """<just for testing>""" |
| 531 | print "testCommand called with '%s'" % params | 531 | print("testCommand called with '%s'" % params) |
| 532 | 532 | ||
| 533 | def unpack( self, params ): | 533 | def unpack( self, params ): |
| 534 | """Execute 'unpack' on a providee""" | 534 | """Execute 'unpack' on a providee""" |
| @@ -553,12 +553,12 @@ SRC_URI = "" | |||
| 553 | try: | 553 | try: |
| 554 | providers = cooker.status.providers[item] | 554 | providers = cooker.status.providers[item] |
| 555 | except KeyError: | 555 | except KeyError: |
| 556 | print "SHELL: ERROR: Nothing provides", preferred | 556 | print("SHELL: ERROR: Nothing provides", preferred) |
| 557 | else: | 557 | else: |
| 558 | for provider in providers: | 558 | for provider in providers: |
| 559 | if provider == pf: provider = " (***) %s" % provider | 559 | if provider == pf: provider = " (***) %s" % provider |
| 560 | else: provider = " %s" % provider | 560 | else: provider = " %s" % provider |
| 561 | print provider | 561 | print(provider) |
| 562 | which.usage = "<providee>" | 562 | which.usage = "<providee>" |
| 563 | 563 | ||
| 564 | ########################################################################## | 564 | ########################################################################## |
| @@ -594,9 +594,9 @@ def sendToPastebin( desc, content ): | |||
| 594 | 594 | ||
| 595 | if response.status == 302: | 595 | if response.status == 302: |
| 596 | location = response.getheader( "location" ) or "unknown" | 596 | location = response.getheader( "location" ) or "unknown" |
| 597 | print "SHELL: Pasted to http://%s%s" % ( host, location ) | 597 | print("SHELL: Pasted to http://%s%s" % ( host, location )) |
| 598 | else: | 598 | else: |
| 599 | print "ERROR: %s %s" % ( response.status, response.reason ) | 599 | print("ERROR: %s %s" % ( response.status, response.reason )) |
| 600 | 600 | ||
| 601 | def completer( text, state ): | 601 | def completer( text, state ): |
| 602 | """Return a possible readline completion""" | 602 | """Return a possible readline completion""" |
| @@ -718,7 +718,7 @@ class BitBakeShell: | |||
| 718 | except IOError: | 718 | except IOError: |
| 719 | pass # It doesn't exist yet. | 719 | pass # It doesn't exist yet. |
| 720 | 720 | ||
| 721 | print __credits__ | 721 | print(__credits__) |
| 722 | 722 | ||
| 723 | def cleanup( self ): | 723 | def cleanup( self ): |
| 724 | """Write readline history and clean up resources""" | 724 | """Write readline history and clean up resources""" |
| @@ -726,7 +726,7 @@ class BitBakeShell: | |||
| 726 | try: | 726 | try: |
| 727 | readline.write_history_file( self.historyfilename ) | 727 | readline.write_history_file( self.historyfilename ) |
| 728 | except: | 728 | except: |
| 729 | print "SHELL: Unable to save command history" | 729 | print("SHELL: Unable to save command history") |
| 730 | 730 | ||
| 731 | def registerCommand( self, command, function, numparams = 0, usage = "", helptext = "" ): | 731 | def registerCommand( self, command, function, numparams = 0, usage = "", helptext = "" ): |
| 732 | """Register a command""" | 732 | """Register a command""" |
| @@ -740,11 +740,11 @@ class BitBakeShell: | |||
| 740 | try: | 740 | try: |
| 741 | function, numparams, usage, helptext = cmds[command] | 741 | function, numparams, usage, helptext = cmds[command] |
| 742 | except KeyError: | 742 | except KeyError: |
| 743 | print "SHELL: ERROR: '%s' command is not a valid command." % command | 743 | print("SHELL: ERROR: '%s' command is not a valid command." % command) |
| 744 | self.myout.removeLast() | 744 | self.myout.removeLast() |
| 745 | else: | 745 | else: |
| 746 | if (numparams != -1) and (not len( params ) == numparams): | 746 | if (numparams != -1) and (not len( params ) == numparams): |
| 747 | print "Usage: '%s'" % usage | 747 | print("Usage: '%s'" % usage) |
| 748 | return | 748 | return |
| 749 | 749 | ||
| 750 | result = function( self.commands, params ) | 750 | result = function( self.commands, params ) |
| @@ -759,7 +759,7 @@ class BitBakeShell: | |||
| 759 | if not cmdline: | 759 | if not cmdline: |
| 760 | continue | 760 | continue |
| 761 | if "|" in cmdline: | 761 | if "|" in cmdline: |
| 762 | print "ERROR: '|' in startup file is not allowed. Ignoring line" | 762 | print("ERROR: '|' in startup file is not allowed. Ignoring line") |
| 763 | continue | 763 | continue |
| 764 | self.commandQ.put( cmdline.strip() ) | 764 | self.commandQ.put( cmdline.strip() ) |
| 765 | 765 | ||
| @@ -801,10 +801,10 @@ class BitBakeShell: | |||
| 801 | sys.stdout.write( pipe.fromchild.read() ) | 801 | sys.stdout.write( pipe.fromchild.read() ) |
| 802 | # | 802 | # |
| 803 | except EOFError: | 803 | except EOFError: |
| 804 | 804 | print() | |
| 805 | return | 805 | return |
| 806 | except KeyboardInterrupt: | 806 | except KeyboardInterrupt: |
| 807 | 807 | print() | |
| 808 | 808 | ||
| 809 | ########################################################################## | 809 | ########################################################################## |
| 810 | # Start function - called from the BitBake command line utility | 810 | # Start function - called from the BitBake command line utility |
| @@ -819,4 +819,4 @@ def start( aCooker ): | |||
| 819 | bbshell.cleanup() | 819 | bbshell.cleanup() |
| 820 | 820 | ||
| 821 | if __name__ == "__main__": | 821 | if __name__ == "__main__": |
| 822 | print "SHELL: Sorry, this program should only be called by BitBake." | 822 | print("SHELL: Sorry, this program should only be called by BitBake.") |
