Exemplo n.º 1
0
 def finalize_options(self):
     build_ext_base.finalize_options(self)
     from PyQt5.QtCore import PYQT_CONFIGURATION
     sip_flags = PYQT_CONFIGURATION.get('sip_flags', '')
     self.sip_opts += sip_flags.split(' ')
     pyqt_sip = os.path.join(pyqt_path, 'sip', 'PyQt5')
     self.sip_opts += ['-I%s' % pyqt_sip]
     default_sip = os.path.join(self._sip_sipfiles_dir(), 'PyQt5')
     self.sip_opts += ['-I%s' % default_sip]
Exemplo n.º 2
0
    def finalize_options(self):
        super().finalize_options()

        if not self.qt_include_dir:
            self.qt_include_dir = self.qtconfig.QT_INSTALL_HEADERS

        if not self.qt_libinfix:
            try:
                with open(
                        os.path.join(self.qtconfig.QT_INSTALL_PREFIX,
                                     'mkspecs', 'qconfig.pri'), 'r') as f:
                    for line in f.readlines():
                        if line.startswith('QT_LIBINFIX'):
                            self.qt_libinfix = line.split('=')[1].strip(
                                '\n').strip()
            except (FileNotFoundError, IndexError):
                pass

        if not self.pyqt_sip_dir:
            self.pyqt_sip_dir = os.path.join(self.pyconfig.data_dir, 'sip',
                                             'PyQt5')

        if not self.pyqt_sip_flags:
            self.pyqt_sip_flags = PYQT_CONFIGURATION.get('sip_flags', '')

        if not self.sip_files_dir:
            self.sip_files_dir = os.path.abspath(os.path.join(".", "sip"))

        if not self.sip_inc_dir:
            self.sip_inc_dir = self.pyconfig.venv_inc_dir

        if not self.module_inc_dir:
            self.module_inc_dir = self.pyconfig.module_inc_dir

        if not self.inc_dir:
            self.inc_dir = os.path.abspath(os.path.join(".", "src"))

        if not self.qt_include_dir:
            raise SystemExit('Could not find Qt5 headers. '
                             'Please specify via --qt-include-dir=')

        if not self.pyqt_sip_dir:
            raise SystemExit('Could not find PyQt SIP files. '
                             'Please specify containing directory via '
                             '--pyqt-sip-dir=')

        if not self.pyqt_sip_flags:
            raise SystemExit('Could not find PyQt SIP flags. '
                             'Please specify via --pyqt-sip-flags=')
Exemplo n.º 3
0
config = sipconfig.Configuration()

if config.platform == 'win32-g++':
    qt_path = 'C:\\Qt\\Qt5.5.1.mingw\\5.5\\mingw492_32'
elif config.platform == 'win32-msvc2010':
    qt_path = 'C:\\Qt\\Qt5.5.1.msvc2010\\5.5\\msvc2010'
else:
    raise 'Unknown platform: %s' % config.platform
print('QT_DIR: %s' % qt_path)

# Run SIP to generate the code.
if not os.path.exists(build_dir):
    os.makedirs(build_dir)
sip_cmd = ' '.join([
    config.sip_bin,
    PYQT_CONFIGURATION.get('sip_flags', ''),
    '-I', os.path.join(config.default_sip_dir, 'PyQt5'),
    '-c', build_dir,
    '-b', os.path.join(build_dir, build_file),
    'scilexerrest.sip',
])

print(sip_cmd)
os.system(sip_cmd)

# Create the Makefile.
makefile = sipconfig.SIPModuleMakefile(
    config, build_file,
    dir=build_dir,
)
Exemplo n.º 4
0
pyqtpath = os.path.dirname(PyQt5.__file__)
print('PyQt5 path: ', pyqtpath)

config.sip_bin = os.path.join(pyqtpath, 'sip.exe')
config.default_sip_dir = os.path.join(pyqtpath, 'sip')

sip_cmd = ' '.join([
    config.sip_bin,
    '-c',
    "build",
    '-b',
    "build/" + build_file,
    '-I',
    config.default_sip_dir + '/PyQt5',
    PYQT_CONFIGURATION.get('sip_flags', ''),
    '%s.sip' % moduleName,
])

os.makedirs('build', exist_ok=True)
print(sip_cmd)
os.system(sip_cmd)

# Create the Makefile.
makefile = sipconfig.SIPModuleMakefile(config, build_file, dir='build')

# 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).

# 添加头文件路径