original_docstring: Entry point for the devtool 'configure-help' subcommand
docstring: Entry point for the devtool 'configure-help' subcommand
docstring_tokens: Entry point for the devtool ' configure - help ' subcommand
code: def configure_help(args, config, basepath, workspace):
      """Entry point for the devtool 'configure-help' subcommand"""
      import oe.utils
  
      check_workspace_recipe(workspace, args.recipename)
      tinfoil = setup_tinfoil(config_only=False, basepath=basepath)
      try:
          rd = parse_recipe(config, tinfoil, args.recipename, appends=True, filter_workspace=False)
          if not rd:
              return 1
          b = rd.getVar('B')
          s = rd.getVar('S')
          configurescript = os.path.join(s, 'configure')
          confdisabled = 'noexec' in rd.getVarFlags('do_configure') or 'do_configure' not in (rd.getVar('__BBTASKS', False) or [])
          configureopts = oe.utils.squashspaces(rd.getVar('CONFIGUREOPTS') or '')
          extra_oeconf = oe.utils.squashspaces(rd.getVar('EXTRA_OECONF') or '')
          extra_oecmake = oe.utils.squashspaces(rd.getVar('EXTRA_OECMAKE') or '')
          do_configure = rd.getVar('do_configure') or ''
          do_configure_noexpand = rd.getVar('do_configure', False) or ''
          packageconfig = rd.getVarFlags('PACKAGECONFIG') or []
          autotools = bb.data.inherits_class('autotools', rd) and ('oe_runconf' in do_configure or 'autotools_do_configure' in do_configure)
          cmake = bb.data.inherits_class('cmake', rd) and ('cmake_do_configure' in do_configure)
          cmake_do_configure = rd.getVar('cmake_do_configure')
          pn = rd.getVar('PN')
      finally:
          tinfoil.shutdown()
  
      if 'doc' in packageconfig:
          del packageconfig['doc']
  
      if autotools and not os.path.exists(configurescript):
          logger.info('Running do_configure to generate configure script')
          try:
              stdout, _ = exec_build_env_command(config.init_path, basepath,
                                                 'bitbake -c configure %s' % args.recipename,
                                                 stderr=subprocess.STDOUT)
          except bb.process.ExecutionError:
              pass
  
      if confdisabled or do_configure.strip() in ('', ':'):
          raise DevtoolError("do_configure task has been disabled for this recipe")
      elif args.no_pager and not os.path.exists(configurescript):
          raise DevtoolError("No configure script found and no other information to display")
      else:
          configopttext = ''
          if autotools and configureopts:
              configopttext = '''
  Arguments currently passed to the configure script:
  
  %s
  
  Some of those are fixed.''' % (configureopts + ' ' + extra_oeconf)
              if extra_oeconf:
                  configopttext += ''' The ones that are specified through EXTRA_OECONF (which you can change or add to easily):
  
  %s''' % extra_oeconf
  
          elif cmake:
              in_cmake = False
              cmake_cmd = ''
              for line in cmake_do_configure.splitlines():
                  if in_cmake:
                      cmake_cmd = cmake_cmd + ' ' + line.strip().rstrip('\\')
                      if not line.endswith('\\'):
                          break
                  if line.lstrip().startswith('cmake '):
                      cmake_cmd = line.strip().rstrip('\\')
                      if line.endswith('\\'):
                          in_cmake = True
                      else:
                          break
              if cmake_cmd:
                  configopttext = '''
  The current cmake command line:
  
  %s
  
  Arguments specified through EXTRA_OECMAKE (which you can change or add to easily)
  
  %s''' % (oe.utils.squashspaces(cmake_cmd), extra_oecmake)
              else:
                  configopttext = '''
  The current implementation of cmake_do_configure:
  
  cmake_do_configure() {
  %s
  }
  
  Arguments specified through EXTRA_OECMAKE (which you can change or add to easily)
  
  %s''' % (cmake_do_configure.rstrip(), extra_oecmake)
  
          elif do_configure:
              configopttext = '''
  The current implementation of do_configure:
  
  do_configure() {
  %s
  }''' % do_configure.rstrip()
              if '${EXTRA_OECONF}' in do_configure_noexpand:
                  configopttext += '''
  
  Arguments specified through EXTRA_OECONF (which you can change or add to easily):
  
  %s''' % extra_oeconf
  
          if packageconfig:
              configopttext += '''
  
  Some of these options may be controlled through PACKAGECONFIG; for more details please see the recipe.'''
  
          if args.arg:
              helpargs = ' '.join(args.arg)
          elif cmake:
              helpargs = '-LH'
          else:
              helpargs = '--help'
  
          msg = '''configure information for %s
  ------------------------------------------
  %s''' % (pn, configopttext)
  
          if cmake:
              msg += '''
  
  The cmake %s output for %s follows. After "-- Cache values" you should see a list of variables you can add to EXTRA_OECMAKE (prefixed with -D and suffixed with = followed by the desired value, without any spaces).
  ------------------------------------------''' % (helpargs, pn)
          elif os.path.exists(configurescript):
              msg += '''
  
  The ./configure %s output for %s follows.
  ------------------------------------------''' % (helpargs, pn)
  
          olddir = os.getcwd()
          tmppath = tempfile.mkdtemp()
          with tempfile.NamedTemporaryFile('w', delete=False) as tf:
              if not args.no_header:
                  tf.write(msg + '\n')
              tf.close()
              try:
                  try:
                      cmd = 'cat %s' % tf.name
                      if cmake:
                          cmd += '; cmake %s %s 2>&1' % (helpargs, s)
                          os.chdir(b)
                      elif os.path.exists(configurescript):
                          cmd += '; %s %s' % (configurescript, helpargs)
                      if sys.stdout.isatty() and not args.no_pager:
                          pager = os.environ.get('PAGER', 'less')
                          cmd = '(%s) | %s' % (cmd, pager)
                      subprocess.check_call(cmd, shell=True)
                  except subprocess.CalledProcessError as e:
                      return e.returncode
              finally:
                  os.chdir(olddir)
                  shutil.rmtree(tmppath)
                  os.remove(tf.name)
code_tokens: def configure_help ( args , config , basepath , workspace ) : import oe . utils check_workspace_recipe ( workspace , args . recipename ) tinfoil = setup_tinfoil ( config_only = False , basepath = basepath ) try : rd = parse_recipe ( config , tinfoil , args . recipename , appends = True , filter_workspace = False ) if not rd : return 1 b = rd . getVar ( 'B' ) s = rd . getVar ( 'S' ) configurescript = os . path . join ( s , 'configure' ) confdisabled = 'noexec' in rd . getVarFlags ( 'do_configure' ) or 'do_configure' not in ( rd . getVar ( '__BBTASKS' , False ) or [ ] ) configureopts = oe . utils . squashspaces ( rd . getVar ( 'CONFIGUREOPTS' ) or '' ) extra_oeconf = oe . utils . squashspaces ( rd . getVar ( 'EXTRA_OECONF' ) or '' ) extra_oecmake = oe . utils . squashspaces ( rd . getVar ( 'EXTRA_OECMAKE' ) or '' ) do_configure = rd . getVar ( 'do_configure' ) or '' do_configure_noexpand = rd . getVar ( 'do_configure' , False ) or '' packageconfig = rd . getVarFlags ( 'PACKAGECONFIG' ) or [ ] autotools = bb . data . inherits_class ( 'autotools' , rd ) and ( 'oe_runconf' in do_configure or 'autotools_do_configure' in do_configure ) cmake = bb . data . inherits_class ( 'cmake' , rd ) and ( 'cmake_do_configure' in do_configure ) cmake_do_configure = rd . getVar ( 'cmake_do_configure' ) pn = rd . getVar ( 'PN' ) finally : tinfoil . shutdown ( ) if 'doc' in packageconfig : del packageconfig [ 'doc' ] if autotools and not os . path . exists ( configurescript ) : logger . info ( 'Running do_configure to generate configure script' ) try : stdout , _ = exec_build_env_command ( config . init_path , basepath , 'bitbake -c configure %s' % args . recipename , stderr = subprocess . STDOUT ) except bb . process . ExecutionError : pass if confdisabled or do_configure . strip ( ) in ( '' , ':' ) : raise DevtoolError ( "do_configure task has been disabled for this recipe" ) elif args . no_pager and not os . path . exists ( configurescript ) : raise DevtoolError ( "No configure script found and no other information to display" ) else : configopttext = '' if autotools and configureopts : configopttext = '''
  Arguments currently passed to the configure script:
  
  %s
  
  Some of those are fixed.''' % ( configureopts + ' ' + extra_oeconf ) if extra_oeconf : configopttext += ''' The ones that are specified through EXTRA_OECONF (which you can change or add to easily):
  
  %s''' % extra_oeconf elif cmake : in_cmake = False cmake_cmd = '' for line in cmake_do_configure . splitlines ( ) : if in_cmake : cmake_cmd = cmake_cmd + ' ' + line . strip ( ) . rstrip ( '\\' ) if not line . endswith ( '\\' ) : break if line . lstrip ( ) . startswith ( 'cmake ' ) : cmake_cmd = line . strip ( ) . rstrip ( '\\' ) if line . endswith ( '\\' ) : in_cmake = True else : break if cmake_cmd : configopttext = '''
  The current cmake command line:
  
  %s
  
  Arguments specified through EXTRA_OECMAKE (which you can change or add to easily)
  
  %s''' % ( oe . utils . squashspaces ( cmake_cmd ) , extra_oecmake ) else : configopttext = '''
  The current implementation of cmake_do_configure:
  
  cmake_do_configure() {
  %s
  }
  
  Arguments specified through EXTRA_OECMAKE (which you can change or add to easily)
  
  %s''' % ( cmake_do_configure . rstrip ( ) , extra_oecmake ) elif do_configure : configopttext = '''
  The current implementation of do_configure:
  
  do_configure() {
  %s
  }''' % do_configure . rstrip ( ) if '${EXTRA_OECONF}' in do_configure_noexpand : configopttext += '''
  
  Arguments specified through EXTRA_OECONF (which you can change or add to easily):
  
  %s''' % extra_oeconf if packageconfig : configopttext += '''
  
  Some of these options may be controlled through PACKAGECONFIG; for more details please see the recipe.''' if args . arg : helpargs = ' ' . join ( args . arg ) elif cmake : helpargs = '-LH' else : helpargs = '--help' msg = '''configure information for %s
  ------------------------------------------
  %s''' % ( pn , configopttext ) if cmake : msg += '''
  
  The cmake %s output for %s follows. After "-- Cache values" you should see a list of variables you can add to EXTRA_OECMAKE (prefixed with -D and suffixed with = followed by the desired value, without any spaces).
  ------------------------------------------''' % ( helpargs , pn ) elif os . path . exists ( configurescript ) : msg += '''
  
  The ./configure %s output for %s follows.
  ------------------------------------------''' % ( helpargs , pn ) olddir = os . getcwd ( ) tmppath = tempfile . mkdtemp ( ) with tempfile . NamedTemporaryFile ( 'w' , delete = False ) as tf : if not args . no_header : tf . write ( msg + '\n' ) tf . close ( ) try : try : cmd = 'cat %s' % tf . name if cmake : cmd += '; cmake %s %s 2>&1' % ( helpargs , s ) os . chdir ( b ) elif os . path . exists ( configurescript ) : cmd += '; %s %s' % ( configurescript , helpargs ) if sys . stdout . isatty ( ) and not args . no_pager : pager = os . environ . get ( 'PAGER' , 'less' ) cmd = '(%s) | %s' % ( cmd , pager ) subprocess . check_call ( cmd , shell = True ) except subprocess . CalledProcessError as e : return e . returncode finally : os . chdir ( olddir ) shutil . rmtree ( tmppath ) os . remove ( tf . name )
short_docstring: Entry point for the devtool 'configure-help' subcommand
short_docstring_tokens: Entry point for the devtool ' configure - help ' subcommand
comment: """Entry point for the devtool 'configure-help' subcommand"""