3liz / qgis-plugin-manager

CLI tools for installing QGIS Plugins
GNU General Public License v3.0
12 stars 2 forks source link

Allow forcing the qgis version #45

Open dmarteau opened 1 year ago

dmarteau commented 1 year ago

When running qgis-plugin manager without qgis framework installed it use an arbitrary default qgis version which does really not make sens in this context.

In this case it would be more appropriate to let the user specify the qgis version with an appropriate option (i.e --qgis-version X.YZ) for all commands fetching remote infos (search, update, ....)

Gustry commented 1 year ago

You can already force it by writing in the sources.list in "a manual way" :

echo "https://plugins.qgis.org/plugins/plugins.xml?qgis=3.4" > /your/sources.list

Then indeed, we would have a warning saying your version is hardcoded.

laurentj commented 1 year ago

You can already force it by writing in the sources.list in "a manual way" :

It doesn't work as I could expect.

I have almost the same issue. Although Qgis 3.10 or Qgis 3.16, and python3-qgis are installed globally (with debian/qgis packages), it replaces [VERSION] by '3.22'. It seems it has difficulties to detect the version

If I set the version into the sources.list, we have this message

our https://plugins.qgis.org remote is not using a dynamic QGIS version.
Instead of 'https://plugins.qgis.org/plugins/plugins.xml?qgis=3.10'
in your 'sources.list' file, you should have 'https://plugins.qgis.org/plugins/plugins.xml?qgis=[VERSION]'

Can you remove the file sources.list ? 'qgis-plugin-manager init' will regenerate it using dynamic QGIS version if QGIS is well configured.
This is only a warning, the process will continue with the hardcoded QGIS version : 3.22

The latest sentence is very very confusing. (no, i don't want the process will continue with 3.22, I indicated 3.10, it should continue with 3.10).

And the whole text does not make sens when I set myself the source.list, when I know what I'm doing. This is my ansible script which both install Qgis and setup the source.list, so the version given into the source.list is the same as the version of the installed Qgis. So it produces warnings that are not relevant here, and make the detection of real warning more difficult.

From my point of view, this kind of message should be hidden except if we give a flag like --explain, --advice or --enable-auto-discovering-version or else.. Or perhaps we should having the contrary, a flag like --disable-auto-version, or --no-advice or --I-know-what-I-am-doing-show-me-only-real-issues-please :-)

laurentj commented 1 year ago

To sum up, I think we should have a flag to disable automatic discovering of the version. Any software that offer features that guess something, should have a way to disable these features, as there could be cases where it does not work well.

I propose

laurentj commented 1 year ago

Or we could have a sub-command check, that tries to guess the version, and displays warnings etc. And automatic version discovering is completely disabled into other commands.

dmarteau commented 1 year ago

You can already force it by writing in the sources.list in "a manual way"

That's not very convenient, especially since the source.list template [VERSION] is then remplaced on the fly by the version hardcoded in the python code.

Amha, an option at the command line is far better that an hardcoded arbitrary value.

Gustry commented 1 year ago

Amha, an option at the command line is far better that an hardcoded arbitrary value.

@dmarteau, Yes, I totally agree, I was just giving a quick tip to achieve it with the current state of the code.

@laurentj :

It doesn't work as I could expect.

The latest sentence is very very confusing. (no, i don't want the process will continue with 3.22, I indicated 3.10, it should continue with 3.10).

Indeed, I took this as a bug. It has been fixed in c56b31da9c5140c73ceb74cd9b6bb89c17a8c89d

There isn't any QGIS default version involved when installing / upgrading. For now : any remotes having [VERSION], QGIS version detection must work otherwise it will fail. But if the remote doesn't have the token such as https://plugins.qgis.org/plugins/plugins.xml?qgis=3.10, the process will continue.

I let the ticket open for further updates.