bindings/python/wscript
changeset 4067 165b38956c24
parent 4066 d2309cf765d8
child 4068 e0eb69d55e40
equal deleted inserted replaced
4066:d2309cf765d8 4067:165b38956c24
    62     Fetches pybindgen from launchpad as bindings/python/pybindgen.
    62     Fetches pybindgen from launchpad as bindings/python/pybindgen.
    63     Returns True if successful, False it not.
    63     Returns True if successful, False it not.
    64     """
    64     """
    65     bzr = conf.find_program("bzr")
    65     bzr = conf.find_program("bzr")
    66     if not bzr:
    66     if not bzr:
    67         warning("the program 'bzr' is needed in order to fetch pybindgen")
    67         Logs.warn("the program 'bzr' is needed in order to fetch pybindgen")
    68         return False
    68         return False
    69     if len(REQUIRED_PYBINDGEN_VERSION) == 4:
    69     if len(REQUIRED_PYBINDGEN_VERSION) == 4:
    70         rev = "-rrevno:%i" % REQUIRED_PYBINDGEN_VERSION[3]
    70         rev = "-rrevno:%i" % REQUIRED_PYBINDGEN_VERSION[3]
    71     else:
    71     else:
    72         rev = "-rtag:%s" % '.'.join([str(x) for x in REQUIRED_PYBINDGEN_VERSION])
    72         rev = "-rtag:%s" % '.'.join([str(x) for x in REQUIRED_PYBINDGEN_VERSION])
   154     set_pybindgen_pythonpath(conf.env)
   154     set_pybindgen_pythonpath(conf.env)
   155 
   155 
   156     try:
   156     try:
   157         conf.check_python_module('pybindgen')
   157         conf.check_python_module('pybindgen')
   158     except Configure.ConfigurationError:
   158     except Configure.ConfigurationError:
   159         warning("pybindgen missing")
   159         Logs.warn("pybindgen missing")
   160         if no_net or not fetch_pybindgen(conf):
   160         if no_net or not fetch_pybindgen(conf):
   161             conf.report_optional_feature("python", "Python Bindings", False,
   161             conf.report_optional_feature("python", "Python Bindings", False,
   162                                          "PyBindGen missing and could not be retrieved")
   162                                          "PyBindGen missing and could not be retrieved")
   163             return
   163             return
   164     else:
   164     else:
   170         pybindgen_version = tuple([int(x) for x in pybindgen_version_str.split('.')])
   170         pybindgen_version = tuple([int(x) for x in pybindgen_version_str.split('.')])
   171         conf.check_message('pybindgen', 'version',
   171         conf.check_message('pybindgen', 'version',
   172                            (pybindgen_version >= REQUIRED_PYBINDGEN_VERSION),
   172                            (pybindgen_version >= REQUIRED_PYBINDGEN_VERSION),
   173                            pybindgen_version_str)
   173                            pybindgen_version_str)
   174         if not (pybindgen_version >= REQUIRED_PYBINDGEN_VERSION):
   174         if not (pybindgen_version >= REQUIRED_PYBINDGEN_VERSION):
   175             warning("pybindgen (found %s) is too old (need %s)" %
   175             Logs.warn("pybindgen (found %s) is too old (need %s)" %
   176                     (pybindgen_version_str,
   176                     (pybindgen_version_str,
   177                      '.'.join([str(x) for x in REQUIRED_PYBINDGEN_VERSION])))
   177                      '.'.join([str(x) for x in REQUIRED_PYBINDGEN_VERSION])))
   178             if no_net or not fetch_pybindgen(conf):
   178             if no_net or not fetch_pybindgen(conf):
   179                 conf.report_optional_feature("python", "Python Bindings", False,
   179                 conf.report_optional_feature("python", "Python Bindings", False,
   180                                              "PyBindGen too old and newer version could not be retrieved")
   180                                              "PyBindGen too old and newer version could not be retrieved")
   199     pygccxml_version = tuple([int(x) for x in pygccxml_version_str.split('.')])
   199     pygccxml_version = tuple([int(x) for x in pygccxml_version_str.split('.')])
   200     conf.check_message('pygccxml', 'version',
   200     conf.check_message('pygccxml', 'version',
   201                        (pygccxml_version >= REQUIRED_PYGCCXML_VERSION),
   201                        (pygccxml_version >= REQUIRED_PYGCCXML_VERSION),
   202                        pygccxml_version_str)
   202                        pygccxml_version_str)
   203     if not (pygccxml_version >= REQUIRED_PYGCCXML_VERSION):
   203     if not (pygccxml_version >= REQUIRED_PYGCCXML_VERSION):
   204         warning("pygccxml (found %s) is too old (need %s) => "
   204         Logs.warn("pygccxml (found %s) is too old (need %s) => "
   205                 "automatic scanning of API definitions will not be possible" %
   205                 "automatic scanning of API definitions will not be possible" %
   206                 (pygccxml_version_str,
   206                 (pygccxml_version_str,
   207                  '.'.join([str(x) for x in REQUIRED_PYGCCXML_VERSION])))
   207                  '.'.join([str(x) for x in REQUIRED_PYGCCXML_VERSION])))
   208         conf.report_optional_feature("pygccxml", "Python API Scanning Support", False,
   208         conf.report_optional_feature("pygccxml", "Python API Scanning Support", False,
   209                                      "pygccxml too old")
   209                                      "pygccxml too old")
   211     
   211     
   212 
   212 
   213     ## Check gccxml version
   213     ## Check gccxml version
   214     gccxml = conf.find_program('gccxml', var='GCCXML')
   214     gccxml = conf.find_program('gccxml', var='GCCXML')
   215     if not gccxml:
   215     if not gccxml:
   216         warning("gccxml missing; automatic scanning of API definitions will not be possible")
   216         Logs.warn("gccxml missing; automatic scanning of API definitions will not be possible")
   217         conf.report_optional_feature("pygccxml", "Python API Scanning Support", False,
   217         conf.report_optional_feature("pygccxml", "Python API Scanning Support", False,
   218                                      "gccxml missing")
   218                                      "gccxml missing")
   219         return
   219         return
   220 
   220 
   221     gccxml_version_line = os.popen(gccxml + " --version").readline().strip()
   221     gccxml_version_line = os.popen(gccxml + " --version").readline().strip()
   222     m = re.match( "^GCC-XML version (\d\.\d(\.\d)?)$", gccxml_version_line)
   222     m = re.match( "^GCC-XML version (\d\.\d(\.\d)?)$", gccxml_version_line)
   223     gccxml_version = m.group(1)
   223     gccxml_version = m.group(1)
   224     gccxml_version_ok = ([int(s) for s in gccxml_version.split('.')] >= [0, 9])
   224     gccxml_version_ok = ([int(s) for s in gccxml_version.split('.')] >= [0, 9])
   225     conf.check_message('gccxml', 'version', True, gccxml_version)
   225     conf.check_message('gccxml', 'version', True, gccxml_version)
   226     if not gccxml_version_ok:
   226     if not gccxml_version_ok:
   227         warning("gccxml too old, need version >= 0.9; automatic scanning of API definitions will not be possible")
   227         Logs.warn("gccxml too old, need version >= 0.9; automatic scanning of API definitions will not be possible")
   228         conf.report_optional_feature("pygccxml", "Python API Scanning Support", False,
   228         conf.report_optional_feature("pygccxml", "Python API Scanning Support", False,
   229                                      "gccxml too old")
   229                                      "gccxml too old")
   230         return
   230         return
   231     
   231     
   232     ## If we reached
   232     ## If we reached
   353 
   353 
   354                     for source in ns3headers.to_list(ns3headers.source):
   354                     for source in ns3headers.to_list(ns3headers.source):
   355                         #source = os.path.basename(source)
   355                         #source = os.path.basename(source)
   356                         node = ns3_dir_node.find_or_declare(source)
   356                         node = ns3_dir_node.find_or_declare(source)
   357                         if node is None:
   357                         if node is None:
   358                             fatal("missing header file %s" % (source,))
   358                             raise Utils.WafError("missing header file %s" % (source,))
   359                         all_headers_inputs.append(node)
   359                         all_headers_inputs.append(node)
   360         assert all_headers_inputs
   360         assert all_headers_inputs
   361         all_headers_outputs = [self.path.find_or_declare("everything.h")]
   361         all_headers_outputs = [self.path.find_or_declare("everything.h")]
   362         task = self.create_task('gen_everything_h', self.env)
   362         task = self.create_task('gen_everything_h', self.env)
   363         task.set_inputs(all_headers_inputs)
   363         task.set_inputs(all_headers_inputs)