g-sherman / plugin_build_tool

Python command line tool for compiling and deploying QGIS plugins
GNU General Public License v2.0
38 stars 18 forks source link

Allow to set plugin_directory #4

Open jakimowb opened 6 years ago

jakimowb commented 6 years ago

QGIS reads plugins from any location specified the QGIS_PLUGINPATH. Therefore it would be nice to allow to set the plugin_directory different to <home>.qgis2/python/plugins.

Locations to specify a different plugin directory should be the pb_tool.cfg and an optional shell parameter, e.g. --plugindir my/plugin/location.

A not so nice way to change the plugin directory is possible in python by:

import pb_tool
pb_tool.get_plugin_directory = lambda : r'my/plugin/dir'
g-sherman commented 6 years ago

This is being added to the QGIS 3 version and will be backported to the QGIS 2 version of pb_tool

Hannes-Ole commented 1 month ago

This is an old issue and probably resolved by now. However I have a related question I also posted on gis.stackexchange.com:

I've had a working setup with QGIS 3.28.11 (OSGeo4W installation) and plugin_build_tool (installed via pip install pb_tool in the OSGeo4W Shell to deploy a QGIS Plugin I'm developing. Updating the QGIS version somehow messed this setup up. I had to reinstall plugin_build_tool but now it doesn't find the QGIS plugin directory. This is still in the default location (C:\Users\my_user\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins) - as it used to be, I haven't changed anything there. Yet I do get the following error, when running pbt deploy:

Unable to determine location of your QGIS Plugin directory.
        Make sure your QGIS environment is setup properly for development and Python
        has access to the PyQt5.QtCore module or specify plugin_path in your pb_tool.cfg.
Unable to determine where to deploy your plugin

I'm aware that I can add the plugin_path to the pb_tool.cfg file (deploy then works), but that wasn't necessary before and I'd rather avoid that and have a working default path.

Is there a way to check, which folder pbt is trying to use by default? Is this a known problem? (versions: pb_tool-3.1.0-py3-none-any.whl, QGIS 3.34.6 LTR, 3.36 current)

I assume, pb_tool works with the variable QGIS_PLUGINPATH (mentioned in this issue), but I don't know where this is set and how I can modify it.