Skip to content

Commit 6e19748

Browse files
committedAug 31, 2013
[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
1 parent b4002f8 commit 6e19748

File tree

4 files changed

+10
-39
lines changed

4 files changed

+10
-39
lines changed
 

‎CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@ IF (WITH_BINDINGS)
8686
SET (WITH_STAGED_PLUGINS TRUE CACHE BOOL "Stage-install core Python plugins to run from build directory? (utilities and console are always staged)")
8787
SET (WITH_PY_COMPILE FALSE CACHE BOOL "Determines whether Python modules in staged or installed locations are byte-compiled")
8888
# concatenate QScintilla2 API files
89-
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.")
89+
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.")
90+
# keep casual users from updating their source tree via WITH_QSCIAPI
91+
MARK_AS_ADVANCED (WITH_QSCIAPI)
9092
# path to custom Python framework on Mac
9193
IF (APPLE)
9294
SET (PYTHON_CUSTOM_FRAMEWORK "" CACHE PATH "Path to custom Python.framework on Mac. (should not have to specify other Python options)")

‎python/CMakeLists.txt

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -140,38 +140,21 @@ IF(WITH_QSCIAPI)
140140

141141
INSTALL(FILES ${QGIS_PYTHON_API_FILE} DESTINATION "${QGIS_DATA_DIR}/python/qsci_apis")
142142

143-
# create targets for generating console auto-completion *.pap binary file
144-
# these take too long to build (> 1 minute) for targets to have ALL property
143+
# create target for generating console auto-completion *.pap binary file
144+
# takes too long to build (> 1 minute) for targets to have ALL property
145145
SET(APIS_SRC_DIR "${CMAKE_SOURCE_DIR}/python/qsci_apis")
146146
SET(APIS_BIN_DIR "${CMAKE_BINARY_DIR}/python/qsci_apis")
147147

148-
# generate a local-only .pap file based upon current master branch,
149-
# which will override (but not replace) the default .pap from source
150-
# run before 'make install' to have the local-only .pap file included in the install;
151-
# console will use it when running from build directory, regardless of whether it is installed
152-
ADD_CUSTOM_TARGET(qsci-pap-master
153-
DEPENDS qsci-api ${QGIS_PYTHON_API_FILE})
154-
155-
SET(PAP_NAME "pyqgis-master.pap")
156-
ADD_CUSTOM_COMMAND(TARGET qsci-pap-master
157-
POST_BUILD
158-
COMMAND ${PYTHON_EXECUTABLE} "${APIS_SRC_DIR}/generate_console_pap.py" "${PAP_NAME}" "${APIS_SRC_DIR}" "${APIS_BIN_DIR}" "${APIS_BIN_DIR}"
159-
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
160-
COMMENT "Generating local-only ${PAP_NAME} for console auto-completion (MAY TAKE > 1 MINUTE!)" VERBATIM)
161-
162-
INSTALL(FILES "${APIS_BIN_DIR}/pyqgis-master.pap" DESTINATION "${QGIS_DATA_DIR}/python/qsci_apis")
163-
164148
# generate a .pap file to be immediately installed in QGIS source tree (the default .pap)
165149
ADD_CUSTOM_TARGET(qsci-pap-src
166150
DEPENDS qsci-api ${QGIS_PYTHON_API_FILE})
167151

168152
SET(PAP_NAME "pyqgis.pap")
169153
ADD_CUSTOM_COMMAND(TARGET qsci-pap-src
170154
POST_BUILD
171-
COMMAND ${PYTHON_EXECUTABLE} "${APIS_SRC_DIR}/generate_console_pap.py" "${PAP_NAME}" "${APIS_SRC_DIR}" "${APIS_BIN_DIR}" "${APIS_SRC_DIR}"
155+
COMMAND ${PYTHON_EXECUTABLE} "${APIS_SRC_DIR}/generate_console_pap.py" "${APIS_SRC_DIR}/${PAP_NAME}" "${APIS_SRC_DIR}" "${APIS_BIN_DIR}"
172156
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
173157
COMMENT "Generating ${PAP_NAME} for console auto-completion (MAY TAKE > 1 MINUTE!)" VERBATIM)
174-
175158
ENDIF(WITH_QSCIAPI)
176159

177160
# Plugin utilities files to copy to staging or install

‎python/console/console_sci.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -192,17 +192,7 @@ def setLexers(self):
192192
chekBoxAPI = self.settings.value("pythonConsole/preloadAPI", True, type=bool)
193193
chekBoxPreparedAPI = self.settings.value("pythonConsole/usePreparedAPIFile", False, type=bool)
194194
if chekBoxAPI:
195-
apisdir = os.path.join(QgsApplication.pkgDataPath(), "python", "qsci_apis")
196-
pap = os.path.join(apisdir, "pyqgis.pap")
197-
mpap = os.path.join(apisdir, "pyqgis-master.pap")
198-
if os.path.exists(mpap): # override installed with master .pap build
199-
pap = mpap
200-
if QgsApplication.isRunningFromBuildDir():
201-
bdir = os.path.dirname(QgsApplication.buildOutputPath())
202-
bpap = os.path.join(bdir, "python", "qsci_apis", "pyqgis-master.pap")
203-
if os.path.exists(bpap):
204-
# if not generated .pap exists, else fall back to preprepared one
205-
pap = bpap
195+
pap = os.path.join(QgsApplication.pkgDataPath(), "python", "qsci_apis", "pyqgis.pap")
206196
self.api.loadPrepared(pap)
207197
elif chekBoxPreparedAPI:
208198
self.api.loadPrepared(self.settings.value("pythonConsole/preparedAPIFile"))

‎python/qsci_apis/generate_console_pap.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,23 +69,19 @@ def prepareAPI(self):
6969

7070

7171
if __name__ == '__main__':
72-
if len(sys.argv) != 5:
73-
print 'Usage: python <script> <pap_name_w-ext> ' \
74-
'<apis_src_dir> <api_bin_dir> <output_dir>'
72+
if len(sys.argv) != 4:
73+
print 'Usage: python <script> <pap_file> <apis_src_dir> <api_bin_dir>'
7574
sys.exit(1)
76-
pap_name = sys.argv[1]
75+
pap_file = sys.argv[1]
7776
api_src_dir = sys.argv[2]
7877
api_bin_dir = sys.argv[3]
79-
output_dir = sys.argv[4]
8078

8179
api_files = [
8280
os.path.join(api_bin_dir, 'PyQGIS.api'),
8381
os.path.join(api_src_dir, 'Python-2.7.api'),
8482
os.path.join(api_src_dir, 'PyQt4-4.7.4.api'),
8583
os.path.join(api_src_dir, 'OSGeo_GDAL-OGR-1.9.1.api')
8684
]
87-
pap_file= os.path.join(output_dir, pap_name)
88-
8985
# print api_files.__repr__()
9086
# print pap_file.__repr__()
9187

0 commit comments

Comments
 (0)
Please sign in to comment.