(project_name, conf, source_path=None,
        boost_chrono=False)
Set up the package to use a shipped version of Boost.

    Return a tuple of a list of extra C files to build and extra
    defines to be used.

    :arg boost_chrono: one of *False* and ``"header_only"``
        (only relevant in shipped mode)
Set up the package to use a shipped version of Boost.
Set up the package to use a shipped version of Boost .
def set_up_shipped_boost_if_requested(project_name, conf, source_path=None,
        boost_chrono=False):
    """Set up the package to use a shipped version of Boost.

    Return a tuple of a list of extra C files to build and extra
    defines to be used.

    :arg boost_chrono: one of *False* and ``"header_only"``
        (only relevant in shipped mode)
    """
    from os.path import exists

    if source_path is None:
        source_path = "bpl-subset/bpl_subset"

    if conf["USE_SHIPPED_BOOST"]:
        if not exists("%s/boost/version.hpp" % source_path):
            print(DASH_SEPARATOR)
            print("The shipped Boost library was not found, but "
                    "USE_SHIPPED_BOOST is True.")
            print("(The files should be under %s/.)" % source_path)
            print(DASH_SEPARATOR)
            print("If you got this package from git, you probably want to do")
            print("")
            print(" $ git submodule update --init")
            print("")
            print("to fetch what you are presently missing. If you got this from")
            print("a distributed package on the net, that package is broken and")
            print("should be fixed. For now, I will turn off 'USE_SHIPPED_BOOST'")
            print("to try and see if the build succeeds that way, but in the long")
            print("run you might want to either get the missing bits or turn")
            print("'USE_SHIPPED_BOOST' off.")
            print(DASH_SEPARATOR)
            conf["USE_SHIPPED_BOOST"] = False

            count_down_delay(delay=10)

    if conf["USE_SHIPPED_BOOST"]:
        conf["BOOST_INC_DIR"] = [source_path]
        conf["BOOST_LIB_DIR"] = []
        conf["BOOST_PYTHON_LIBNAME"] = []
        conf["BOOST_THREAD_LIBNAME"] = []

        from glob import glob
        source_files = (glob(source_path + "/libs/*/*/*/*.cpp")
                + glob(source_path + "/libs/*/*/*.cpp")
                + glob(source_path + "/libs/*/*.cpp"))

        # make sure next line succeeds even on Windows
        source_files = [f.replace("\\", "/") for f in source_files]

        source_files = [f for f in source_files
                if not f.startswith(source_path + "/libs/thread/src")]

        if sys.platform == "win32":
            source_files += glob(
                    source_path + "/libs/thread/src/win32/*.cpp")
            source_files += glob(
                    source_path + "/libs/thread/src/tss_null.cpp")
        else:
            source_files += glob(
                    source_path + "/libs/thread/src/pthread/*.cpp")

        source_files = [f for f in source_files
                if not f.endswith("once_atomic.cpp")]

        from os.path import isdir
        main_boost_inc = source_path + "/boost"
        bpl_project_boost_inc = source_path + "/%sboost" % project_name

        if not isdir(bpl_project_boost_inc):
            try:
                from os import symlink
                symlink("boost", bpl_project_boost_inc)
            except (ImportError, OSError):
                from shutil import copytree
                print("Copying files, hang on... (do not interrupt)")
                copytree(main_boost_inc, bpl_project_boost_inc)

        defines = {
                # do not pick up libboost link dependency on windows
                "BOOST_ALL_NO_LIB": 1,
                "BOOST_THREAD_BUILD_DLL": 1,

                "BOOST_MULTI_INDEX_DISABLE_SERIALIZATION": 1,
                "BOOST_PYTHON_SOURCE": 1,
                "boost": '%sboost' % project_name,
                }

        if boost_chrono is False:
            defines["BOOST_THREAD_DONT_USE_CHRONO"] = 1
        elif boost_chrono == "header_only":
            defines["BOOST_CHRONO_HEADER_ONLY"] = 1
        else:
            raise ValueError("invalid value of 'boost_chrono'")

        return (source_files, defines)
    else:
        return [], {}
def set_up_shipped_boost_if_requested ( project_name , conf , source_path = None , boost_chrono = False ) : from os . path import exists if source_path is None : source_path = "bpl-subset/bpl_subset" if conf [ "USE_SHIPPED_BOOST" ] : if not exists ( "%s/boost/version.hpp" % source_path ) : print ( DASH_SEPARATOR ) print ( "The shipped Boost library was not found, but " "USE_SHIPPED_BOOST is True." ) print ( "(The files should be under %s/.)" % source_path ) print ( DASH_SEPARATOR ) print ( "If you got this package from git, you probably want to do" ) print ( "" ) print ( " $ git submodule update --init" ) print ( "" ) print ( "to fetch what you are presently missing. If you got this from" ) print ( "a distributed package on the net, that package is broken and" ) print ( "should be fixed. For now, I will turn off 'USE_SHIPPED_BOOST'" ) print ( "to try and see if the build succeeds that way, but in the long" ) print ( "run you might want to either get the missing bits or turn" ) print ( "'USE_SHIPPED_BOOST' off." ) print ( DASH_SEPARATOR ) conf [ "USE_SHIPPED_BOOST" ] = False count_down_delay ( delay = 10 ) if conf [ "USE_SHIPPED_BOOST" ] : conf [ "BOOST_INC_DIR" ] = [ source_path ] conf [ "BOOST_LIB_DIR" ] = [ ] conf [ "BOOST_PYTHON_LIBNAME" ] = [ ] conf [ "BOOST_THREAD_LIBNAME" ] = [ ] from glob import glob source_files = ( glob ( source_path + "/libs/*/*/*/*.cpp" ) + glob ( source_path + "/libs/*/*/*.cpp" ) + glob ( source_path + "/libs/*/*.cpp" ) ) # make sure next line succeeds even on Windows source_files = [ f . replace ( "\\" , "/" ) for f in source_files ] source_files = [ f for f in source_files if not f . startswith ( source_path + "/libs/thread/src" ) ] if sys . platform == "win32" : source_files += glob ( source_path + "/libs/thread/src/win32/*.cpp" ) source_files += glob ( source_path + "/libs/thread/src/tss_null.cpp" ) else : source_files += glob ( source_path + "/libs/thread/src/pthread/*.cpp" ) source_files = [ f for f in source_files if not f . endswith ( "once_atomic.cpp" ) ] from os . path import isdir main_boost_inc = source_path + "/boost" bpl_project_boost_inc = source_path + "/%sboost" % project_name if not isdir ( bpl_project_boost_inc ) : try : from os import symlink symlink ( "boost" , bpl_project_boost_inc ) except ( ImportError , OSError ) : from shutil import copytree print ( "Copying files, hang on... (do not interrupt)" ) copytree ( main_boost_inc , bpl_project_boost_inc ) defines = { # do not pick up libboost link dependency on windows "BOOST_ALL_NO_LIB" : 1 , "BOOST_THREAD_BUILD_DLL" : 1 , "BOOST_MULTI_INDEX_DISABLE_SERIALIZATION" : 1 , "BOOST_PYTHON_SOURCE" : 1 , "boost" : '%sboost' % project_name , } if boost_chrono is False : defines [ "BOOST_THREAD_DONT_USE_CHRONO" ] = 1 elif boost_chrono == "header_only" : defines [ "BOOST_CHRONO_HEADER_ONLY" ] = 1 else : raise ValueError ( "invalid value of 'boost_chrono'" ) return ( source_files , defines ) else : return [ ] , { }