Exemple #1
0
def check_qscintilla():
    """See if QScintilla can be found and what its version is.
    """
    # Find the QScintilla header files.
    sciglobal = os.path.join(opts.qsciincdir, "Qsci", "qsciglobal.h")

    if os.access(sciglobal, os.F_OK):
        # Get the QScintilla version string.
        _, sciversstr = sipconfig.read_version(sciglobal, "QScintilla",
                                               "QSCINTILLA_VERSION",
                                               "QSCINTILLA_VERSION_STR")

        if glob.glob(os.path.join(opts.qscilibdir, "*qscintilla2*")):
            # Because we include the Python bindings with the C++ code we can
            # reasonably force the same version to be used and not bother about
            # versioning.
            if sciversstr != "2.10.8":
                sipconfig.error(
                    "QScintilla %s is being used but the Python bindings 2.10.8 are being built.  Please use matching versions."
                    % sciversstr)

            sipconfig.inform("QScintilla %s is being used." % sciversstr)
        else:
            sipconfig.error(
                "The QScintilla library could not be found in %s. If QScintilla is installed then use the -o argument to explicitly specify the correct directory."
                % opts.qscilibdir)
    else:
        sipconfig.error(
            "Qsci/qsciglobal.h could not be found in %s. If QScintilla is installed then use the -n argument to explicitly specify the correct directory."
            % opts.qsciincdir)
Exemple #2
0
def inform_user():
    """Tell the user the option values that are going to be used.
    """
    sipconfig.inform("The PyQicsTable modules will be installed in %s." %
                     opt_pyqicstablemoddir)
    sipconfig.inform("The PyQicsTable .sip files will be installed in %s." %
                     opt_pyqicstablesipdir)
Exemple #3
0
def create_makefiles():
    """Create the additional Makefiles.
    """
    sipconfig.inform("Creating top level Makefile...")

    sipconfig.ParentMakefile(
        configuration=pyqtcfg, subdirs=["qmmp"], installs=("pyqmmpconfig.py", opt_pyqmmpmoddir)
    ).generate()
Exemple #4
0
def create_makefiles():
    """Create the additional Makefiles.
    """
    sipconfig.inform("Creating top level Makefile...")

    sipconfig.ParentMakefile(configuration=pyqtcfg,
                             subdirs=["qicstable"],
                             installs=("pyqicstableconfig.py",
                                       opt_pyqicstablemoddir)).generate()
Exemple #5
0
def manage_cache(gendir):
    """
    This function keeps a cache of all sip-generated *.cpp and *.h files
    and restores the stats of the newly generated set whenever the content
    is unchanged
    """
    sipconfig.inform("Managing the module cache: %s" % gendir)

    gendir = path(gendir)
    cache = gendir / 'cache'
    cache.ensure_exists()

    if 'clean' in sys.argv:
        cache.rmtree()

    changed_count = 0
    for newfile in gendir.files('*.cpp') + gendir.files('*.h'):
        oldfile = cache / newfile.name
        if different(newfile, oldfile):
            changed_count += 1
            shutil.copy2(newfile, oldfile)
            if VERBOSE:
                sipconfig.inform("--> changed: %s" % newfile.name)
        else:
            #sipconfig.inform("--> same:    %s" % newfile.name)
            shutil.copystat(oldfile, newfile)

    sipconfig.inform('%d file%s changed.' %
                     (changed_count, 's' if changed_count != 1 else ''))
Exemple #6
0
def manage_cache(gendir):
    """
    This function keeps a cache of all sip-generated *.cpp and *.h files
    and restores the stats of the newly generated set whenever the content
    is unchanged
    """
    sipconfig.inform("Managing the module cache: %s" % gendir)

    gendir = path(gendir)
    cache = gendir / 'cache'
    cache.ensure_exists()

    if 'clean' in sys.argv:
        cache.rmtree()

    changed_count = 0
    for newfile in gendir.files('*.cpp') + gendir.files('*.h'):
        oldfile = cache / newfile.name
        if different(newfile, oldfile):
            changed_count += 1
            shutil.copy2(newfile, oldfile)
            if VERBOSE:
                sipconfig.inform("--> changed: %s" % newfile.name)
        else:
            #sipconfig.inform("--> same:    %s" % newfile.name)
            shutil.copystat(oldfile, newfile)

    sipconfig.inform('%d file%s changed.' %
                     (changed_count, 's' if changed_count != 1 else ''))
Exemple #7
0
def check_qicstable():
    """See if QicsTable can be found and what its version is.
    """
    # Find the QicsTable header files.
    nspace = os.path.join(opt_qicstableincdir, "QicsNamespace.h")

    if os.access(nspace, os.F_OK):
        # Get the version number string.
        _, vstr = sipconfig.read_version(nspace, "QicsTable", None,
                                         "QICSTABLE_VERSION")

        # Extract the version number and hope that the format is consistent.
        try:
            vlist = string.split(vstr)
            maj, min, bug = string.split(vlist[1], ".")
            versnr = (int(maj) << 16) | (int(min) << 8) | int(bug)
            vstr = string.join(vlist[1:])
        except:
            raise ValueError, "Unable to extract version number from QICSTABLE_VERSION in QicsNamespace.h"

        if glob.glob(os.path.join(opt_qicstablelibdir, "*qicstable*")):
            global qicstable_version
            qicstable_version = versnr

            sipconfig.inform("QicsTable %s is being used." % vstr)
        else:
            sipconfig.inform(
                "The QicsTable library could not be found in %s and so the qicstable module will not be built. If QicsTable is installed then use the -o argument to explicitly specify the correct directory."
                % opt_qicstablelibdir)
    else:
        sipconfig.inform(
            "QicsNamespace.h could not be found in %s and so the qicstable module will not be built. If QicsTable is installed then use the -n argument to explicitly specify the correct directory."
            % opt_qicstableincdir)
Exemple #8
0
def create_config(module, template):
    """Create the PyQMMP configuration module so that it can be imported
    by build scripts.

    module is the module file name.
    template is the template file name.
    """
    sipconfig.inform("Creating %s..." % module)

    content = {
        "pyqmmp_version": pyqmmp_version,
        "pyqmmp_version_str": pyqmmp_version_str,
        "pyqmmp_mod_dir": opt_pyqmmpmoddir,
        "pyqmmp_sip_dir": opt_pyqmmpsipdir,
        "pyqmmp_qmmp_sip_flags": qmmp_sip_flags,
        # These are internal.
        "_pyqmmp_defines": qmmp_define,
        "_pyqmmp_inc_dir": opt_qmmpincdir,
        "_pyqmmp_lib_dir": opt_qmmplibdir,
    }

    sipconfig.create_config_module(module, template, content)
def check_qscintilla():
    """See if QScintilla can be found and what its version is.
    """
    # Find the QScintilla header files.
    sciglobal = os.path.join(opts.qsciincdir, "Qsci", "qsciglobal.h")

    if os.access(sciglobal, os.F_OK):
        # Get the QScintilla version string.
        _, sciversstr = sipconfig.read_version(sciglobal, "QScintilla", "QSCINTILLA_VERSION", "QSCINTILLA_VERSION_STR")

        if glob.glob(os.path.join(opts.qscilibdir, "*qscintilla2*")):
            # Because we include the Python bindings with the C++ code we can
            # reasonably force the same version to be used and not bother about
            # versioning.
            if sciversstr != "2.9.1":
                sipconfig.error("QScintilla %s is being used but the Python bindings 2.9.1 are being built.  Please use matching versions." % sciversstr)

            sipconfig.inform("QScintilla %s is being used." % sciversstr)
        else:
            sipconfig.error("The QScintilla library could not be found in %s. If QScintilla is installed then use the -o argument to explicitly specify the correct directory." % opts.qscilibdir)
    else:
        sipconfig.error("Qsci/qsciglobal.h could not be found in %s. If QScintilla is installed then use the -n argument to explicitly specify the correct directory." % opts.qsciincdir)
Exemple #10
0
def create_config(module, template):
    """Create the PyQicsTable configuration module so that it can be imported
    by build scripts.

    module is the module file name.
    template is the template file name.
    """
    sipconfig.inform("Creating %s..." % module)

    content = {
        "pyqicstable_version": pyqicstable_version,
        "pyqicstable_version_str": pyqicstable_version_str,
        "pyqicstable_mod_dir": opt_pyqicstablemoddir,
        "pyqicstable_sip_dir": opt_pyqicstablesipdir,
        "pyqicstable_qicstable_sip_flags": qicstable_sip_flags,

        # These are internal.
        "_pyqicstable_defines": qicstable_define,
        "_pyqicstable_inc_dir": opt_qicstableincdir,
        "_pyqicstable_lib_dir": opt_qicstablelibdir
    }

    sipconfig.create_config_module(module, template, content)
Exemple #11
0
    def generate_code(self, config):
        sip_install_dir = os.path.join(config.default_sip_dir, "skia")
        module_install_dir = os.path.join(config.default_mod_dir, "skia")

        for module in self.MODULES:
            # Calculate SIP module folder and scan for .sip files
            module_dir = os.path.join(self.SIP_DIR, module)

            sipconfig.inform("Processing {}...".format(module_dir))

            # Calculate module paths
            sip_file = os.path.join(module_dir, "{}.sip".format(module))
            build_dir = os.path.join(self.BUILD_DIR, module)
            build_file = os.path.join(build_dir, "{}.sbf".format(module))

            # Creating paths
            if not os.path.exists(build_dir):
                os.makedirs(build_dir)

            # Execute 'sip' command
            cmd = [
                config.sip_bin,
                "-c", build_dir,
                "-b", build_file,
                sip_file
            ]

            if subprocess.call(cmd):
                sipconfig.error(sip_file)
                sys.exit(1)

            # Generate module Makefile
            sipconfig.inform("Generating Makefile for '{}'...".format(module))

            makefile = sipconfig.SIPModuleMakefile(
                config,
                build_file,
                dir=build_dir,
                install_dir=module_install_dir,
                installs=[(sip_file, os.path.join(sip_install_dir, module))],
                makefile=os.path.join(build_dir, "Makefile")
            )

            makefile.extra_lib_dirs = [config.skia_libs_dir]
            makefile.extra_include_dirs = config.skia_includes
            makefile.extra_libs = config.skia_libs
            makefile.extra_lflags = ["-framework ApplicationServices"]

            makefile.generate()

        # Generate parent Makefile
        sipconfig.inform("Generating main Makefile...")
        sipconfig.ParentMakefile(
            configuration=config,
            subdirs=[os.path.join(self.BUILD_DIR, m) for m in self.MODULES],
            installs=[(f, config.skia_mod_dir) for f in self.package_installs],
        ).generate()
Exemple #12
0
def create_makefiles(macros):
    """Create the Makefiles.

    macros is the dictionary of platform specific build macros.
    """
    # Bootstrap.  Make sure we get the right one.
    sys.path.insert(0, os.path.curdir)
    invalidate_caches()
    import sipconfig

    cfg = sipconfig.Configuration()

    cfg.set_build_macros(macros)

    sipconfig.inform("Creating top level Makefile...")

    sipconfig.ParentMakefile(
        configuration=cfg,
        subdirs=["sipgen", "siplib"],
        installs=(["sipconfig.py", os.path.join(src_dir, "sipdistutils.py")],
                cfg.sip_mod_dir)
    ).generate()

    sipconfig.inform("Creating sip code generator Makefile...")

    sipconfig.ProgramMakefile(
        configuration=cfg,
        build_file=os.path.join(src_dir, "sipgen", "sipgen.sbf"),
        dir="sipgen",
        install_dir=os.path.dirname(cfg.sip_bin),
        console=1,
        warnings=0,
        universal=opts.universal,
        arch=opts.arch,
        deployment_target=opts.deployment_target
    ).generate()

    sipconfig.inform("Creating sip module Makefile...")

    makefile = sipconfig.ModuleMakefile(
        configuration=cfg,
        build_file=os.path.join(src_dir, "siplib", "siplib.sbf"),
        dir="siplib",
        install_dir=cfg.sip_mod_dir,
        installs=([os.path.join(src_dir, "siplib", "sip.h")], cfg.sip_inc_dir),
        console=1,
        warnings=0,
        static=opts.static,
        debug=opts.debug,
        universal=opts.universal,
        arch=opts.arch,
        deployment_target=opts.deployment_target
    )

    makefile.generate()
Exemple #13
0
def create_makefiles(macros):
    """Create the Makefiles.

    macros is the dictionary of platform specific build macros.
    """
    # Bootstrap.
    import sipconfig

    cfg = sipconfig.Configuration()

    cfg.set_build_macros(macros)

    sipconfig.inform("Creating top level Makefile...")

    sipconfig.ParentMakefile(
        configuration=cfg,
        subdirs=["sipgen", "siplib"],
        installs=(["sipconfig.py", "sipdistutils.py"], cfg.sip_mod_dir)
    ).generate()

    sipconfig.inform("Creating sip code generator Makefile...")

    sipconfig.ProgramMakefile(
        configuration=cfg,
        build_file="sipgen.sbf",
        dir="sipgen",
        install_dir=os.path.dirname(cfg.sip_bin),
        console=1,
        warnings=0,
        universal=opts.universal
    ).generate()

    sipconfig.inform("Creating sip module Makefile...")

    makefile = sipconfig.ModuleMakefile(
        configuration=cfg,
        build_file="siplib.sbf",
        dir="siplib",
        install_dir=cfg.sip_mod_dir,
        installs=(["sip.h"], cfg.sip_inc_dir),
        console=1,
        warnings=0,
        static=opts.static,
        debug=opts.debug,
        universal=opts.universal
    )

    makefile.generate()
Exemple #14
0
def main(argv):
    global pyqt_modroot
    pyqt_modroot = os.path.join(pyqt_modroot, "pyvoip")
    installs = [([join('sip', '__init__.py')], pyqt_modroot)]
    debug = False
    build_dirs = []

    try:
        opts, args = getopt.getopt(argv, "d")
    except getopt.GetoptError:
        print(
            "Usage: 'configure.py -d' to build debug version, otherwise ommit this flag."
        )
        sys.exit(2)

    if opts:
        for opt, arg in opts:
            if opt == "-d":
                sipconfig.inform("Building debug libraries...")
                debug = True

    if not debug:
        sipconfig.inform("Building libraries...")

    for module in pyqt_modules:
        mname = module if not debug else mname + "d"
        build_dirs.append(
            generate_code(module,
                          libs=needed_qt_libs(mname),
                          lib_dirs=lib_dirs(module),
                          include_dirs=include_dirs(module),
                          debug=debug))

    # Create the additional Makefiles.
    sipconfig.inform("Creating top level Makefile...")

    sipconfig.ParentMakefile(configuration=pyqtcfg,
                             subdirs=build_dirs,
                             installs=installs).generate()
Exemple #15
0
def manage_cache(gendir, show_diffs = True):
    """
    This function keeps a cache of all sip-generated *.cpp and *.h files
    and restores the stats of the newly generated set whenever the content
    is unchanged
    """
    sipconfig.inform("Managing the module cache: %s" % gendir)

    gendir = path(gendir)
    cache = gendir / 'cache'
    if not cache.isdir():
        cache.makedirs()

    if 'clean' in sys.argv:
        cache.rmtree()

    changed_count = 0
    for newfile in gendir.files('*.cpp') + gendir.files('*.h'):
        oldfile = cache / newfile.name
        if different(newfile, oldfile):
            changed_count += 1

            if oldfile.isfile():
                assert newfile.mtime > oldfile.mtime


            shutil.copy2(newfile, oldfile) # src, dest
            a, b = newfile.stat().st_mtime, oldfile.stat().st_mtime
            #assert a == b, "copy2 failed: mtimes are different! (%s and %s)" % (a, b)

            sipconfig.inform("--> changed: %s" % newfile.name)
        else:
            #sipconfig.inform("--> same:    %s" % newfile.name)
            shutil.copystat(oldfile, newfile)

    sipconfig.inform('%d file%s changed.' %
                     (changed_count, 's' if changed_count != 1 else ''))

    sys.stdout.flush()
Exemple #16
0
def main(argv):
    global pyqt_modroot
    pyqt_modroot = os.path.join(pyqt_modroot, "pyvoip")
    installs = [([join("sip", "__init__.py")], pyqt_modroot)]
    debug = False
    build_dirs = []

    try:
        opts, args = getopt.getopt(argv, "d")
    except getopt.GetoptError:
        print("Usage: 'configure.py -d' to build debug version, otherwise ommit this flag.")
        sys.exit(2)

    if opts:
        for opt, arg in opts:
            if opt == "-d":
                sipconfig.inform("Building debug libraries...")
                debug = True

    if not debug:
        sipconfig.inform("Building libraries...")

    for module in pyqt_modules:
        mname = module if not debug else mname + "d"
        build_dirs.append(
            generate_code(
                module,
                libs=needed_qt_libs(mname),
                lib_dirs=lib_dirs(module),
                include_dirs=include_dirs(module),
                debug=debug,
            )
        )

    # Create the additional Makefiles.
    sipconfig.inform("Creating top level Makefile...")

    sipconfig.ParentMakefile(configuration=pyqtcfg, subdirs=build_dirs, installs=installs).generate()
Exemple #17
0
def manage_cache(gendir, show_diffs=True):
    """
    This function keeps a cache of all sip-generated *.cpp and *.h files
    and restores the stats of the newly generated set whenever the content
    is unchanged
    """
    sipconfig.inform("Managing the module cache: %s" % gendir)

    gendir = path(gendir)
    cache = gendir / 'cache'
    if not cache.isdir():
        cache.makedirs()

    if 'clean' in sys.argv:
        cache.rmtree()

    changed_count = 0
    for newfile in gendir.files('*.cpp') + gendir.files('*.h'):
        oldfile = cache / newfile.name
        if different(newfile, oldfile):
            changed_count += 1

            if oldfile.isfile():
                assert newfile.mtime > oldfile.mtime

            shutil.copy2(newfile, oldfile)  # src, dest
            a, b = newfile.stat().st_mtime, oldfile.stat().st_mtime
            #assert a == b, "copy2 failed: mtimes are different! (%s and %s)" % (a, b)

            sipconfig.inform("--> changed: %s" % newfile.name)
        else:
            #sipconfig.inform("--> same:    %s" % newfile.name)
            shutil.copystat(oldfile, newfile)

    sipconfig.inform('%d file%s changed.' %
                     (changed_count, 's' if changed_count != 1 else ''))

    sys.stdout.flush()
Exemple #18
0
def create_makefiles(macros):
    """Create the Makefiles.

    macros is the dictionary of platform specific build macros.
    """
    # Bootstrap.  Make sure we get the right one.
    sys.path.insert(0, os.path.curdir)
    invalidate_caches()
    import sipconfig

    cfg = sipconfig.Configuration()

    cfg.set_build_macros(macros)

    all_installs = []
    top_installs = []
    gen_installs = []
    subdirs = []

    if not opts.no_tools:
        subdirs.append('sipgen')
        top_installs.append(
            (["sipconfig.py",
              os.path.join(src_dir, "sipdistutils.py")], cfg.sip_root_dir))
        gen_installs.append((os.path.join(src_dir, "siplib",
                                          "sip.h"), cfg.sip_inc_dir))

    if not opts.no_module:
        subdirs.append('siplib')

    all_installs.extend(top_installs)
    all_installs.extend(gen_installs)

    # The command to run to generate the dist-info directory.
    mk_distinfo = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                               'mk_distinfo.py')
    distinfo_dir = os.path.join(
        cfg.sip_module_dir, '%s-%s.dist-info' %
        (sip_module_name.replace('.', '_'), sip_version_str))

    if opts.use_qmake:
        run_mk_distinfo = '%s %s \\\"$(INSTALL_ROOT)\\\" %s installed.txt' % (
            sys.executable, mk_distinfo, distinfo_dir)

        sipconfig.inform("Creating top level .pro file...")

        pro = open("sip.pro", "w")

        pro.write("TEMPLATE = subdirs\n")
        pro.write("SUBDIRS = %s\n" % " ".join(subdirs))

        if top_installs:
            # There will only be one element.
            files, path = top_installs[0]
            pro.write("\n")
            pro.write("build_system.files = %s\n" % " ".join(files))
            pro.write("build_system.path = %s\n" % quote(path))
            pro.write("INSTALLS += build_system\n")

        if opts.distinfo:
            pro.write("\n")
            pro.write("distinfo.extra = %s\n" % run_mk_distinfo)
            pro.write("distinfo.path = %s\n" % quote(cfg.sip_module_dir))
            pro.write("INSTALLS += distinfo\n")

        pro.close()
    else:
        run_mk_distinfo = '%s %s "$(DESTDIR)" %s installed.txt' % (
            sys.executable, mk_distinfo, distinfo_dir)

        sipconfig.inform("Creating top level Makefile...")

        # Note that mk_distinfo.py won't exist if we are building from the
        # repository.
        if opts.distinfo and os.path.isfile(mk_distinfo):
            top_installs.append((run_mk_distinfo, None))

        sipconfig.ParentMakefile(configuration=cfg,
                                 subdirs=subdirs,
                                 installs=top_installs).generate()

    if opts.use_qmake:
        sipconfig.inform("Creating sip code generator .pro file...")

        pro = open(os.path.join("sipgen", "sipgen.pro"), "w")

        pro.write("TEMPLATE = app\n")
        pro.write("TARGET = sip\n")
        pro.write("CONFIG -= qt app_bundle\n")
        pro.write("CONFIG += warn_on exceptions_off console %s\n" %
                  (("debug" if opts.debug else "release")))

        pro.write("\n")
        pro.write("# Work around QTBUG-39300.\n")
        pro.write("CONFIG -= android_install\n")

        pro.write("\n")
        pro.write("target.path = %s\n" % os.path.dirname(cfg.sip_bin))
        pro.write("INSTALLS += target\n")

        c_sources = get_sources("sipgen", "*.c")
        pro.write("\n")
        pro.write("SOURCES = %s\n" %
                  " ".join([qmake_quote(s) for s in c_sources]))

        headers = get_sources("sipgen", "*.h")
        pro.write("\n")
        pro.write("HEADERS = %s\n" %
                  " ".join([qmake_quote(h) for h in headers]))

        if gen_installs:
            # There will only be one element.
            files, path = gen_installs[0]
            pro.write("\n")
            pro.write("sip_h.files = %s\n" % " ".join(files))
            pro.write("sip_h.path = %s\n" % quote(path))
            pro.write("INSTALLS += sip_h\n")

        pro.close()
    else:
        sipconfig.inform("Creating sip code generator Makefile...")

        sipconfig.ProgramMakefile(
            configuration=cfg,
            build_file=os.path.join(src_dir, "sipgen", "sipgen.sbf"),
            dir="sipgen",
            install_dir=os.path.dirname(cfg.sip_bin),
            installs=gen_installs,
            console=1,
            warnings=1,
            universal=opts.universal,
            arch=opts.arch,
            deployment_target=opts.deployment_target).generate()

    # The implied code generator installs.
    if not opts.no_tools:
        sip_dir, sip_exe = os.path.split(cfg.sip_bin)
        if sys.platform == 'win32':
            sip_exe += '.exe'

        all_installs.append((sip_exe, sip_dir))

    # The module installs.
    module_installs = []

    if opts.pyi:
        module_installs.append((os.path.join(src_dir, 'sip.pyi'), pyi_dir))

    all_installs.extend(module_installs)

    if not opts.no_module:
        if sys.platform == 'win32':
            mod = 'sip.lib' if opts.static else 'sip.pyd'
        else:
            mod = 'libsip.a' if opts.static else 'sip.so'

        all_installs.append((mod, sip_module_dest_dir))

    if opts.use_qmake:
        sipconfig.inform("Creating sip module .pro file...")

        pro = open(os.path.join("siplib", "siplib.pro"), "w")

        pro.write("TEMPLATE = lib\n")
        pro.write("TARGET = sip\n")
        pro.write("CONFIG -= qt\n")
        pro.write("CONFIG += warn_on exceptions_off %s %s\n" %
                  (("staticlib" if opts.static else "plugin plugin_bundle"),
                   ("debug" if opts.debug else "release")))

        pro.write("\n")
        pro.write("# Work around QTBUG-39300.\n")
        pro.write("CONFIG -= android_install\n")

        pro.write("\n")
        pro.write("INCLUDEPATH += %s\n" % cfg.py_inc_dir)
        if cfg.py_conf_inc_dir != cfg.py_inc_dir:
            pro.write("INCLUDEPATH += %s\n" % cfg.py_conf_inc_dir)

        if sip_module_name != 'sip':
            pro.write("\n")
            pro.write('DEFINES += SIP_MODULE_NAME=%s\n' % sip_module_name)

            base_name = sip_module_name.split('.')[-1]
            if base_name != 'sip':
                pro.write('DEFINES += SIP_MODULE_BASENAME=%s\n' % base_name)

        if not opts.static:
            # These only need to be correct for Windows.
            debug_suffix = "_d" if opts.debug else ""
            link_lib_dir = quote("-L" + cfg.py_lib_dir)

            pro.write("""
win32 {
    PY_MODULE = sip%s.pyd
    PY_MODULE_SRC = $(DESTDIR_TARGET)

    LIBS += %s
} else {
    PY_MODULE = sip.so

    macx {
        PY_MODULE_SRC = $(TARGET).plugin/Contents/MacOS/$(TARGET)

        QMAKE_LFLAGS += "-undefined dynamic_lookup"
    } else {
        PY_MODULE_SRC = $(TARGET)
    }
}

QMAKE_POST_LINK = $(COPY_FILE) $$PY_MODULE_SRC $$PY_MODULE

target.CONFIG = no_check_exist
target.files = $$PY_MODULE
""" % (debug_suffix, link_lib_dir))

        pro.write("\n")
        pro.write("target.path = %s\n" % sip_module_dest_dir)
        pro.write("INSTALLS += target\n")

        if opts.pyi:
            pro.write("\n")
            pro.write("sip_pyi.files = sip.pyi\n")
            pro.write("sip_pyi.path = %s\n" % pyi_dir)
            pro.write("INSTALLS += sip_pyi\n")

        c_sources = get_sources("siplib", "*.c")
        cpp_sources = get_sources("siplib", "*.cpp")
        pro.write("\n")
        pro.write("SOURCES = %s\n" %
                  " ".join([qmake_quote(s) for s in c_sources + cpp_sources]))

        headers = get_sources("siplib", "*.h")
        pro.write("\n")
        pro.write("HEADERS = %s\n" %
                  " ".join([qmake_quote(h) for h in headers]))

        pro.close()
    else:
        sipconfig.inform("Creating sip module Makefile...")

        build_dir = os.getcwd()

        makefile = sipconfig.ModuleMakefile(
            configuration=cfg,
            build_file=os.path.join(src_dir, "siplib", "siplib.sbf"),
            dir="siplib",
            install_dir=sip_module_dest_dir,
            installs=module_installs,
            console=1,
            warnings=1,
            static=opts.static,
            debug=opts.debug,
            universal=opts.universal,
            arch=opts.arch,
            deployment_target=opts.deployment_target)

        if sip_module_name != 'sip':
            makefile.DEFINES.append('SIP_MODULE_NAME=%s' % sip_module_name)

            base_name = sip_module_name.split('.')[-1]
            if base_name != 'sip':
                makefile.DEFINES.append('SIP_MODULE_BASENAME=%s' % base_name)

        if src_dir != build_dir:
            src_siplib_dir = os.path.join(src_dir, "siplib")
            makefile.extra_include_dirs.append(src_siplib_dir)
            makefile.extra_source_dirs.append(src_siplib_dir)

        makefile.generate()

    # Create the file containing all installed files.
    if opts.distinfo:
        installed = open('installed.txt', 'w')

        for sources, dst in all_installs:
            if not isinstance(sources, (list, tuple)):
                sources = [sources]

            for src in sources:
                installed.write(
                    os.path.join(dst, os.path.basename(src)) + '\n')

        installed.close()
Exemple #19
0
def generate_code(mname,
                  include_dirs=None,
                  lib_dirs=None,
                  libs=None,
                  extra_sip_flags=None,
                  debug=0):
    """Generate the code for a module.

    mname is the name of the module to generate the code for.
    extra_include_dirs is an optional list of additional directories to add to
    the list of include directories.
    extra_lib_dirs is an optional list of additional directories to add to the
    list of library directories.
    extra_libs is an optional list of additional libraries to add to the list
    of libraries.
    extra_sip_flags is an optional list of additional flags to pass to SIP.
    """
    sipconfig.inform("Generating the C++ source for the %s module..." % mname)
    modfile = mname + "mod.sip"
    builddir = abspath(
        join("build", mname, "release" if not debug else "debug"))

    #sanity check - avoid cleaning a directory full of .sip files!
    if exists(join(builddir, modfile)):
        raise RuntimeError(
            "SIP module target {} exists in build directory {}, aborting!".
            format(modfile, builddir))

    #clean the build directory
    mk_clean_dir(builddir)

    # Build the SIP command line.
    argv = ['"' + pyqtcfg.sip_bin + '"']

    argv.append(qt_sip_flags)

    if extra_sip_flags:
        argv.extend(extra_sip_flags)

    #enable debugging statements within sip
    if debug:
        argv.append("-r")

    # the directory where our cpp files are placed
    argv.append("-c")
    argv.append(builddir)

    buildfile = join(builddir, mname + ".sbf")
    argv.append("-b")
    argv.append(buildfile)

    argv.append("-I")
    argv.append(pyqtcfg.pyqt_sip_dir)

    argv.append("-I")
    argv.append(join(os.getcwdu(), mname))

    # SIP assumes POSIX style path separators.
    argv.append(abspath(join(mname, modfile)))

    cmd = " ".join(argv)
    sys.stdout.write(cmd + "\n")

    #call sip.exe to generate our C++ code
    os.system(cmd)

    # Check the result.
    if not os.access(buildfile, os.F_OK):
        sipconfig.error("Unable to create the C++ code.")

    # Generate the Makefile.
    sipconfig.inform("Creating the Makefile for the %s module..." % mname)

    makefile = sipconfig.SIPModuleMakefile(configuration=pyqtcfg,
                                           build_file=buildfile,
                                           dir=builddir,
                                           install_dir=pyqt_modroot,
                                           qt=True,
                                           universal=pyqtcfg.universal,
                                           arch=pyqtcfg.arch,
                                           debug=debug,
                                           export_all=True,
                                           prot_is_public=False,
                                           threaded=True)

    add_makefile_extras(makefile, include_dirs, lib_dirs, libs)
    makefile.extra_cxxflags.append('-EHsc')
    makefile.extra_cflags.append("-Zi")
    makefile.extra_cxxflags.append("-Zi")
    makefile.extra_lflags.append("/DEBUG")
    makefile.extra_lflags.append("/PDB:{}.pdb".format(mname))

    makefile.generate()
    return builddir
Exemple #20
0
def inform_user():
    """Tell the user the option values that are going to be used.
    """
    sipconfig.inform("PyQt %s is being used." % pyqt.pyqt_version_str)
    sipconfig.inform("Qt v%s %s edition is being used." % (sipconfig.version_to_string(pyqt.qt_version), pyqt.qt_edition))
    sipconfig.inform("SIP %s is being used." % pyqt.sip_version_str)

    sipconfig.inform("The Fresh module will be installed in %s." % opts.freshmoddir)
    sipconfig.inform("The Fresh API file will be installed in %s." % os.path.join(opts.freshdir, "api", "python"))
    sipconfig.inform("The Fresh .sip files will be installed in %s." % opts.freshsipdir)

    if opts.no_docstrings:
        sipconfig.inform("The Fresh module is being built without generated docstrings.")
    else:
        sipconfig.inform("The Fresh module is being built with generated docstrings.")
Exemple #21
0
def generate_code():
    """Generate the code for the Fresh module.
    """
    mname = "fresh"
    
    sipconfig.inform("Generating the C++ source for the %s module..." % mname)

    # Build the SIP command line.
    argv = ['"' + pyqt.sip_bin + '"']

    argv.extend(sip_flags())

    if not opts.no_docstrings:
        argv.append("-o");

    if opts.concat:
        argv.append("-j")
        argv.append(str(opts.split))

    if opts.tracing:
        argv.append("-r")

    argv.append("-c")
    argv.append(".")

    buildfile = os.path.join("fresh.sbf")
    argv.append("-b")
    argv.append(buildfile)

    if pyqt.pyqt_version >= 0x040000:
        argv.append("../Python/sip/fresh.sip")
    
    os.system(" ".join(argv))

    # Check the result.
    if not os.access(buildfile, os.F_OK):
        sipconfig.error("Unable to create the C++ code.")

    # Generate the Makefile.
    sipconfig.inform("Creating the Makefile for the %s module..." % mname)

    def fix_install(mfile):
        if sys.platform != "darwin" or opts.static:
            return

        mfile.write("\tinstall_name_tool -change libqscintilla2.%u.dylib %s/libqscintilla2.%u.dylib $(DESTDIR)%s/$(TARGET)\n" % (FRESH_API_MAJOR, opts.freshlibdir, FRESH_API_MAJOR, opts.freshmoddir))

    if pyqt.pyqt_version >= 0x040000:
        class Makefile(pyqt4.QtGuiModuleMakefile):
            def generate_target_install(self, mfile):
                pyqt4.QtGuiModuleMakefile.generate_target_install(self, mfile)
                fix_install(mfile)
    else:
        class Makefile(pyqt3.QtModuleMakefile):
            def generate_target_install(self, mfile):
                pyqt3.QtModuleMakefile.generate_target_install(self, mfile)
                fix_install(mfile)

    installs = []
    sipfiles = []

    for s in glob.glob("sip/*.sip"):
        sipfiles.append(os.path.join("sip", os.path.basename(s)))

    installs.append([sipfiles, os.path.join(opts.freshsipdir, mname)])

    installs.append(("fresh.api", os.path.join(opts.freshdir, "api", "python")))

    makefile = Makefile(
        configuration=pyqt,
        build_file="fresh.sbf",
        install_dir=opts.freshmoddir,
        installs=installs,
        static=opts.static,
        debug=opts.debug,
        universal=pyqt.universal)
    
    if fresh_define:
        makefile.extra_defines.append(fresh_define)
    makefile.extra_include_dirs.append('..')
    makefile.extra_include_dirs.append(opts.freshincdir)
    makefile.extra_lib_dirs.append(opts.freshlibdir)
    makefile.extra_lib_dirs.append('../build')
    makefile.extra_libs.append("cppfresh")

    makefile.generate()
Exemple #22
0
def generate_code(mname, include_dirs=None, lib_dirs=None, libs=None, extra_sip_flags=None, debug=0):
    """Generate the code for a module.

    mname is the name of the module to generate the code for.
    extra_include_dirs is an optional list of additional directories to add to
    the list of include directories.
    extra_lib_dirs is an optional list of additional directories to add to the
    list of library directories.
    extra_libs is an optional list of additional libraries to add to the list
    of libraries.
    extra_sip_flags is an optional list of additional flags to pass to SIP.
    """
    sipconfig.inform("Generating the C++ source for the %s module..." % mname)
    modfile = mname + "mod.sip"
    builddir = abspath(join("build", mname, "release" if not debug else "debug"))

    # sanity check - avoid cleaning a directory full of .sip files!
    if exists(join(builddir, modfile)):
        raise RuntimeError("SIP module target {} exists in build directory {}, aborting!".format(modfile, builddir))

    # clean the build directory
    mk_clean_dir(builddir)

    # Build the SIP command line.
    argv = ['"' + pyqtcfg.sip_bin + '"']

    argv.append(qt_sip_flags)

    if extra_sip_flags:
        argv.extend(extra_sip_flags)

    # enable debugging statements within sip
    if debug:
        argv.append("-r")

    # the directory where our cpp files are placed
    argv.append("-c")
    argv.append(builddir)

    buildfile = join(builddir, mname + ".sbf")
    argv.append("-b")
    argv.append(buildfile)

    argv.append("-I")
    argv.append(pyqtcfg.pyqt_sip_dir)

    argv.append("-I")
    argv.append(join(os.getcwdu(), mname))

    # SIP assumes POSIX style path separators.
    argv.append(abspath(join(mname, modfile)))

    cmd = " ".join(argv)
    sys.stdout.write(cmd + "\n")

    # call sip.exe to generate our C++ code
    os.system(cmd)

    # Check the result.
    if not os.access(buildfile, os.F_OK):
        sipconfig.error("Unable to create the C++ code.")

    # Generate the Makefile.
    sipconfig.inform("Creating the Makefile for the %s module..." % mname)

    makefile = sipconfig.SIPModuleMakefile(
        configuration=pyqtcfg,
        build_file=buildfile,
        dir=builddir,
        install_dir=pyqt_modroot,
        qt=True,
        universal=pyqtcfg.universal,
        arch=pyqtcfg.arch,
        debug=debug,
        export_all=True,
        prot_is_public=False,
        threaded=True,
    )

    add_makefile_extras(makefile, include_dirs, lib_dirs, libs)
    makefile.extra_cxxflags.append("-EHsc")
    makefile.extra_cflags.append("-Zi")
    makefile.extra_cxxflags.append("-Zi")
    makefile.extra_lflags.append("/DEBUG")
    makefile.extra_lflags.append("/PDB:{}.pdb".format(mname))

    makefile.generate()
    return builddir
Exemple #23
0
	return params

def build_file():
	return os.path.join(options.build_path, "%s.sbf" % options.module_name)

def parse_options():
	from optparse import OptionParser

	parser = OptionParser()
	parser.add_option("", "--module-name", dest="module_name", help="the python module name of the lib")
	parser.add_option("", "--sip-file", dest="sip_file", help="the sip file of the lib")
	parser.add_option("", "--lib", dest="lib", help="the name without extension of the lib")
	parser.add_option("", "--lib-path", dest="lib_path", help="the path where the lib dynamic library can be found")
	parser.add_option("", "--include-path", dest="include_path", help="the path where the lib headers can be found")
	parser.add_option("", "--build-path", dest="build_path", help="the path where the Makefile can be found")
	options, args = parser.parse_args()

	return options

options = None

if __name__ == '__main__':
	options = parse_options()

	config = pyqtconfig.Configuration()
	sipconfig.inform("Generating bindings")
	run_sip(config)
	sipconfig.inform("Generating Makefile")
	generate_makefile(config)
	sipconfig.inform("Makefile generated. Run \"nmake\" now.")
Exemple #24
0
# configure.py
# Copyright 2011 Demetrius Cassidy
import os
import sys
import shutil
import sipconfig
import getopt

from os.path import abspath, exists, join, normpath

try:
    from PyQt4 import pyqtconfig
    has_pyqt = True
except:
    pyqtconfig = sipconfig
    sipconfig.inform("PyQt4 is not available, Qt support is disabled.")
    has_pyqt = False

sip_min_version = 0x040900

qt_version = 0
qt_edition = ""
qt_licensee = None
qt_dir = None
qt_incdir = None
qt_libdir = None
qt_bindir = None
qt_datadir = None
qt_pluginsdir = None
qt_xfeatures = None
qt_shared = ""
Exemple #25
0
def check_license():
    """Handle the validation of the PyQMMP license.
    """
    try:
        import license

        ltype = license.LicenseType
        lname = license.LicenseName

        try:
            lfile = license.LicenseFile
        except AttributeError:
            lfile = None
    except ImportError:
        ltype = None

    if ltype is None:
        ltype = "GPL"
        lname = "GNU General Public License"
        lfile = None

    sipconfig.inform(
        "This is the %s version of PyQMMP %s (licensed under the %s) for Python %s on %s."
        % (ltype, pyqmmp_version_str, lname, string.split(sys.version)[0], sys.platform)
    )

    # Common checks.
    if ltype == "GPL" and sys.platform == "win32":
        error("You cannot use the GPL version of PyQMMP under Windows.")

    try:
        qted = pyqtcfg.qt_edition
    except AttributeError:
        qted = None

    if qted:
        if (qted == "free" and ltype != "GPL") or (qted != "free" and ltype == "GPL"):
            sipconfig.error("This version of PyQMMP and the %s edition of Qt have incompatible licenses." % qted)

    # Confirm the license.
    print
    print "Type 'L' to view the license."
    print "Type 'yes' to accept the terms of the license."
    print "Type 'no' to decline the terms of the license."
    print

    while 1:
        try:
            resp = raw_input("Do you accept the terms of the license? ")
        except:
            resp = ""

        resp = string.lower(string.strip(resp))

        if resp == "yes":
            break

        if resp == "no":
            sys.exit(0)

        if resp == "l":
            os.system("more LICENSE")

    # If there should be a license file then check it is where it should be.
    if lfile:
        if os.access(os.path.join("sip", lfile), os.F_OK):
            sipconfig.inform("Found the license file %s." % lfile)
        else:
            sipconfig.error("Please copy the license file %s to the sip directory." % lfile)
Exemple #26
0
def generate_code(
    mname,
    imports=None,
    extra_cflags=None,
    extra_cxxflags="-I%s/Qt3Support/ -I%s/QtXml/ -I%s/QtGui/ -I%s -I../../ -L../../"
    % (pyqtcfg.qt_inc_dir, pyqtcfg.qt_inc_dir, pyqtcfg.qt_inc_dir, pyqtcfg.qt_inc_dir),
    extra_define=None,
    extra_include_dir=None,
    extra_lflags="-lQt3Support",
    extra_lib_dir=None,
    extra_lib=None,
    sip_flags=None,
):
    """Generate the code for a module.

    mname is the name of the module.
    imports is the list of PyQt modules that this one %Imports.
    extra_cflags is a string containing additional C compiler flags.
    extra_cxxflags is a string containing additional C++ compiler flags.
    extra_define is a name to add to the list of preprocessor defines.
    extra_include_dir is the name of a directory to add to the list of include
    directories.
    extra_lflags is a string containing additional linker flags.
    extra_lib_dir is the name of a directory to add to the list of library
    directories.
    extra_lib is the name of an extra library to add to the list of libraries.
    sip_flags is the list of sip flags to use instead of the defaults.
    """
    sipconfig.inform("Generating the C++ source for the %s module..." % mname)

    try:
        shutil.rmtree(mname)
    except:
        pass

    try:
        os.mkdir(mname)
    except:
        sipconfig.error("Unable to create the %s directory." % mname)

    # Build the SIP command line.
    argv = [pyqtcfg.sip_bin]

    if sip_flags:
        argv.extend(sip_flags)

    if opt_concat:
        argv.append("-j")
        argv.append(str(opt_split))

    if opt_tracing:
        argv.append("-r")

    if opt_releasegil:
        argv.append("-g")

    argv.append("-c")
    argv.append(mname)

    buildfile = os.path.join(mname, mname + ".sbf")
    argv.append("-b")
    argv.append(buildfile)

    argv.append("-I")
    argv.append(pyqtcfg.pyqt_sip_dir)

    # SIP assumes POSIX style path separators.
    argv.append(string.join(["sip", mname, mname + "mod.sip"], "/"))

    os.system(string.join(argv))

    # Check the result.
    if not os.access(buildfile, os.F_OK):
        sipconfig.error("Unable to create the C++ code.")

    # Compile the Python stub.
    if pyqtcfg.sip_version < 0x040000:
        sipconfig.inform("Compiling %s.py..." % mname)
        py_compile.compile(os.path.join(mname, mname + ".py"), os.path.join(mname, mname + ".pyc"))

    # Generate the Makefile.
    sipconfig.inform("Creating the Makefile for the %s module..." % mname)

    installs = []

    if pyqtcfg.sip_version >= 0x040000:
        warnings = 1
    else:
        warnings = 0
        installs.append([[mname + ".py", mname + ".pyc"], opt_pyqmmpmoddir])

    sipfiles = []

    for s in glob.glob("sip/" + mname + "/*.sip"):
        sipfiles.append(os.path.join("..", "sip", mname, os.path.basename(s)))

    installs.append([sipfiles, os.path.join(opt_pyqmmpsipdir, mname)])

    makefile = sipconfig.SIPModuleMakefile(
        configuration=pyqtcfg,
        build_file=mname + ".sbf",
        dir=mname,
        install_dir=opt_pyqmmpmoddir,
        installs=installs,
        qt=1,
        warnings=warnings,
        static=opt_static,
        debug=opt_debug,
    )

    if extra_cflags:
        makefile.extra_cflags.append(extra_cflags)

    if extra_cxxflags:
        makefile.extra_cxxflags.append(extra_cxxflags)

    if extra_define:
        makefile.extra_defines.append(extra_define)

    if extra_include_dir:
        makefile.extra_include_dirs.append(extra_include_dir)

    if extra_lflags:
        makefile.extra_lflags.append(extra_lflags)

    if extra_lib_dir:
        makefile.extra_lib_dirs.append(extra_lib_dir)

    if extra_lib:
        makefile.extra_libs.append(extra_lib)

    if pyqtcfg.sip_version < 0x040000 and imports:
        # Inter-module links.
        for im in imports:
            makefile.extra_lib_dirs.insert(0, pyqtcfg.pyqt_mod_dir)
            makefile.extra_libs.insert(0, makefile.module_as_lib(im))

    makefile.generate()
Exemple #27
0
def create_makefiles(macros):
    """Create the Makefiles.

    macros is the dictionary of platform specific build macros.
    """
    # Bootstrap.  Make sure we get the right one.
    sys.path.insert(0, os.path.curdir)
    invalidate_caches()
    import sipconfig

    cfg = sipconfig.Configuration()

    cfg.set_build_macros(macros)

    if opts.no_tools:
        subdirs = ["siplib"]
        installs = None
    else:
        subdirs = ["sipgen", "siplib"]
        installs = (["sipconfig.py", os.path.join(src_dir, "sipdistutils.py")], cfg.sip_mod_dir)

    if opts.use_qmake:
        sipconfig.inform("Creating top level .pro file...")

        pro = open("sip.pro", "w")

        pro.write("TEMPLATE = subdirs\n")
        pro.write("SUBDIRS = %s\n" % " ".join(subdirs))

        if installs is not None:
            files, path = installs
            pro.write("\n")
            pro.write("build_system.files = %s\n" % " ".join(files))
            pro.write("build_system.path = %s\n" % quote(path))
            pro.write("INSTALLS += build_system\n")

        pro.close()
    else:
        sipconfig.inform("Creating top level Makefile...")

        sipconfig.ParentMakefile(configuration=cfg, subdirs=subdirs, installs=installs).generate()

    if opts.use_qmake:
        sipconfig.inform("Creating sip code generator .pro file...")

        pro = open(os.path.join("sipgen", "sipgen.pro"), "w")

        pro.write("TEMPLATE = app\n")
        pro.write("TARGET = sip\n")
        pro.write("CONFIG -= qt app_bundle\n")
        pro.write("CONFIG += warn_off exceptions_off console %s\n" % (("debug" if opts.debug else "release")))

        pro.write("\n")
        pro.write("# Work around QTBUG-39300.\n")
        pro.write("CONFIG -= android_install\n")

        pro.write("\n")
        pro.write("target.path = %s\n" % os.path.dirname(cfg.sip_bin))
        pro.write("INSTALLS += target\n")

        c_sources = get_sources("sipgen", "*.c")
        pro.write("\n")
        pro.write("SOURCES = %s\n" % " ".join(c_sources))

        headers = get_sources("sipgen", "*.h")
        pro.write("\n")
        pro.write("HEADERS = %s\n" % " ".join(headers))

        pro.close()
    else:
        sipconfig.inform("Creating sip code generator Makefile...")

        sipconfig.ProgramMakefile(
            configuration=cfg,
            build_file=os.path.join(src_dir, "sipgen", "sipgen.sbf"),
            dir="sipgen",
            install_dir=os.path.dirname(cfg.sip_bin),
            console=1,
            warnings=0,
            universal=opts.universal,
            arch=opts.arch,
            deployment_target=opts.deployment_target,
        ).generate()

    if opts.use_qmake:
        sipconfig.inform("Creating sip module .pro file...")

        pro = open(os.path.join("siplib", "siplib.pro"), "w")

        pro.write("TEMPLATE = lib\n")
        pro.write("TARGET = %s\n" % sip_module_base)
        pro.write("CONFIG -= qt\n")
        pro.write(
            "CONFIG += warn_on exceptions_off %s %s\n"
            % (("staticlib" if opts.static else "plugin"), ("debug" if opts.debug else "release"))
        )

        pro.write("\n")
        pro.write("# Work around QTBUG-39300.\n")
        pro.write("CONFIG -= android_install\n")

        pro.write("\n")
        pro.write("INCLUDEPATH += %s\n" % cfg.py_inc_dir)
        if cfg.py_conf_inc_dir != cfg.py_inc_dir:
            pro.write("INCLUDEPATH += %s\n" % cfg.py_conf_inc_dir)

        if not opts.static:
            # These only need to be correct for Windows.
            debug_suffix = "_d" if opts.debug else ""
            link_lib_dir = quote("-L" + cfg.py_lib_dir)

            pro.write(
                """
win32 {
    PY_MODULE = %s%s.pyd
    target.files = %s%s.pyd
    LIBS += %s -lpython%d.%d
    QMAKE_POST_LINK = $(COPY_FILE) $(DESTDIR_TARGET) $$PY_MODULE
} else {
    PY_MODULE = %s.so
    target.files = %s.so
    QMAKE_POST_LINK = $(COPY_FILE) $(TARGET) $$PY_MODULE
}

macx {
    QMAKE_LFLAGS += "-undefined dynamic_lookup"
    QMAKE_LFLAGS += "-install_name $$absolute_path($$PY_MODULE, $$target.path)"
}
"""
                % (
                    sip_module_base,
                    debug_suffix,
                    sip_module_base,
                    debug_suffix,
                    link_lib_dir,
                    (py_version >> 16),
                    ((py_version >> 8) & 0xFF),
                    sip_module_base,
                    sip_module_base,
                )
            )

        pro.write("\n")
        pro.write("target.CONFIG = no_check_exist\n")
        pro.write("target.path = %s\n" % cfg.sip_mod_dir)
        pro.write("INSTALLS += target\n")

        pro.write("\n")
        pro.write("sip_h.files = sip.h\n")
        pro.write("sip_h.path = %s\n" % cfg.sip_inc_dir)
        pro.write("INSTALLS += sip_h\n")

        c_sources = get_sources("siplib", "*.c")
        cpp_sources = get_sources("siplib", "*.cpp")
        pro.write("\n")
        pro.write("SOURCES = %s\n" % " ".join(c_sources + cpp_sources))

        headers = get_sources("siplib", "*.h")
        pro.write("\n")
        pro.write("HEADERS = %s\n" % " ".join(headers))

        pro.close()
    else:
        sipconfig.inform("Creating sip module Makefile...")

        build_dir = os.getcwd()

        makefile = sipconfig.ModuleMakefile(
            configuration=cfg,
            build_file=os.path.join(build_dir, "siplib", "siplib.sbf"),
            dir="siplib",
            install_dir=cfg.sip_mod_dir,
            installs=([os.path.join(build_dir, "siplib", "sip.h")], cfg.sip_inc_dir),
            console=1,
            warnings=0,
            static=opts.static,
            debug=opts.debug,
            universal=opts.universal,
            arch=opts.arch,
            deployment_target=opts.deployment_target,
        )

        if src_dir != build_dir:
            src_siplib_dir = os.path.join(src_dir, "siplib")
            makefile.extra_include_dirs.append(src_siplib_dir)
            makefile.extra_source_dirs.append(src_siplib_dir)

        makefile.generate()
Exemple #28
0
def check_license():
    """Handle the validation of the PyQicsTable license.
    """
    try:
        import license
        ltype = license.LicenseType
        lname = license.LicenseName

        try:
            lfile = license.LicenseFile
        except AttributeError:
            lfile = None
    except ImportError:
        ltype = None

    if ltype is None:
        ltype = "GPL"
        lname = "GNU General Public License"
        lfile = None

    sipconfig.inform(
        "This is the %s version of PyQicsTable %s (licensed under the %s) for Python %s on %s."
        % (ltype, pyqicstable_version_str, lname, string.split(
            sys.version)[0], sys.platform))

    # Common checks.
    if ltype == "GPL" and sys.platform == "win32":
        error("You cannot use the GPL version of PyQicsTable under Windows.")

    try:
        qted = pyqtcfg.qt_edition
    except AttributeError:
        qted = None

    if qted:
        if (qted == "free" and ltype != "GPL") or (qted != "free"
                                                   and ltype == "GPL"):
            sipconfig.error(
                "This version of PyQicsTable and the %s edition of Qt have incompatible licenses."
                % qted)

    # Confirm the license.
    print
    print "Type 'L' to view the license."
    print "Type 'yes' to accept the terms of the license."
    print "Type 'no' to decline the terms of the license."
    print

    while 1:
        try:
            resp = raw_input("Do you accept the terms of the license? ")
        except:
            resp = ""

        resp = string.lower(string.strip(resp))

        if resp == "yes":
            break

        if resp == "no":
            sys.exit(0)

        if resp == "l":
            os.system("more LICENSE")

    # If there should be a license file then check it is where it should be.
    if lfile:
        if os.access(os.path.join("sip", lfile), os.F_OK):
            sipconfig.inform("Found the license file %s." % lfile)
        else:
            sipconfig.error(
                "Please copy the license file %s to the sip directory." %
                lfile)
Exemple #29
0
def main(argv):
    """Create the configuration module module.

    argv is the list of command line arguments.
    """
    try:
        optlist, args = getopt.getopt(argv[1:], "hcd:gj:kn:o:ruv:w:q")
    except getopt.GetoptError:
        usage()

    global opt_pyqicstablemoddir, opt_pyqicstablesipdir
    global opt_qicstableincdir, opt_qicstablelibdir
    global opt_static, opt_debug, opt_concat, opt_releasegil, opt_split
    global opt_tracing, opt_verbose, opt_qicsTableDebug

    for opt, arg in optlist:
        if opt == "-h":
            usage(0)
        elif opt == "-c":
            opt_concat = 1
        elif opt == "-d":
            opt_pyqicstablemoddir = arg
        elif opt == "-g":
            opt_releasegil = 1
        elif opt == "-j":
            try:
                opt_split = int(arg)
            except:
                usage()
        elif opt == "-k":
            opt_static = 1
        elif opt == "-n":
            opt_qicstableincdir = arg
        elif opt == "-o":
            opt_qicstablelibdir = arg
        elif opt == "-r":
            opt_tracing = 1
        elif opt == "-u":
            opt_debug = 1
        elif opt == "-v":
            opt_pyqicstablesipdir = arg
        elif opt == "-w":
            opt_verbose = 1
        elif opt == "-q":
            opt_qicsTableDebug = 1

    if args:
        usage()

    check_license()

    sipconfig.inform("SIP %s is being used." % pyqtcfg.sip_version_str)

    # Check SIP is new enough.
    if pyqtcfg.sip_version_str[:8] != "snapshot":
        minv = None

        if pyqtcfg.sip_version >= 0x040000:
            if pyqtcfg.sip_version < sip_min_v4_version:
                minv = sip_min_v4_version
        else:
            if pyqtcfg.sip_version < sip_min_v3_version:
                minv = sip_min_v3_version

        if minv:
            sipconfig.error(
                "This version of PyQicsTable requires SIP v%s or later" %
                sipconfig.version_to_string(minv))

    # Check for QicsTable.
    check_qicstable()

    # If QicsTable wasn't found then there is no point carrying on.  An
    # appropriate error message will already have been displayed.
    if qicstable_version is None:
        sys.exit(1)

# Set the SIP platform, version and feature flags.
    set_sip_flags()

    # Tell the user what's been found.
    inform_user()

    lib_dir = "../../../lib"
    if opt_qicstablelibdir != "../../lib":
        lib_dir = opt_qicstablelibdir

    # Generate the code.
    libName = None
    if os.name == "nt":
        if opt_qicsTableDebug == 1:
            libName = "qicstabled2"
        else:
            libName = "qicstable2"
    else:
        if opt_qicsTableDebug == 1:
            libName = "qicstable_debug"
        else:
            libName = "qicstable"

    generate_code("qicstable",
                  imports=["PyQt4"],
                  extra_define=qicstable_define,
                  extra_include_dir=opt_qicstableincdir,
                  extra_lib_dir=lib_dir,
                  extra_lib=libName,
                  sip_flags=qicstable_sip_flags)

    # Create the additional Makefiles.
    create_makefiles()

    # Install the configuration module.
    create_config("pyqicstableconfig.py", "pyqicstableconfig.py.in")
Exemple #30
0
                      dest="lib",
                      help="the name without extension of the lib")
    parser.add_option(
        "",
        "--lib-path",
        dest="lib_path",
        help="the path where the lib dynamic library can be found")
    parser.add_option("",
                      "--include-path",
                      dest="include_path",
                      help="the path where the lib headers can be found")
    parser.add_option("",
                      "--build-path",
                      dest="build_path",
                      help="the path where the Makefile can be found")
    options, args = parser.parse_args()

    return options


options = None

if __name__ == '__main__':
    options = parse_options()

    config = pyqtconfig.Configuration()
    sipconfig.inform("Generating bindings")
    run_sip(config)
    sipconfig.inform("Generating Makefile")
    generate_makefile(config)
    sipconfig.inform("Makefile generated. Run \"nmake\" now.")
Exemple #31
0
def create_makefiles(macros):
    """Create the Makefiles.

    macros is the dictionary of platform specific build macros.
    """
    # Bootstrap.  Make sure we get the right one.
    sys.path.insert(0, os.path.curdir)
    invalidate_caches()
    import sipconfig

    cfg = sipconfig.Configuration()

    cfg.set_build_macros(macros)

    if opts.no_tools:
        subdirs = ["siplib"]
        installs = None
    else:
        subdirs = ["sipgen", "siplib"]
        installs = (["sipconfig.py",
                     os.path.join(src_dir,
                                  "sipdistutils.py")], cfg.sip_mod_dir)

    if opts.use_qmake:
        sipconfig.inform("Creating top level .pro file...")

        pro = open("sip.pro", "w")

        pro.write("TEMPLATE = subdirs\n")
        pro.write("SUBDIRS = %s\n" % " ".join(subdirs))

        if installs is not None:
            files, path = installs
            pro.write("\n")
            pro.write("build_system.files = %s\n" % " ".join(files))
            pro.write("build_system.path = %s\n" % quote(path))
            pro.write("INSTALLS += build_system\n")

        pro.close()
    else:
        sipconfig.inform("Creating top level Makefile...")

        sipconfig.ParentMakefile(configuration=cfg,
                                 subdirs=subdirs,
                                 installs=installs).generate()

    if opts.use_qmake:
        sipconfig.inform("Creating sip code generator .pro file...")

        pro = open(os.path.join("sipgen", "sipgen.pro"), "w")

        pro.write("TEMPLATE = app\n")
        pro.write("TARGET = sip\n")
        pro.write("CONFIG -= qt app_bundle\n")
        pro.write("CONFIG += warn_off exceptions_off console %s\n" %
                  (("debug" if opts.debug else "release")))

        pro.write("\n")
        pro.write("# Work around QTBUG-39300.\n")
        pro.write("CONFIG -= android_install\n")

        pro.write("\n")
        pro.write("target.path = %s\n" % os.path.dirname(cfg.sip_bin))
        pro.write("INSTALLS += target\n")

        c_sources = get_sources("sipgen", "*.c")
        pro.write("\n")
        pro.write("SOURCES = %s\n" % " ".join(c_sources))

        headers = get_sources("sipgen", "*.h")
        pro.write("\n")
        pro.write("HEADERS = %s\n" % " ".join(headers))

        pro.close()
    else:
        sipconfig.inform("Creating sip code generator Makefile...")

        sipconfig.ProgramMakefile(
            configuration=cfg,
            build_file=os.path.join(src_dir, "sipgen", "sipgen.sbf"),
            dir="sipgen",
            install_dir=os.path.dirname(cfg.sip_bin),
            console=1,
            warnings=0,
            universal=opts.universal,
            arch=opts.arch,
            deployment_target=opts.deployment_target).generate()

    if opts.use_qmake:
        sipconfig.inform("Creating sip module .pro file...")

        pro = open(os.path.join("siplib", "siplib.pro"), "w")

        pro.write("TEMPLATE = lib\n")
        pro.write("TARGET = %s\n" % sip_module_base)
        pro.write("CONFIG -= qt\n")
        pro.write("CONFIG += warn_on exceptions_off %s %s\n" %
                  (("staticlib" if opts.static else "plugin"),
                   ("debug" if opts.debug else "release")))

        pro.write("\n")
        pro.write("# Work around QTBUG-39300.\n")
        pro.write("CONFIG -= android_install\n")

        pro.write("\n")
        pro.write("INCLUDEPATH += %s\n" % cfg.py_inc_dir)
        if cfg.py_conf_inc_dir != cfg.py_inc_dir:
            pro.write("INCLUDEPATH += %s\n" % cfg.py_conf_inc_dir)

        if not opts.static:
            # These only need to be correct for Windows.
            debug_suffix = "_d" if opts.debug else ""
            link_lib_dir = quote("-L" + cfg.py_lib_dir)

            pro.write("""
win32 {
    PY_MODULE = %s%s.pyd
    target.files = %s%s.pyd
    LIBS += %s -lpython%d.%d
    QMAKE_POST_LINK = $(COPY_FILE) $(DESTDIR_TARGET) $$PY_MODULE
} else {
    PY_MODULE = %s.so
    target.files = %s.so
    QMAKE_POST_LINK = $(COPY_FILE) $(TARGET) $$PY_MODULE
}

macx {
    QMAKE_LFLAGS += "-undefined dynamic_lookup"
    QMAKE_LFLAGS += "-install_name $$absolute_path($$PY_MODULE, $$target.path)"
}
""" % (sip_module_base, debug_suffix, sip_module_base, debug_suffix,
            link_lib_dir, (py_version >> 16),
            ((py_version >> 8) & 0xff), sip_module_base, sip_module_base))

        pro.write("\n")
        pro.write("target.CONFIG = no_check_exist\n")
        pro.write("target.path = %s\n" % cfg.sip_mod_dir)
        pro.write("INSTALLS += target\n")

        pro.write("\n")
        pro.write("sip_h.files = sip.h\n")
        pro.write("sip_h.path = %s\n" % cfg.sip_inc_dir)
        pro.write("INSTALLS += sip_h\n")

        c_sources = get_sources("siplib", "*.c")
        cpp_sources = get_sources("siplib", "*.cpp")
        pro.write("\n")
        pro.write("SOURCES = %s\n" % " ".join(c_sources + cpp_sources))

        headers = get_sources("siplib", "*.h")
        pro.write("\n")
        pro.write("HEADERS = %s\n" % " ".join(headers))

        pro.close()
    else:
        sipconfig.inform("Creating sip module Makefile...")

        sipconfig.ModuleMakefile(
            configuration=cfg,
            build_file=os.path.join(src_dir, "siplib", "siplib.sbf"),
            dir="siplib",
            install_dir=cfg.sip_mod_dir,
            installs=([os.path.join(src_dir, "siplib",
                                    "sip.h")], cfg.sip_inc_dir),
            console=1,
            warnings=0,
            static=opts.static,
            debug=opts.debug,
            universal=opts.universal,
            arch=opts.arch,
            deployment_target=opts.deployment_target).generate()
Exemple #32
0
def generate_code(
        mname,
        imports=None,
        extra_cflags=None,
        extra_cxxflags="-I%s/QtCore/ -I%s/QtXml/ -I%s/QtGui/ -I%s -I../../../include -L../../../lib"
    % (pyqtcfg.qt_inc_dir, pyqtcfg.qt_inc_dir, pyqtcfg.qt_inc_dir,
       pyqtcfg.qt_inc_dir),
        extra_define=None,
        extra_include_dir=None,
        extra_lflags=None,
        extra_lib_dir=None,
        extra_lib=None,
        sip_flags=None):
    """Generate the code for a module.

    mname is the name of the module.
    imports is the list of PyQt modules that this one %Imports.
    extra_cflags is a string containing additional C compiler flags.
    extra_cxxflags is a string containing additional C++ compiler flags.
    extra_define is a name to add to the list of preprocessor defines.
    extra_include_dir is the name of a directory to add to the list of include
    directories.
    extra_lflags is a string containing additional linker flags.
    extra_lib_dir is the name of a directory to add to the list of library
    directories.
    extra_lib is the name of an extra library to add to the list of libraries.
    sip_flags is the list of sip flags to use instead of the defaults.
    """
    sipconfig.inform("Generating the C++ source for the %s module..." % mname)

    try:
        shutil.rmtree(mname)
    except:
        pass

    try:
        os.mkdir(mname)
    except:
        sipconfig.error("Unable to create the %s directory." % mname)

    # Build the SIP command line.
    argv = [pyqtcfg.sip_bin]

    if sip_flags:
        argv.extend(sip_flags)

    if opt_concat:
        argv.append("-j")
        argv.append(str(opt_split))

    if opt_tracing:
        argv.append("-r")

    if opt_releasegil:
        argv.append("-g")

    argv.append("-c")
    argv.append(mname)

    buildfile = os.path.join(mname, mname + ".sbf")
    argv.append("-b")
    argv.append(buildfile)

    argv.append("-I")
    argv.append(pyqtcfg.pyqt_sip_dir)

    # SIP assumes POSIX style path separators.
    argv.append(string.join(["sip", mname, mname + "mod.sip"], "/"))

    os.system(string.join(argv))

    # Check the result.
    if not os.access(buildfile, os.F_OK):
        sipconfig.error("Unable to create the C++ code.")

    # Compile the Python stub.
    if pyqtcfg.sip_version < 0x040000:
        sipconfig.inform("Compiling %s.py..." % mname)
        py_compile.compile(os.path.join(mname, mname + ".py"),
                           os.path.join(mname, mname + ".pyc"))

    # Generate the Makefile.
    sipconfig.inform("Creating the Makefile for the %s module..." % mname)

    installs = []

    if pyqtcfg.sip_version >= 0x040000:
        warnings = 1
    else:
        warnings = 0
        installs.append([[mname + ".py", mname + ".pyc"],
                         opt_pyqicstablemoddir])

    sipfiles = []

    for s in glob.glob("sip/" + mname + "/*.sip"):
        sipfiles.append(os.path.join("..", "sip", mname, os.path.basename(s)))

    installs.append([sipfiles, os.path.join(opt_pyqicstablesipdir, mname)])

    makefile = sipconfig.SIPModuleMakefile(configuration=pyqtcfg,
                                           build_file=mname + ".sbf",
                                           dir=mname,
                                           install_dir=opt_pyqicstablemoddir,
                                           installs=installs,
                                           qt=1,
                                           warnings=warnings,
                                           static=opt_static,
                                           debug=opt_debug)

    if extra_cflags:
        makefile.extra_cflags.append(extra_cflags)

    if extra_cxxflags:
        makefile.extra_cxxflags.append(extra_cxxflags)

    if extra_define:
        makefile.extra_defines.append(extra_define)

    if extra_include_dir:
        makefile.extra_include_dirs.append(extra_include_dir)

    if extra_lflags:
        makefile.extra_lflags.append(extra_lflags)

    if extra_lib_dir:
        makefile.extra_lib_dirs.append(extra_lib_dir)

    if extra_lib:
        makefile.extra_libs.append(extra_lib)

    if pyqtcfg.sip_version < 0x040000 and imports:
        # Inter-module links.
        for im in imports:
            makefile.extra_lib_dirs.insert(0, pyqtcfg.pyqt_mod_dir)
            makefile.extra_libs.insert(0, makefile.module_as_lib(im))

    makefile.generate()
Exemple #33
0
def main(argv):
    """Create the configuration module module.

    argv is the list of command line arguments.
    """
    try:
        optlist, args = getopt.getopt(argv[1:], "hcd:gj:kn:o:ruv:w")
    except getopt.GetoptError:
        usage()

    global opt_pyqmmpmoddir, opt_pyqmmpsipdir
    global opt_qmmpincdir, opt_qmmplibdir
    global opt_static, opt_debug, opt_concat, opt_releasegil, opt_split
    global opt_tracing, opt_verbose

    """
    for opt, arg in optlist:
        if opt == "-h":
            usage(0)
        elif opt == "-c":
            opt_concat = 1
        elif opt == "-d":
            opt_pyqmmpmoddir = arg
        elif opt == "-g":
            opt_releasegil = 1
        elif opt == "-j":
            try:
                opt_split = int(arg)
            except:
                usage()
        elif opt == "-k":
            opt_static = 1
        elif opt == "-n":
            opt_qmmpincdir = arg
        elif opt == "-o":
            opt_qmmplibdir = arg
        elif opt == "-r":
            opt_tracing = 1
        elif opt == "-u":
            opt_debug = 1
        elif opt == "-v":
            opt_pyqmmpsipdir = arg
        elif opt == "-w":
            opt_verbose = 1

    if args:
        usage()
    """

    # check_license()

    sipconfig.inform("SIP %s is being used." % pyqtcfg.sip_version_str)

    # Check SIP is new enough.
    if pyqtcfg.sip_version_str[:8] != "snapshot":
        minv = None

        if pyqtcfg.sip_version >= 0x040000:
            if pyqtcfg.sip_version < sip_min_v4_version:
                minv = sip_min_v4_version
        else:
            if pyqtcfg.sip_version < sip_min_v3_version:
                minv = sip_min_v3_version

        if minv:
            sipconfig.error("This version of PyQMMP requires SIP v%s or later" % sipconfig.version_to_string(minv))

    # Check for .
    # check_qmmp()

    # If  wasn't found then there is no point carrying on.  An
    # appropriate error message will already have been displayed.
    # if qmmp_version is None:
    #   sys.exit(1)

    # Set the SIP platform, version and feature flags.
    set_sip_flags()

    # Tell the user what's been found.
    inform_user()

    lib_dir = "../../"
    # if opt_qmmplibdir != "../lib":
    #   lib_dir = opt_qmmplibdir

    # Generate the code.
    generate_code(
        "qmmp",
        imports=["PyQt4"],
        extra_define=qmmp_define,
        extra_include_dir=opt_qmmpincdir,
        extra_lib_dir=lib_dir,
        extra_lib="qmmp",
        sip_flags=qmmp_sip_flags,
    )

    # Create the additional Makefiles.
    create_makefiles()

    # Install the configuration module.
    create_config("pyqmmpconfig.py", "pyqmmpconfig.py.in")
Exemple #34
0
def inform_user():
    """Tell the user the option values that are going to be used.
    """
    sipconfig.inform("PyQt %s is being used." % pyqt.pyqt_version_str)
    sipconfig.inform("Qt v%s %s edition is being used." % (sipconfig.version_to_string(pyqt.qt_version), pyqt.qt_edition))
    sipconfig.inform("SIP %s is being used." % pyqt.sip_version_str)

    sipconfig.inform("The QScintilla module will be installed in %s." % opts.qscimoddir)
    sipconfig.inform("The QScintilla API file will be installed in %s." % os.path.join(opts.qscidir, "api", "python"))
    sipconfig.inform("The QScintilla .sip files will be installed in %s." % opts.qscisipdir)

    if opts.no_docstrings:
        sipconfig.inform("The QScintilla module is being built without generated docstrings.")
    else:
        sipconfig.inform("The QScintilla module is being built with generated docstrings.")

    if opts.prot_is_public:
        sipconfig.inform("The QScintilla module is being built with 'protected' redefined as 'public'.")
Exemple #35
0
def inform_user():
    """Tell the user the option values that are going to be used.
    """
    sipconfig.inform("The PyQMMP modules will be installed in %s." % opt_pyqmmpmoddir)
    sipconfig.inform("The PyQMMP .sip files will be installed in %s." % opt_pyqmmpsipdir)
Exemple #36
0
def generate_code():
    """Generate the code for the QScintilla module.
    """
    if pyqt.pyqt_version >= 0x040000:
        mname = "Qsci"
    else:
        mname = "qsci"

    sipconfig.inform("Generating the C++ source for the %s module..." % mname)

    # Build the SIP command line.
    argv = ['"' + pyqt.sip_bin + '"']

    argv.extend(sip_flags())

    if opts.no_timestamp:
        argv.append("-T")

    if not opts.no_docstrings:
        argv.append("-o");

    if opts.prot_is_public:
        argv.append("-P");

    if opts.concat:
        argv.append("-j")
        argv.append(str(opts.split))

    if opts.tracing:
        argv.append("-r")

    argv.append("-c")
    argv.append(".")

    buildfile = os.path.join("qsci.sbf")
    argv.append("-b")
    argv.append(buildfile)

    if pyqt.pyqt_version >= 0x040000:
        argv.append("sip/qscimod4.sip")
    else:
        argv.append("sip/qscimod3.sip")

    os.system(" ".join(argv))

    # Check the result.
    if not os.access(buildfile, os.F_OK):
        sipconfig.error("Unable to create the C++ code.")

    # Generate the Makefile.
    sipconfig.inform("Creating the Makefile for the %s module..." % mname)

    def fix_install(mfile):
        if sys.platform != "darwin" or opts.static:
            return

        mfile.write("\tinstall_name_tool -change libqscintilla2.%u.dylib %s/libqscintilla2.%u.dylib $(DESTDIR)%s/$(TARGET)\n" % (QSCI_API_MAJOR, opts.qscilibdir, QSCI_API_MAJOR, opts.qscimoddir))

    if pyqt.pyqt_version >= 0x040000:
        class Makefile(pyqt4.QtGuiModuleMakefile):
            def generate_target_install(self, mfile):
                pyqt4.QtGuiModuleMakefile.generate_target_install(self, mfile)
                fix_install(mfile)
    else:
        class Makefile(pyqt3.QtModuleMakefile):
            def generate_target_install(self, mfile):
                pyqt3.QtModuleMakefile.generate_target_install(self, mfile)
                fix_install(mfile)

    installs = []
    sipfiles = []

    for s in glob.glob("sip/*.sip"):
        sipfiles.append(os.path.join("sip", os.path.basename(s)))

    installs.append([sipfiles, os.path.join(opts.qscisipdir, mname)])

    installs.append(("QScintilla2.api", os.path.join(opts.qscidir, "api", "python")))

    # PyQt v4.2 and later can handle MacOS/X universal binaries.
    if pyqt.pyqt_version >= 0x040200:
        makefile = Makefile(
            configuration=pyqt,
            build_file="qsci.sbf",
            install_dir=opts.qscimoddir,
            installs=installs,
            static=opts.static,
            debug=opts.debug,
            universal=pyqt.universal,
            arch=pyqt.arch,
            prot_is_public=opts.prot_is_public,
            deployment_target=pyqt.deployment_target
        )
    else:
        makefile = Makefile(
            configuration=pyqt,
            build_file="qsci.sbf",
            install_dir=opts.qscimoddir,
            installs=installs,
            static=opts.static,
            debug=opts.debug
        )

    if qsci_define:
        makefile.extra_defines.append(qsci_define)

    makefile.extra_include_dirs.append(opts.qsciincdir)
    makefile.extra_lib_dirs.append(opts.qscilibdir)
    makefile.extra_libs.append("qscintilla2")

    makefile.generate()
Exemple #37
0
# Copyright 2011 Demetrius Cassidy
import os
import sys
import shutil
import sipconfig
import getopt

from os.path import abspath, exists, join, normpath

try:
    from PyQt4 import pyqtconfig

    has_pyqt = True
except:
    pyqtconfig = sipconfig
    sipconfig.inform("PyQt4 is not available, Qt support is disabled.")
    has_pyqt = False

sip_min_version = 0x040900

qt_version = 0
qt_edition = ""
qt_licensee = None
qt_dir = None
qt_incdir = None
qt_libdir = None
qt_bindir = None
qt_datadir = None
qt_pluginsdir = None
qt_xfeatures = None
qt_shared = ""