Пример #1
0
def check_for_qt4():
    try:
        from PyQt4 import pyqtconfig
    except ImportError:
        print_status("Qt4", "no")
        return False
    else:
        print_status("Qt4", "Qt: %s, PyQt4: %s" %
                     (convert_qt_version(pyqtconfig.Configuration().qt_version),
                      pyqtconfig.Configuration().pyqt_version_str))
        return True
Пример #2
0
def check_for_qt():
    try:
        import pyqtconfig
    except ImportError:
        print_status("Qt", "no")
        return False
    else:
        try:
            qt_version = pyqtconfig.Configuration().qt_version
            qt_version = convert_qt_version(qt_version)
        except AttributeError:
            qt_version = "<unknown>"
        print_status("Qt", "Qt: %s, PyQt: %s" %
                     (qt_version,
                      pyqtconfig.Configuration().pyqt_version_str))
        return True
Пример #3
0
def get_pyqt_configuration(options):
    """Return the PyQt configuration for Qt3 or Qt4.
    """

    global pyqtconfig
    if options.qt == 3:
        required = 'Requires at least PyQt-3.17 and its development tools.'
        options.qwt = 'qwt5qt3'
        options.iqt = 'iqt5qt3'
        try:
            import pyqtconfig as pyqtconfig
        except ImportError:
            raise Die(required)
        try:
            configuration = pyqtconfig.Configuration()
        except AttributeError:
            raise Die(
                'Check whether SIP and PyQt have been installed properly.')
        if 0x031100 > configuration.pyqt_version:
            raise Die(required)
    elif options.qt == 4:
        required = 'Requires at least PyQt-4.2 and its development tools.'
        options.qwt = 'qwt5qt4'
        options.iqt = 'iqt5qt4'
        try:
            import PyQt4.pyqtconfig as pyqtconfig
        except ImportError:
            raise Die(required)
        try:
            configuration = pyqtconfig.Configuration()
        except AttributeError:
            raise Die(
                'Check whether SIP and PyQt4 have been installed properly.')
        if 0x040200 > configuration.pyqt_version:
            raise Die(required)

    return configuration
Пример #4
0
    def initialize_sip_extension(self):
        if pyqtconfig is None:
            raise RuntimeError("PyQt3 dev is not installed. Can't build " \
                               "pixmaptools extension")
        # Get the PyQt configuration information.
        config = pyqtconfig.Configuration()
        qt_sip_flags = config.pyqt_qt_sip_flags

        #Local include
        include_dirs = [os.path.dirname(os.path.realpath(__file__))]
        #Extra include for numpy
        include_dirs += [numpy.get_include()]
        #Extra include for pyqt
        include_dirs += [config.qt_inc_dir]
        include_dirs.append(os.path.join(base_path, 'qt3'))

        extra_compile_args = pyqtconfig._default_macros['CXXFLAGS'].split()
        extra_compile_args += pyqtconfig._default_macros[
            'CXXFLAGS_THREAD'].split()
        extra_compile_args += pyqtconfig._default_macros[
            'CXXFLAGS_WARN_ON'].split()

        extra_link_args = pyqtconfig._default_macros['LFLAGS'].split()

        library_dirs = pyqtconfig._default_macros['LIBDIR_QT'].split()
        extra_libs = ['qt-mt']
        sources = [
            'pixmaptools_io.cpp', 'pixmaptools_lut.cpp', 'pixmaptools_stat.cpp'
        ]
        if major == 4 and minor < 12:
            sources.append('pixmaptools_qt3_before_4_12.sip')
        else:
            sources.append('pixmaptools_qt3.sip')

        ext = Extension(
            "bliss.data.routines.pixmaptools.qt3",
            sources=[os.path.join(base_path, 'qt3', x) for x in sources],
            include_dirs=include_dirs,
            extra_compile_args=extra_compile_args,
            extra_link_args=extra_link_args,
            library_dirs=library_dirs,
            libraries=extra_libs,
            language='c++',
        )
        sip_flags = ' '.join(('-I', config.pyqt_sip_dir, qt_sip_flags))
        return ext, sip_flags
Пример #5
0
def get_pyqt_configuration(options):
    """Return the PyQt configuration for Qt3 or Qt4
    """
    required = 'Requires at least PyQt-3.17 and its development tools.'
    options.qwt = 'qwt4qt3'
    options.iqt = 'iqt4qt3'
    try:
        import pyqtconfig as pyqtconfig
    except ImportError:
        raise Die, required
    if 0x031100 > pyqtconfig._pkg_config['pyqt_version']:
        raise Die, required

    try:
        configuration = pyqtconfig.Configuration()
    except AttributeError:
        raise Die, 'Check if SIP and PyQt have been installed properly.'

    return configuration
Пример #6
0
def main():
    """Generate the build tree and the Makefiles
    """
    try:
        configuration = pyqtconfig.Configuration()
    except AttributeError:
        raise SystemExit, (
            'SIP-3 and PyQt have been built with build.py (deprecated).\n'
            'Rebuild and reinstall SIP and PyQt with configure.py.')

    options, args = parse_args()

    print 'Command line options:'
    pprint.pprint(options.__dict__)
    print

    options = check_sip(configuration, options)
    options = check_os(configuration, options)
    options = check_compiler(configuration, options)
    options = check_numarray(configuration, options)
    options = check_numeric(configuration, options)
    options = check_iqt(configuration, options)
    options = check_qwt(configuration, options)

    print
    print 'Extended command line options:'
    pprint.pprint(options.__dict__)
    print
    print 'The following packages will be built: %s.' % options.packages
    print
    setup_iqt_build(configuration, options)
    print
    setup_qwt_build(configuration, options)
    print
    setup_parent_build(configuration, options)
    print
    print 'Great, run make or nmake to build and install PyQwt.'
Пример #7
0
def main(argv):
    """Create the configuration module module.

    argv is the list of command line arguments.
    """
    global pyqt

    # Check SIP is new enough.
    if "preview" not in pyqt.sip_version_str and "snapshot" not in pyqt.sip_version_str:
        if pyqt.sip_version < sip_min_version:
            sipconfig.error("This version of QScintilla requires SIP v%s or later" % sipconfig.version_to_string(sip_min_version))

    # Parse the command line.
    global opts

    p = create_optparser()
    opts, args = p.parse_args()

    if args:
        p.print_help()
        sys.exit(2)

    # Provide defaults for platform-specific options.
    if sys.platform == 'win32':
        opts.prot_is_public = False

    if opts.not_dll:
        global qsci_define
        qsci_define = ""

    # Set the version of PyQt explicitly.
    global qt_data_dir

    if opts.pyqt_major == 4:
        if pyqt4 is None:
            sipconfig.error("PyQt v4 was specified with the -p argument but doesn't seem to be installed.")
        else:
            pyqt = pyqt4.Configuration()
            qt_data_dir = pyqt.qt_data_dir
    elif opts.pyqt_major == 3:
        if pyqt3 is None:
            sipconfig.error("PyQt v3 was specified with the -p argument but doesn't seem to be installed.")
        else:
            pyqt = pyqt3.Configuration()
            qt_data_dir = pyqt.qt_dir
    elif opts.pyqt_major >= 0:
        sipconfig.error("Specify either 3 or 4 with the -p argument.")

    # Now we know which version of PyQt to use we can set defaults for those
    # arguments that weren't specified.
    if opts.qscimoddir is None:
        opts.qscimoddir = pyqt.pyqt_mod_dir

    if opts.qsciincdir is None:
        opts.qsciincdir = pyqt.qt_inc_dir

    if opts.qscilibdir is None:
        opts.qscilibdir = pyqt.qt_lib_dir

    if opts.qscisipdir is None:
        opts.qscisipdir = pyqt.pyqt_sip_dir

    if opts.qscidir is None:
        opts.qscidir = os.path.join(qt_data_dir, "qsci")

    # Check for QScintilla.
    check_qscintilla()

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

    # Generate the code.
    generate_code()
Пример #8
0
try:
    import PyQt4.pyqtconfig as pyqt4
except:
    pyqt4 = None

try:
    import pyqtconfig as pyqt3
except:
    pyqt3 = None

if pyqt4 is not None:
    pyqt = pyqt4.Configuration()
    qt_data_dir = pyqt.qt_data_dir
elif pyqt3 is not None:
    pyqt = pyqt3.Configuration()
    qt_data_dir = pyqt.qt_dir
else:
    sipconfig.error("Unable to find either PyQt v3 or v4.")


# This must be kept in sync with Python/configure.py, qscintilla.pro,
# example-Qt4Qt5/application.pro and designer-Qt4Qt5/designer.pro.
QSCI_API_MAJOR = 12


# Initialise the globals.
sip_min_version = 0x040c00

if sys.platform == "win32":
    qsci_define = "QSCINTILLA_DLL"
Пример #9
0
import os
import sipconfig
import pyqtconfig

# The name of the SIP build file generated by SIP and used by the build
# system.
build_file = "QWave2.sbf"

# Get the SIP configuration information.
config = pyqtconfig.Configuration()

# Run SIP to generate the code.
os.system(" ".join([
    config.sip_bin, "-t", "WS_WIN", "-t", "Qt_3_2_0", "-c", "../python", "-b",
    build_file, "-w", "-I", "c:/python24/sip", "-I", ".", "main.sip"
]))

# Create the Makefile.
makefile = pyqtconfig.QtModuleMakefile(config,
                                       build_file,
                                       makefile="../python/Makefile")

# Add the library we are wrapping.  The name doesn't include any platform
# specific prefixes or extensions (e.g. the "lib" prefix on UNIX, or the
# ".dll" extension on Windows).
makefile.extra_include_dirs = ["../src", "../../include"]
makefile.extra_lib_dirs = ["../src"]
makefile.extra_libs = ["libqwave2"]

# Generate the Makefile itself.
makefile.generate()
               'version_info') or sys.version_info < (2, 3, 0, 'alpha', 0):
    raise SystemExit, "Python 2.3 or later is required to build Orange."

#if os.geteuid() != 0:
#    print "This script should be run as superuser!"
#    sys.exit(1)

try:
    import qt, pyqtconfig
except:
    print "NOTE: Python Qt not installed, OrangeCanvas and OrangeWidgets will not work."
    print "You can get it at: http://www.riverbankcomputing.co.uk/pyqt/index.php"
    # we are using Qt 2.3 - Qt 3.3

try:
    gotPyQt = pyqtconfig.Configuration().pyqt_version_str
except:
    gotPyQt = ''
    # any PyQt that supports Qt 2.3-3.8

try:
    import sipconfig
    tmp = "%x" % sipconfig.Configuration().qt_version
    gotPy = tmp.replace('0', '.')
except:
    print "Sipconfig not found, Qt version could not be found!"
    gotPy = ''
    # depends on version of PyQt

try:
    import numpy