Bug 423285 - Cannot get installed version programatically on Windows
Summary: Cannot get installed version programatically on Windows
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: General (show other bugs)
Version: 4.2.9
Platform: Microsoft Windows Microsoft Windows
: NOR wishlist
Target Milestone: ---
Assignee: Halla Rempt
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-06-20 17:33 UTC by Adric Worley
Modified: 2020-06-22 13:32 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adric Worley 2020-06-20 17:33:40 UTC
SUMMARY

It doesn't appear possible to query a Krita installation's version number programatically on Windows. The -v commandline arg pops up a messagebox rather than returning parseable text, the default install path does not include a version number, and the Windows Registry doesn't contain any versioning data.

STEPS TO REPRODUCE
1. On Windows run `krita -v`
1a. Alternatively, run `kritarunner -v`

OBSERVED RESULT

A messagebox appears showing the version number.

EXPECTED RESULT

The version number is printed to the console.

SOFTWARE/OS VERSIONS
Windows: Windows 10
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION

Usecase: Studio pipeline tooling needs to check installed applications' versions to ensure consistency.
Comment 1 Tiar 2020-06-20 17:40:48 UTC
I suggested the workaround using the sysinfo file: https://docs.krita.org/en/reference_manual/sharing_krita_logs.html#id3 but (1) it doesn't exists before 4.2.9, versions 4.2.8 and before would need to check krita.log instead, and version 4.2.0-4.2.8 would have the trouble of determining the version of the last running of Krita and not some random, and (2) it is in general not safe for script usage, I think, because it's meant to be parsed by humans, not scripts.
Comment 2 Halla Rempt 2020-06-21 08:18:16 UTC
Hm... it's actually Qt that decided that on Windows it needs to show a messagebox for the version, if you add the version to the arguments with  parser.addVersionOption();

I think it might be best to add a QString version() method to the Krita API in libkis, so the version can be retrieved in a Python script. Is there any other meta information about the installed Krita you'd like to retrieve?
Comment 3 Adric Worley 2020-06-21 17:19:43 UTC
I've realized that there's an assumed requirement in this report that I should have been explicit about: the version checking needs to be available to an outside process without having to fully load and run the application.

So, with that spoken, I think version/metadata method(s) would be useful in general, but not applicable to the use-case I'm considering.
Comment 4 Halla Rempt 2020-06-22 13:32:03 UTC
Git commit d91086221728c6706a83facbd190cefff87a96e1 by Boudewijn Rempt.
Committed on 22/06/2020 at 13:31.
Pushed by rempt into branch 'krita/4.3'.

Add a small executable to print the version

Not tested on Windows yet, but this should work...

M  +10   -0    krita/CMakeLists.txt
A  +36   -0    krita/kritaversion.cpp     [License: GPL (v2+)]

https://invent.kde.org/graphics/krita/commit/d91086221728c6706a83facbd190cefff87a96e1
Comment 5 Halla Rempt 2020-06-22 13:32:11 UTC
Git commit 58f15a09f8697e3cbc8ba36a29318882606c28be by Boudewijn Rempt.
Committed on 22/06/2020 at 13:32.
Pushed by rempt into branch 'master'.

Add a small executable to print the version

Not tested on Windows yet, but this should work...
(cherry picked from commit d91086221728c6706a83facbd190cefff87a96e1)

M  +10   -0    krita/CMakeLists.txt
A  +36   -0    krita/kritaversion.cpp     [License: GPL (v2+)]

https://invent.kde.org/graphics/krita/commit/58f15a09f8697e3cbc8ba36a29318882606c28be