Skip to content
Permalink
Browse files

concatenate auto_additions files with python module __init__.py.in

  • Loading branch information
3nids committed Jun 2, 2018
1 parent e5b02cd commit 1fb02e8d83c11c13105393f8b78397ea7b5da784
Showing with 3 additions and 4 deletions.
  1. +3 −4 python/CMakeLists.txt
@@ -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}")

6 comments on commit 1fb02e8

@nirvn

This comment has been minimized.

Copy link
Contributor

@nirvn nirvn replied Jun 5, 2018

@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

This comment has been minimized.

Copy link
Contributor

@DelazJ DelazJ replied Jun 5, 2018

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

This comment has been minimized.

Copy link
Collaborator

@nyalldawson nyalldawson replied Jun 5, 2018

Yes, looks like the same error

@nirvn

This comment has been minimized.

Copy link
Contributor

@nirvn nirvn replied Jun 5, 2018

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

@agiudiceandrea

This comment has been minimized.

Copy link
Contributor

@agiudiceandrea agiudiceandrea replied Jun 5, 2018

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

This comment has been minimized.

Copy link
Member Author

@3nids 3nids replied Jun 5, 2018

Sorry for the inconvenience
PR on its way #7181

Please sign in to comment.
You can’t perform that action at this time.