From 8c1bb32d0fc980ff296e3f604fccf43fcbb53008 Mon Sep 17 00:00:00 2001 From: Neil Date: Fri, 12 Nov 2021 14:25:28 +1100 Subject: Remove ScintillaEditPy as its prerequisites are unsupported. --- qt/ScintillaEditPy/README | 87 ------ qt/ScintillaEditPy/ScintillaConstants.py.template | 6 - qt/ScintillaEditPy/ScintillaEditPy.pro | 128 -------- qt/ScintillaEditPy/global.h | 4 - qt/ScintillaEditPy/sepbuild.py | 345 --------------------- qt/ScintillaEditPy/testsepq.py | 157 ---------- .../typesystem_ScintillaEdit.xml.template | 65 ---- 7 files changed, 792 deletions(-) delete mode 100644 qt/ScintillaEditPy/README delete mode 100644 qt/ScintillaEditPy/ScintillaConstants.py.template delete mode 100644 qt/ScintillaEditPy/ScintillaEditPy.pro delete mode 100644 qt/ScintillaEditPy/global.h delete mode 100644 qt/ScintillaEditPy/sepbuild.py delete mode 100644 qt/ScintillaEditPy/testsepq.py delete mode 100644 qt/ScintillaEditPy/typesystem_ScintillaEdit.xml.template (limited to 'qt/ScintillaEditPy') diff --git a/qt/ScintillaEditPy/README b/qt/ScintillaEditPy/README deleted file mode 100644 index d0c653d20..000000000 --- a/qt/ScintillaEditPy/README +++ /dev/null @@ -1,87 +0,0 @@ -README for building of ScintillaEditPy on Qt with PySide - -This directory is for building a Python encapsulation of Scintilla for use -with PySide. For C++ libraries see the README in the parent directory. - - Prerequisites - -PySide and ScintillaEditPy currently only support Python 2.x. - -CMake may be used to rebuild PySide and is required on Windows. -It can be downloaded from -http://www.cmake.org/cmake/resources/software.html - -On Windows, PySide only supports Visual C++ 2008. The "Visual Studio 2008 -Command Prompt" should be used to run all build commands. -Visual C++ 2008 Express Edition can be downloaded from -http://msdn.microsoft.com/en-us/express/future/bb421473 - -Download and install PySide. Instructions are on the PySide web site -http://developer.qt.nokia.com/wiki/Category:LanguageBindings::PySide::Downloads - -For Linux, there may be both PySide library packages and PySide development -files. Both should be installed as ScintillaEditPy needs the headers and -libraries from the development package and runs with the normal library package. -On apt-based systems, the packages are libshiboken-dev, shiboken, libpyside-dev, -and python-pyside. python-dev is also needed for Python language headers. -On yum-based systems the packages are shiboken-devel, python-pyside-devel, -and python-devel. -The qmake program may be called qmake-qt5 or qmake-qt4. -It can be found with: -which qmake-qt5 || which qmake-qt4 || which qmake - -On Windows, the PySide library packages can be downloaded from -http://developer.qt.nokia.com/wiki/PySide_Binaries_Windows -The PySide development files must be built from source using CMake as -described on the PySide site. This will create a Unix-style set of [bin, include, -lib, and share] directories in packaging\setuptools\install-py-qt. -There is no standard place for the PySide development files so copy them -to "\usr", creating it if needed. - -On OS X, a combined package with PySide libraries and PySide development -files can be downloaded from -http://developer.qt.nokia.com/wiki/PySide_Binaries_MacOSX -This package works best in combination with the Qt libraries for Mac from -http://qt.nokia.com/downloads/downloads#qt-lib - -The path should be modified so that a Python 2.x interpreter and Qt's "qmake" -program can be run by typing "python" or "qmake". - - Building - -There are several steps to building and they are encapsulated in the sepbuild.py -script which is run: - -python sepbuild.py - -This script first runs the WidgetGen.py script to fill out the ScintillaEdit.h, -ScintillaEdit.cpp and ScintillaConstants.py files. - -A short file "sepbuild.pri" is written out which contains a series of version and -path properties discovered by sepbuild.py which are used by qmake. - -Then it runs PySide's "shiboken" program to create C++ code that will act as a -bridge between Python and the C++ libraries. This code goes into the -ScintillaEditPy/ScintillaEditPy directory. Several log files are produced which can -help uncover problems in the bridge if it fails to build. - -The qmake program is run to produce make files from ScintillaEditPy.pro. - -The system make program is then run to build the library. The library is located in -the scintilla/bin directory as ScintillaEditPy.so for Unix systems and -ScintillaEditPy.pyd for Windows. - -A demonstration program can be run: - -python testsepq.py - -The individual steps in the script can be run manually if wanted although the -shiboken program has complex arguments and differs between systems so run -sepbuild.py and copy the section starting with a line containing "generatorrunner" -and continuing to "typesystem_ScintillaEdit.xml". - -On Windows, it is more difficult to set up an environment to debug ScintillaEditPy -since all the libraries have to be debug or all have to be release. The easy path -is to always build for release with "nmake release". - -To remove generated code, run "python sepbuild.py --clean". diff --git a/qt/ScintillaEditPy/ScintillaConstants.py.template b/qt/ScintillaEditPy/ScintillaConstants.py.template deleted file mode 100644 index 31b82398d..000000000 --- a/qt/ScintillaEditPy/ScintillaConstants.py.template +++ /dev/null @@ -1,6 +0,0 @@ -# ScintillaConstants.py -# Define all the symbolic constants from Scintilla.iface so Python code can use them -# Copyright (c) 2011 Archaeopteryx Software, Inc. d/b/a Wingware - -# ++Autogenerated -- start of section automatically generated from Scintilla.iface */ -# --Autogenerated -- end of section automatically generated from Scintilla.iface */ diff --git a/qt/ScintillaEditPy/ScintillaEditPy.pro b/qt/ScintillaEditPy/ScintillaEditPy.pro deleted file mode 100644 index 96f3ae8e7..000000000 --- a/qt/ScintillaEditPy/ScintillaEditPy.pro +++ /dev/null @@ -1,128 +0,0 @@ -TEMPLATE = lib -QT += core gui -greaterThan(QT_MAJOR_VERSION, 4): QT += widgets - -TARGET = ScintillaEditPy - -# Clear debug & release so that sepbuild.pri can set one or the other -CONFIG -= debug release -CONFIG += c++1z - -include(sepbuild.pri) - -VERSION = $$SCINTILLA_VERSION - -win32 { - DebugBuild { - TARGET_EXT = _d.pyd - } - else { - TARGET_EXT = .pyd - } -} - -INCLUDEPATH += ../ScintillaEdit -INCLUDEPATH += ../ScintillaEditBase -INCLUDEPATH += ../../include ../../lexlib ../../src - -INCLUDEPATH += $$PY_INCLUDES - -INCLUDEPATH += $$SHIBOKEN_INCLUDES -INCLUDEPATH += $$PYSIDE_INCLUDES -INCLUDEPATH += $$PYSIDE_INCLUDES/QtCore -INCLUDEPATH += $$PYSIDE_INCLUDES/QtGui - -unix:!mac { - LIBS += `pkg-config pyside --libs` -} -unix:linux-* { - # gcc on freebsd 9.2, at least, doesn't support -Wno-empty-body - # g++ 7.x has deprecated std::auto_ptr but that is used by code generated by Shiboken so - # turn off warning. - QMAKE_CXXFLAGS += -Wno-register -Wno-unused-parameter -Wno-empty-body -Wno-deprecated-declarations -Wno-deprecated-copy --std=gnu++17 - LIBS += -ldl -} - -macx { - # Only build for x64 for now - # QMAKE_CFLAGS = -arch i386 -arch x86_64 - # QMAKE_CXXFLAGS = -arch i386 -arch x86_64 - # QMAKE_LFLAGS = -arch i386 -arch x86_64 - LIBS += -L$$PY_LIBDIR -lpython$$PY_VERSION_SUFFIX - LIBS += -L$$PYSIDE_LIB -L$$SHIBOKEN_LIB - debug { - LIBS += -lshiboken-python$$PY_VERSION_SUFFIX-dbg - LIBS += -lpyside-python$$PY_VERSION_SUFFIX-dbg - } - else { - LIBS += -lshiboken-python$$PY_VERSION_SUFFIX - LIBS += -lpyside-python$$PY_VERSION_SUFFIX - } -} - -win32 { - DebugBuild { - DEFINES += DEBUG - LIBS += -lQtCored4 - } - else { - LIBS += -lQtCore - } - LIBS += -L$$PY_PREFIX/libs # Note python lib is pulled in via a #pragma - LIBS += -L$$PYSIDE_LIB -L$$SHIBOKEN_LIB - # PySide uses x.y suffix on Windows even though Python uses xy - DebugBuild { - LIBS += -lshiboken-python$${PY_VERSION}_d - LIBS += -lpyside-python$${PY_VERSION}_d - } - else { - LIBS += -lshiboken-python$${PY_VERSION} - LIBS += -lpyside-python$${PY_VERSION} - } -} - -# Wrapper sources; notifyheader commented out due to shiboken bug -SOURCES += \ - ScintillaEditPy/scintillaeditpy_module_wrapper.cpp \ - ScintillaEditPy/sci_notifyheader_wrapper.cpp \ - ScintillaEditPy/scnotification_wrapper.cpp \ - ScintillaEditPy/scintillaeditbase_wrapper.cpp \ - ScintillaEditPy/scintillaedit_wrapper.cpp \ - ScintillaEditPy/scintilladocument_wrapper.cpp - -# ScintillaEdit sources - -SOURCES += \ - ../ScintillaEdit/ScintillaEdit.cpp \ - ../ScintillaEdit/ScintillaDocument.cpp \ - ../ScintillaEditBase/PlatQt.cpp \ - ../ScintillaEditBase/ScintillaQt.cpp \ - ../ScintillaEditBase/ScintillaEditBase.cpp \ - $$files(../../src/*.cxx, false) \ - $$files(../../lexlib/*.cxx, false) \ - $$files(../../lexers/*.cxx, false) - - -# HEADERS is used to find what needs to be run through moc -HEADERS += \ - ../ScintillaEdit/ScintillaEdit.h \ - ../ScintillaEdit/ScintillaDocument.h \ - ../ScintillaEditBase/ScintillaQt.h \ - ../ScintillaEditBase/ScintillaEditBase.h - -DEFINES += SCINTILLA_QT=1 MAKING_LIBRARY=1 _CRT_SECURE_NO_DEPRECATE=1 -CONFIG(release, debug|release) { - DEFINES += NDEBUG=1 -} - -DESTDIR = ../../bin - -unix:!mac { - # Rename to not have 'lib' at start - QMAKE_POST_LINK += rm -rf ../../bin/ScintillaEditPy.so && ln -s libScintillaEditPy.so ../../bin/ScintillaEditPy.so -} - -macx { - # Rename to .so and not have 'lib' at start - QMAKE_POST_LINK += rm -rf ../../bin/ScintillaEditPy.so && ln -s libScintillaEditPy.dylib ../../bin/ScintillaEditPy.so -} diff --git a/qt/ScintillaEditPy/global.h b/qt/ScintillaEditPy/global.h deleted file mode 100644 index 8b4be843a..000000000 --- a/qt/ScintillaEditPy/global.h +++ /dev/null @@ -1,4 +0,0 @@ -#include "pyside_global.h" - -#include "ScintillaEditBase.h" -#include "ScintillaEdit.h" diff --git a/qt/ScintillaEditPy/sepbuild.py b/qt/ScintillaEditPy/sepbuild.py deleted file mode 100644 index 7eae634d9..000000000 --- a/qt/ScintillaEditPy/sepbuild.py +++ /dev/null @@ -1,345 +0,0 @@ -#!/usr/bin/env python2 -import distutils.sysconfig -import getopt -import glob -import os -import platform -import shutil -import subprocess -import stat -import sys - -# ScintillaEditPy can only be built against Python 2.x so fail if Python 3.x -assert sys.version_info < (3,0), "sepbuild.py requires Python 2.x" - -sys.path.append(os.path.join("..", "ScintillaEdit")) -import WidgetGen - -scintillaDirectory = "../.." -scintillaScriptsDirectory = os.path.join(scintillaDirectory, "scripts") -sys.path.append(scintillaScriptsDirectory) -from FileGenerator import GenerateFile - -# Decide up front which platform, treat anything other than Windows or OS X as Linux -PLAT_WINDOWS = platform.system() == "Windows" -PLAT_DARWIN = platform.system() == "Darwin" -PLAT_LINUX = not (PLAT_DARWIN or PLAT_WINDOWS) - -def IsFileNewer(name1, name2): - """ Returns whether file with name1 is newer than file with name2. Returns 1 - if name2 doesn't exist. """ - - if not os.path.exists(name1): - return 0 - - if not os.path.exists(name2): - return 1 - - mod_time1 = os.stat(name1)[stat.ST_MTIME] - mod_time2 = os.stat(name2)[stat.ST_MTIME] - return (mod_time1 > mod_time2) - -def textFromRun(args): - proc = subprocess.Popen(args, shell=isinstance(args, str), stdout=subprocess.PIPE) - (stdoutdata, stderrdata) = proc.communicate() - if proc.returncode: - print("Warning - failed to run '" + " ".join(args) + "'") - raise OSError(proc.returncode) - return stdoutdata - -def runProgram(args, exitOnFailure): - print(" ".join(args)) - retcode = subprocess.call(" ".join(args), shell=True, stderr=subprocess.STDOUT) - if retcode: - print("Failed in " + " ".join(args) + " return code = " + str(retcode)) - if exitOnFailure: - sys.exit() - -def usage(): - print("sepbuild.py [-h|--help][-c|--clean][-u|--underscore-names]") - print("") - print("Generate PySide wappers and build them.") - print("") - print("options:") - print("") - print("-c --clean remove all object and generated files") - print("-b --pyside-base Location of the PySide+Qt4 sandbox to use") - print("-h --help display this text") - print("-d --debug=yes|no force debug build (or non-debug build)") - print("-u --underscore-names use method_names consistent with GTK+ standards") - -modifyFunctionElement = """ %s - """ - -injectCode = """ - %s - """ - -injectCheckN = """ - if (!cppArg%d) { - PyErr_SetString(PyExc_ValueError, "Null string argument"); - return 0; - }""" - -def methodSignature(name, v, options): - argTypes = "" - p1Type = WidgetGen.cppAlias(v["Param1Type"]) - if p1Type == "int": - p1Type = "sptr_t" - if p1Type: - argTypes = argTypes + p1Type - p2Type = WidgetGen.cppAlias(v["Param2Type"]) - if p2Type == "int": - p2Type = "sptr_t" - if p2Type and v["Param2Type"] != "stringresult": - if p1Type: - argTypes = argTypes + ", " - argTypes = argTypes + p2Type - methodName = WidgetGen.normalisedName(name, options, v["FeatureType"]) - constDeclarator = " const" if v["FeatureType"] == "get" else "" - return methodName + "(" + argTypes + ")" + constDeclarator - -def printTypeSystemFile(f, options): - out = [] - for name in f.order: - v = f.features[name] - if v["Category"] != "Deprecated": - feat = v["FeatureType"] - if feat in ["fun", "get", "set"]: - checks = "" - if v["Param1Type"] == "string": - checks = checks + (injectCheckN % 0) - if v["Param2Type"] == "string": - if v["Param1Type"] == "": # Only arg 2 -> treat as first - checks = checks + (injectCheckN % 0) - else: - checks = checks + (injectCheckN % 1) - if checks: - inject = injectCode % checks - out.append(modifyFunctionElement % (methodSignature(name, v, options), inject)) - #if v["Param1Type"] == "string": - # out.append("" + name + "\n") - return out - -def doubleBackSlashes(s): - # Quote backslashes so qmake does not produce warnings - return s.replace("\\", "\\\\") - -class SepBuilder: - def __init__(self): - # Discover configuration parameters - self.ScintillaEditIncludes = [".", "../ScintillaEdit", "../ScintillaEditBase", "../../include"] - if PLAT_WINDOWS: - self.MakeCommand = "nmake" - self.MakeTarget = "release" - else: - self.MakeCommand = "make" - self.MakeTarget = "" - - if PLAT_DARWIN: - self.QMakeOptions = "-spec macx-g++" - else: - self.QMakeOptions = "" - - # Default to debug build if running in a debug build interpreter - self.DebugBuild = hasattr(sys, 'getobjects') - - # Python - self.PyVersion = "%d.%d" % sys.version_info[:2] - self.PyVersionSuffix = distutils.sysconfig.get_config_var("VERSION") - self.PyIncludes = distutils.sysconfig.get_python_inc() - self.PyPrefix = distutils.sysconfig.get_config_var("prefix") - self.PyLibDir = distutils.sysconfig.get_config_var( - ("LIBDEST" if sys.platform == 'win32' else "LIBDIR")) - - # Scintilla - with open("../../version.txt") as f: - version = f.read() - self.ScintillaVersion = version[0] + '.' + version[1] + '.' + version[2] - - # Find out what qmake is called - self.QMakeCommand = "qmake" - if not PLAT_WINDOWS: - # On Unix qmake may not be present but qmake-qt4 may be so check - pathToQMake = textFromRun("which qmake-qt4 || which qmake").rstrip() - self.QMakeCommand = os.path.basename(pathToQMake) - - # Qt default location from qmake - self._SetQtIncludeBase(textFromRun(self.QMakeCommand + " -query QT_INSTALL_HEADERS").rstrip()) - - # PySide default location - # No standard for installing PySide development headers and libs on Windows so - # choose /usr to be like Linux - self._setPySideBase('\\usr' if PLAT_WINDOWS else '/usr') - - self.ProInclude = "sepbuild.pri" - - self.qtStyleInterface = True - - def _setPySideBase(self, base): - - self.PySideBase = base - def _try_pkgconfig(var, package, *relpath): - try: - return textFromRun(["pkg-config", "--variable=" + var, package]).rstrip() - except OSError: - return os.path.join(self.PySideBase, *relpath) - self.PySideTypeSystem = _try_pkgconfig("typesystemdir", "pyside", - "share", "PySide", "typesystems") - self.PySideIncludeBase = _try_pkgconfig("includedir", "pyside", - "include", "PySide") - self.ShibokenIncludeBase = _try_pkgconfig("includedir", "shiboken", - "include", "shiboken") - self.PySideIncludes = [ - self.ShibokenIncludeBase, - self.PySideIncludeBase, - os.path.join(self.PySideIncludeBase, "QtCore"), - os.path.join(self.PySideIncludeBase, "QtGui")] - - self.PySideLibDir = _try_pkgconfig("libdir", "pyside", "lib") - self.ShibokenLibDir = _try_pkgconfig("libdir", "shiboken", "lib") - self.AllIncludes = os.pathsep.join(self.QtIncludes + self.ScintillaEditIncludes + self.PySideIncludes) - - self.ShibokenGenerator = "shiboken" - # Is this still needed? It doesn't work with latest shiboken sources - #if PLAT_DARWIN: - # # On OS X, can not automatically find Shiboken dylib so provide a full path - # self.ShibokenGenerator = os.path.join(self.PySideLibDir, "generatorrunner", "shiboken") - - def generateAPI(self, args): - os.chdir(os.path.join("..", "ScintillaEdit")) - if not self.qtStyleInterface: - args.insert(0, '--underscore-names') - WidgetGen.main(args) - f = WidgetGen.readInterface(False) - os.chdir(os.path.join("..", "ScintillaEditPy")) - options = {"qtStyle": self.qtStyleInterface} - GenerateFile("typesystem_ScintillaEdit.xml.template", "typesystem_ScintillaEdit.xml", - " - - - - - - int margin = PyInt_AsLong(%PYARG_1); - if (margin == -1 && PyErr_Occurred()) - return NULL; - unsigned long mask = PyInt_AsUnsignedLongMask(%PYARG_2); - if (margin == -1 && PyErr_Occurred()) - return NULL; - - %CPPSELF->set_margin_mask_n(margin, static_cast<int>(mask)); - Py_RETURN_NONE; - - - - - int margin = PyInt_AsLong(%PYARG_1); - if (margin == -1 && PyErr_Occurred()) - return NULL; - unsigned int mask = (unsigned int)%CPPSELF->get_margin_mask_n(margin); - %PYARG_0 = PyInt_FromSize_t(mask); - - - - - int margin = PyInt_AsLong(%PYARG_1); - if (margin == -1 && PyErr_Occurred()) - return NULL; - unsigned long mask = PyInt_AsUnsignedLongMask(%PYARG_2); - if (margin == -1 && PyErr_Occurred()) - return NULL; - - %CPPSELF->setMarginMaskN(margin, static_cast<int>(mask)); - Py_RETURN_NONE; - - - - - int margin = PyInt_AsLong(%PYARG_1); - if (margin == -1 && PyErr_Occurred()) - return NULL; - unsigned int mask = (unsigned int)%CPPSELF->marginMaskN(margin); - %PYARG_0 = PyInt_FromSize_t(mask); - - - - - - -- cgit v1.2.3