Esempio n. 1
0
def bind(path, version_range=None, opts=None, parser=None):
    name = "sip"

    version = get_version_in_python(
        name, ["import sip", "print sip.SIP_VERSION_STR"])

    variants = _pymodule.bind(name,
                              path=path,
                              version_range=version_range,
                              version=version,
                              pure_python=False)

    return variants
Esempio n. 2
0
def bind(path, version_range=None, opts=None, parser=None):
    name = "sip"

    version = get_version_in_python(
        name,
        ["import sip",
         "print sip.SIP_VERSION_STR"])

    variants = _pymodule.bind(name,
                              path=path,
                              version_range=version_range,
                              version=version,
                              pure_python=False)

    return variants
Esempio n. 3
0
def bind(path, version_range=None, opts=None, parser=None):
    name = "PyQt"
    import_name = "PyQt4"
    tools = ["pyuic4"]

    version = get_version_in_python(
        name, ["from PyQt4 import QtCore", "print(QtCore.PYQT_VERSION_STR)"])

    variants = _pymodule.bind(name,
                              path=path,
                              import_name=import_name,
                              version_range=version_range,
                              requires=["sip-4"],
                              version=version,
                              pure_python=False,
                              tools=tools)

    return variants
Esempio n. 4
0
def bind(path, version_range=None, opts=None, parser=None):
    name = "PyQt"
    import_name = "PyQt4"
    tools = ["pyuic4"]

    version = get_version_in_python(
        name,
        ["from PyQt4 import QtCore",
         "print QtCore.PYQT_VERSION_STR"])

    variants = _pymodule.bind(name,
                              path=path,
                              import_name=import_name,
                              version_range=version_range,
                              requires=["sip-4"],
                              version=version,
                              pure_python=False,
                              tools=tools)

    return variants
Esempio n. 5
0
def bind(name,
         path,
         import_name=None,
         version_range=None,
         version=None,
         requires=None,
         pure_python=None,
         tools=None,
         extra_module_names=[],
         extra_attrs={}):
    import_name = import_name or name

    if version is None:
        version = get_version_in_python(
            name,
            ["import %s" % import_name,
             "print %s.__version__" % import_name])

    check_version(version, version_range)

    py_major_minor = '.'.join(str(x) for x in sys.version_info[:2])
    py_req = "python-%s" % py_major_minor
    found_tools = {}

    if pure_python is None:
        raise NotImplementedError  # detect
    elif pure_python:
        variant = [py_req]
    else:
        variant = system.variant + [py_req]

    for tool in (tools or []):
        try:
            src = find_exe(tool)
            found_tools[tool] = src
            log("found tool '%s': %s" % (tool, src))
        except RezBindError as e:
            print_warning(str(e))

    def make_root(variant, root):
        pypath = make_dirs(root, "python")
        copy_module(import_name, pypath)

        if found_tools:
            binpath = make_dirs(root, "bin")
            for tool, src in sorted(found_tools.items()):
                dest = os.path.join(binpath, tool)
                shutil.copy2(src, dest)

        for name_ in extra_module_names:
            copy_module(name_, pypath)

    with make_package(name, path, make_root=make_root) as pkg:
        pkg.version = version
        pkg.variants = [variant]

        if requires:
            pkg.requires = requires

        if found_tools:
            pkg.tools = list(found_tools)
            pkg.commands = commands_with_bin
        else:
            pkg.commands = commands

        for key, value in extra_attrs.iteritems():
            pkg[key] = value

    return pkg.installed_variants
Esempio n. 6
0
def bind(name, path, import_name=None, version_range=None, version=None,
         requires=None, pure_python=None, tools=None, extra_module_names=[],
         extra_attrs={}):
    import_name = import_name or name

    if version is None:
        version = get_version_in_python(
            name,
            ["import %s" % import_name,
             "print %s.__version__" % import_name])

    check_version(version, version_range)

    py_major_minor = '.'.join(str(x) for x in sys.version_info[:2])
    py_req = "python-%s" % py_major_minor
    found_tools = {}

    if pure_python is None:
        raise NotImplementedError  # detect
    elif pure_python:
        variant = [py_req]
    else:
        variant = system.variant + [py_req]

    for tool in (tools or []):
        try:
            src = find_exe(tool)
            found_tools[tool] = src
            log("found tool '%s': %s" % (tool, src))
        except RezBindError as e:
            print_warning(str(e))

    def make_root(variant, root):
        pypath = make_dirs(root, "python")
        copy_module(import_name, pypath)

        if found_tools:
            binpath = make_dirs(root, "bin")
            for tool, src in sorted(found_tools.items()):
                dest = os.path.join(binpath, tool)
                shutil.copy2(src, dest)

        for name_ in extra_module_names:
            copy_module(name_, pypath)

    with make_package(name, path, make_root=make_root) as pkg:
        pkg.version = version
        pkg.variants = [variant]

        if requires:
            pkg.requires = requires

        if found_tools:
            pkg.tools = list(found_tools)
            pkg.commands = commands_with_bin
        else:
            pkg.commands = commands

        for key, value in extra_attrs.iteritems():
            pkg[key] = value

    return pkg.installed_variants