parameters: (self)
docstring: scons_rules.
  
          Description
          -----------
          It outputs the scons rules according to user options.
docstring_summary: scons_rules.
docstring_tokens: scons_rules .
function: def scons_rules(self):
          """scons_rules.
  
          Description
          -----------
          It outputs the scons rules according to user options.
  
          """
          self._clone_env()
  
          if self.type == 'prebuilt_py_binary':
              return
  
          env_name = self._env_name()
  
          setup_file = os.path.join(self.path, 'setup.py')
          python_package = os.path.join(self.path, self.name)
          init_file = os.path.join(python_package, '__init__.py')
  
          binary_files = []
          if os.path.exists(setup_file):
              binary_files.append(setup_file)
  
          if not os.path.exists(init_file):
              console.error_exit('The __init__.py not existed in %s' % python_package)
          binary_files.append(init_file)
  
          dep_var_list = []
          self.targets = self.blade.get_build_targets()
          for dep in self.expanded_deps:
              binary_files += targets[dep].data.get('python_sources', [])
              dep_var_list += targets[dep].data.get('python_vars', [])
  
          target_egg_file = '%s.egg' % self._target_file_path()
          python_binary_var = '%s_python_binary_var' % (
              self._generate_variable_name(self.path, self.name))
          self._write_rule('%s = %s.PythonBinary(["%s"], %s)' % (
                            python_binary_var,
                            env_name,
                            target_egg_file,
                            binary_files))
          for var in dep_var_list:
              self._write_rule('%s.Depends(%s, %s)' % (
                               env_name, python_binary_var, var))
function_tokens: def scons_rules ( self ) : self . _clone_env ( ) if self . type == 'prebuilt_py_binary' : return env_name = self . _env_name ( ) setup_file = os . path . join ( self . path , 'setup.py' ) python_package = os . path . join ( self . path , self . name ) init_file = os . path . join ( python_package , '__init__.py' ) binary_files = [ ] if os . path . exists ( setup_file ) : binary_files . append ( setup_file ) if not os . path . exists ( init_file ) : console . error_exit ( 'The __init__.py not existed in %s' % python_package ) binary_files . append ( init_file ) dep_var_list = [ ] self . targets = self . blade . get_build_targets ( ) for dep in self . expanded_deps : binary_files += targets [ dep ] . data . get ( 'python_sources' , [ ] ) dep_var_list += targets [ dep ] . data . get ( 'python_vars' , [ ] ) target_egg_file = '%s.egg' % self . _target_file_path ( ) python_binary_var = '%s_python_binary_var' % ( self . _generate_variable_name ( self . path , self . name ) ) self . _write_rule ( '%s = %s.PythonBinary(["%s"], %s)' % ( python_binary_var , env_name , target_egg_file , binary_files ) ) for var in dep_var_list : self . _write_rule ( '%s.Depends(%s, %s)' % ( env_name , python_binary_var , var ) )