Skip to content

Commit 1d51497

Browse files
author
jef
committed
remove tons of pyuic4, pyrcc4 generated files and create them when building (apply #1877)
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@11401 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 5162df6 commit 1d51497

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+134
-14618
lines changed

cmake/Python.cmake

+49
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,55 @@
77
FIND_PACKAGE(PythonLibs) # MapServer export tool
88
FIND_PACKAGE(PythonInterp) # test for sip and PyQt4
99

10+
FIND_PROGRAM(PYUIC4_PROGRAM pyuic4)
11+
12+
IF(${PYUIC4_PROGRAM} STREQUAL "PYUIC4_PROGRAM-NOTFOUND")
13+
MESSAGE(ERROR "pyuic4 is required")
14+
ENDIF(${PYUIC4_PROGRAM} STREQUAL "PYUIC4_PROGRAM-NOTFOUND")
15+
16+
# Adapted from QT4_WRAP_UI
17+
MACRO(PYQT4_WRAP_UI outfiles )
18+
FOREACH(it ${ARGN})
19+
GET_FILENAME_COMPONENT(outfile ${it} NAME_WE)
20+
GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE)
21+
SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/ui_${outfile}.py)
22+
ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
23+
COMMAND ${PYUIC4_PROGRAM} ${infile} -o ${outfile}
24+
MAIN_DEPENDENCY ${infile}
25+
)
26+
SET(${outfiles} ${${outfiles}} ${outfile})
27+
ENDFOREACH(it)
28+
ENDMACRO(PYQT4_WRAP_UI)
29+
30+
FIND_PROGRAM(PYRCC4_PROGRAM pyrcc4)
31+
32+
# Adapted from QT4_ADD_RESOURCES
33+
MACRO (PYQT4_ADD_RESOURCES outfiles )
34+
FOREACH (it ${ARGN})
35+
GET_FILENAME_COMPONENT(outfile ${it} NAME_WE)
36+
GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE)
37+
GET_FILENAME_COMPONENT(rc_path ${infile} PATH)
38+
SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/${outfile}_rc.py)
39+
# parse file for dependencies
40+
# all files are absolute paths or relative to the location of the qrc file
41+
FILE(READ "${infile}" _RC_FILE_CONTENTS)
42+
STRING(REGEX MATCHALL "<file[^<]+" _RC_FILES "${_RC_FILE_CONTENTS}")
43+
SET(_RC_DEPENDS)
44+
FOREACH(_RC_FILE ${_RC_FILES})
45+
STRING(REGEX REPLACE "^<file[^>]*>" "" _RC_FILE "${_RC_FILE}")
46+
STRING(REGEX MATCH "^/|([A-Za-z]:/)" _ABS_PATH_INDICATOR "${_RC_FILE}")
47+
IF(NOT _ABS_PATH_INDICATOR)
48+
SET(_RC_FILE "${rc_path}/${_RC_FILE}")
49+
ENDIF(NOT _ABS_PATH_INDICATOR)
50+
SET(_RC_DEPENDS ${_RC_DEPENDS} "${_RC_FILE}")
51+
ENDFOREACH(_RC_FILE)
52+
ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
53+
COMMAND ${PYRCC4_PROGRAM} -name ${outfile} -o ${outfile} ${infile}
54+
MAIN_DEPENDENCY ${infile}
55+
DEPENDS ${_RC_DEPENDS})
56+
SET(${outfiles} ${${outfiles}} ${outfile})
57+
ENDFOREACH (it)
58+
ENDMACRO (PYQT4_ADD_RESOURCES)
1059

1160
MACRO (TRY_RUN_PYTHON RESULT CMD)
1261
IF (PYTHONINTERP_FOUND)

python/plugins/fTools/CMakeLists.txt

+10-13
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1-
#TODO: Need to configure cmake to run pyrcc4 and pyuic4 as required when the resource
2-
# file or the ui change
3-
SET(INSTALLER_FILES
4-
__init__.py
5-
frmAbout.py
6-
ftools_help.xsl
7-
resources.qrc
8-
frmAbout.ui
9-
fTools.py
10-
doAbout.py
11-
ftools_help.xml
12-
resources.py
13-
)
1+
FILE(GLOB INSTALLER_FILES *.py)
2+
SET(INSTALLER_FILES ${INSTALLER_FILES} ftools_help.xsl ftools_help.xml)
3+
4+
FILE(GLOB UI_FILES *.ui)
5+
PYQT4_WRAP_UI(PYUI_FILES ${UI_FILES})
6+
PYQT4_ADD_RESOURCES(PYRC_FILES resources.qrc)
7+
ADD_CUSTOM_TARGET(ftools ALL DEPENDS ${PYUI_FILES} ${PYRC_FILES})
8+
9+
SET(INSTALLER_FILES ${INSTALLER_FILES} ${PYUI_FILES} ${PYRC_FILES})
10+
1411
INSTALL(FILES ${INSTALLER_FILES} DESTINATION ${QGIS_DATA_DIR}/python/plugins/fTools)
1512

1613
SUBDIRS(tools icons)

python/plugins/fTools/doAbout.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919

2020
from qgis.core import *
2121
import webbrowser, os
22-
from frmAbout import Ui_Dialog
23-
import resources
22+
from ui_frmAbout import Ui_Dialog
23+
import resources_rc
2424
currentPath = os.path.dirname(__file__)
2525

2626
class Dialog(QDialog, Ui_Dialog):

python/plugins/fTools/fTools.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,8 @@
3232

3333
from PyQt4.QtCore import *
3434
from PyQt4.QtGui import *
35-
import resources
3635
from qgis.core import *
37-
import resources
36+
import resources_rc
3837
import os.path, sys
3938
# Set up current path, so that we know where to look for mudules
4039
currentPath = os.path.dirname( __file__ )

python/plugins/fTools/frmAbout.py

-92
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,2 @@
1-
#TODO: Need to configure cmake to run pyrcc4 and pyuic4 as required when the resource
2-
# file or the ui change
3-
SET(ICON_FILES
4-
analysis.png
5-
geometry.png
6-
sampling.png
7-
basic_statistics.png
8-
geoprocessing.png
9-
select_location.png
10-
buffer.png
11-
help.png
12-
simplify.png
13-
centroids.png
14-
intersections.png
15-
single_to_multi.png
16-
check_geometry.png
17-
intersect.png
18-
split_layer.png
19-
clip.png
20-
join_attributes.png
21-
sub_selection.png
22-
convex_hull.png
23-
join_location.png
24-
sum_lines.png
25-
define_projection.png
26-
management.png
27-
sum_points.png
28-
difference.png
29-
matrix.png
30-
sym_difference.png
31-
dissolve.png
32-
mean.png
33-
to_lines.png
34-
export_geometry.png
35-
multi_to_single.png
36-
union.png
37-
export_projection.png
38-
neighbour.png
39-
unique.png
40-
extract_nodes.png
41-
random_points.png
42-
vector_grid.png
43-
random_selection.png
44-
ftools_logo.png
45-
regular_points.png
46-
delaunay.png
47-
layer_extent.png
48-
)
1+
FILE(GLOB ICON_FILES *.png)
492
INSTALL(FILES ${ICON_FILES} DESTINATION ${QGIS_DATA_DIR}/python/plugins/fTools/icons/gis)
-781 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)