[pyqgis-console] Fix build error. Revert adding of qsci-pap-master target

- Leave only qsci-pap-src target for updating default pyqgis.pap in source tree
- Mark WITH_QSCIAPI as advanced in CMake, since it mostly a dev function
This commit is contained in:
Larry Shaffer 2013-08-31 14:04:51 -06:00
parent b4002f8784
commit 6e197484ed
4 changed files with 10 additions and 39 deletions

View File

@ -86,7 +86,9 @@ IF (WITH_BINDINGS)
SET (WITH_STAGED_PLUGINS TRUE CACHE BOOL "Stage-install core Python plugins to run from build directory? (utilities and console are always staged)")
SET (WITH_PY_COMPILE FALSE CACHE BOOL "Determines whether Python modules in staged or installed locations are byte-compiled")
# concatenate QScintilla2 API files
SET (WITH_QSCIAPI TRUE CACHE BOOL "Whether to generate PyQGIS QScintilla2 API file. Run 'make qsci-pap-master or qsci-pap-src' in between QGIS build and install, to generate .pap file for console auto-completion.")
SET (WITH_QSCIAPI TRUE CACHE BOOL "Whether to generate PyQGIS QScintilla2 API file. (For devs) run 'make qsci-pap-src' in between QGIS build and install to regenerate .pap file in source tree for console auto-completion.")
# keep casual users from updating their source tree via WITH_QSCIAPI
MARK_AS_ADVANCED (WITH_QSCIAPI)
# path to custom Python framework on Mac
IF (APPLE)
SET (PYTHON_CUSTOM_FRAMEWORK "" CACHE PATH "Path to custom Python.framework on Mac. (should not have to specify other Python options)")

View File

@ -140,27 +140,11 @@ IF(WITH_QSCIAPI)
INSTALL(FILES ${QGIS_PYTHON_API_FILE} DESTINATION "${QGIS_DATA_DIR}/python/qsci_apis")
# create targets for generating console auto-completion *.pap binary file
# these take too long to build (> 1 minute) for targets to have ALL property
# create target for generating console auto-completion *.pap binary file
# takes too long to build (> 1 minute) for targets to have ALL property
SET(APIS_SRC_DIR "${CMAKE_SOURCE_DIR}/python/qsci_apis")
SET(APIS_BIN_DIR "${CMAKE_BINARY_DIR}/python/qsci_apis")
# generate a local-only .pap file based upon current master branch,
# which will override (but not replace) the default .pap from source
# run before 'make install' to have the local-only .pap file included in the install;
# console will use it when running from build directory, regardless of whether it is installed
ADD_CUSTOM_TARGET(qsci-pap-master
DEPENDS qsci-api ${QGIS_PYTHON_API_FILE})
SET(PAP_NAME "pyqgis-master.pap")
ADD_CUSTOM_COMMAND(TARGET qsci-pap-master
POST_BUILD
COMMAND ${PYTHON_EXECUTABLE} "${APIS_SRC_DIR}/generate_console_pap.py" "${PAP_NAME}" "${APIS_SRC_DIR}" "${APIS_BIN_DIR}" "${APIS_BIN_DIR}"
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
COMMENT "Generating local-only ${PAP_NAME} for console auto-completion (MAY TAKE > 1 MINUTE!)" VERBATIM)
INSTALL(FILES "${APIS_BIN_DIR}/pyqgis-master.pap" DESTINATION "${QGIS_DATA_DIR}/python/qsci_apis")
# generate a .pap file to be immediately installed in QGIS source tree (the default .pap)
ADD_CUSTOM_TARGET(qsci-pap-src
DEPENDS qsci-api ${QGIS_PYTHON_API_FILE})
@ -168,10 +152,9 @@ IF(WITH_QSCIAPI)
SET(PAP_NAME "pyqgis.pap")
ADD_CUSTOM_COMMAND(TARGET qsci-pap-src
POST_BUILD
COMMAND ${PYTHON_EXECUTABLE} "${APIS_SRC_DIR}/generate_console_pap.py" "${PAP_NAME}" "${APIS_SRC_DIR}" "${APIS_BIN_DIR}" "${APIS_SRC_DIR}"
COMMAND ${PYTHON_EXECUTABLE} "${APIS_SRC_DIR}/generate_console_pap.py" "${APIS_SRC_DIR}/${PAP_NAME}" "${APIS_SRC_DIR}" "${APIS_BIN_DIR}"
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
COMMENT "Generating ${PAP_NAME} for console auto-completion (MAY TAKE > 1 MINUTE!)" VERBATIM)
ENDIF(WITH_QSCIAPI)
# Plugin utilities files to copy to staging or install

View File

@ -192,17 +192,7 @@ class ShellScintilla(QsciScintilla, code.InteractiveInterpreter):
chekBoxAPI = self.settings.value("pythonConsole/preloadAPI", True, type=bool)
chekBoxPreparedAPI = self.settings.value("pythonConsole/usePreparedAPIFile", False, type=bool)
if chekBoxAPI:
apisdir = os.path.join(QgsApplication.pkgDataPath(), "python", "qsci_apis")
pap = os.path.join(apisdir, "pyqgis.pap")
mpap = os.path.join(apisdir, "pyqgis-master.pap")
if os.path.exists(mpap): # override installed with master .pap build
pap = mpap
if QgsApplication.isRunningFromBuildDir():
bdir = os.path.dirname(QgsApplication.buildOutputPath())
bpap = os.path.join(bdir, "python", "qsci_apis", "pyqgis-master.pap")
if os.path.exists(bpap):
# if not generated .pap exists, else fall back to preprepared one
pap = bpap
pap = os.path.join(QgsApplication.pkgDataPath(), "python", "qsci_apis", "pyqgis.pap")
self.api.loadPrepared(pap)
elif chekBoxPreparedAPI:
self.api.loadPrepared(self.settings.value("pythonConsole/preparedAPIFile"))

View File

@ -69,14 +69,12 @@ class PrepareAPIs(QObject):
if __name__ == '__main__':
if len(sys.argv) != 5:
print 'Usage: python <script> <pap_name_w-ext> ' \
'<apis_src_dir> <api_bin_dir> <output_dir>'
if len(sys.argv) != 4:
print 'Usage: python <script> <pap_file> <apis_src_dir> <api_bin_dir>'
sys.exit(1)
pap_name = sys.argv[1]
pap_file = sys.argv[1]
api_src_dir = sys.argv[2]
api_bin_dir = sys.argv[3]
output_dir = sys.argv[4]
api_files = [
os.path.join(api_bin_dir, 'PyQGIS.api'),
@ -84,8 +82,6 @@ if __name__ == '__main__':
os.path.join(api_src_dir, 'PyQt4-4.7.4.api'),
os.path.join(api_src_dir, 'OSGeo_GDAL-OGR-1.9.1.api')
]
pap_file= os.path.join(output_dir, pap_name)
# print api_files.__repr__()
# print pap_file.__repr__()