Skip to content

Commit

Permalink
concatenate auto_additions files with python module __init__.py.in
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Jun 3, 2018
1 parent e5b02cd commit 1fb02e8
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions python/CMakeLists.txt
Expand Up @@ -328,14 +328,13 @@ FOREACH(module ${PY_MODULES})
ADD_CUSTOM_TARGET(py${module} ALL)
ADD_DEPENDENCIES(py${module} python_module_qgis__${module})


# concat auto_additions/*.py in _module_/__init__.py
FILE(GLOB PY_FILES_AUTO_ADDITIONS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${module}/auto_additions/*.py)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${module}/__init__.py.in ${QGIS_PYTHON_OUTPUT_DIRECTORY}/${module}/__init__.py COPYONLY)
FOREACH(pyfile ${PY_FILES_AUTO_ADDITIONS})
file(READ ${IN_FILE} CONTENTS)
file(APPEND ${OUT_FILE} "${CONTENTS}")
file(READ ${pyfile} CONTENTS)
file(APPEND ${QGIS_PYTHON_OUTPUT_DIRECTORY}/${module}/__init__.py "${CONTENTS}")
ENDFOREACH(pyfile)
configure_file(somefile.sql.in somefile.sql COPYONLY)

FILE(GLOB PY_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${module}/*.py)
INSTALL(FILES ${PY_FILES} DESTINATION "${QGIS_PYTHON_DIR}/${module}")
Expand Down

6 comments on commit 1fb02e8

@nirvn
Copy link
Contributor

@nirvn nirvn commented on 1fb02e8 Jun 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@3nids , I suspect this change broke QGIS when running from the install directory.

After cleaning my install directory, and running make install, a bunch of python components are missing (gui, analysis, etc.).

@DelazJ
Copy link
Contributor

@DelazJ DelazJ commented on 1fb02e8 Jun 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would that be the reason why master in osgeo4w does not have Python since this week-end (reported on gitter)?

Couldn't load QGIS utils.
Python support will be disabled.

Traceback (most recent call last):
File "", line 1, in
File "C:/OSGEO4~1/apps/qgis-dev/./python\qgis\utils.py", line 33, in
from qgis.core import Qgis, QgsExpression, QgsMessageLog, qgsfunction, QgsMessageOutput, QgsWkbTypes
ImportError: cannot import name 'Qgis'

Python version:
3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)]

QGIS version:
3.1.0-Master 'Master', bb2e15c

Python path:
['C:/OSGEO41/apps/qgis-dev/./python', 'C:/Users/tchadwin/AppData/Roaming/QGIS/QGIS3\profiles\default/python', 'C:/Users/tchadwin/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins', 'C:/OSGEO41/apps/qgis-dev/./python/plugins', 'C:\OSGeo4W64\bin\python36.zip', 'C:\OSGEO41\apps\Python36\DLLs', 'C:\OSGEO41\apps\Python36\lib', 'C:\OSGeo4W64\bin', 'C:\OSGEO41\apps\Python36', 'C:\OSGEO41\apps\Python36\lib\site-packages']

@nyalldawson
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, looks like the same error

@nirvn
Copy link
Contributor

@nirvn nirvn commented on 1fb02e8 Jun 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@3nids , confirmed, reverting the 4 related commits fixes python for QGIS run from install directory.

@agiudiceandrea
Copy link
Contributor

@agiudiceandrea agiudiceandrea commented on 1fb02e8 Jun 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems the same problem is in 3.1.0-85 8f55093 on Windows 7 64 bit

Couldn't load PyQGIS.
Python support will be disabled.

Traceback (most recent call last):
  File "", line 1, in 
ModuleNotFoundError: No module named 'qgis.gui'

Python version:
3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)]

QGIS version:
3.1.0-Master 'Master', 8f55093642

The last not showing the error is 3.1.0-83 79ba0ee.

@3nids
Copy link
Member Author

@3nids 3nids commented on 1fb02e8 Jun 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the inconvenience
PR on its way #7181

Please sign in to comment.