GNOME Bugzilla – Bug 732668
Make g-ir-doc-tool work on Windows without using a MSYS shell
Last modified: 2015-02-07 16:49:45 UTC
Hi, In its current form, g-ir-scanner does not work on Windows outside a MSYS shell, so one is not able to use Mallard/g-i to generate documentation from a .gir file with Visual Studio builds of g-i. This is caused by _get_cachedir() in scanner/cachestore.py as it attempts to get the user's home directory by querying the HOME env var, which does not exist in cmd.exe (which the Visual Studio builds will use), but will work in an MSYS shell. I will attach a simple patch that will fix this, by querying HOMEPATH when we are building/using g-i from cmd.exe, so that we can get the correct home directory of the user, so that the documentation can be generated properly.
Created attachment 279825 [details] [review] giscanner: Make _get_cachedir() work on Windows without an MSYS shell Hi, Here's the patch for the issue. By running the doc tool tests in tests/scanner, I was able to get the doc files for all the C, Python, Gjs and section files that matches the respective expected outputs (albeit with different line endings, but this is a common Windows vs UNIX issue). With blessings, thank you!
Created attachment 279827 [details] [review] giscanner: Make _get_cachedir() work on Windows without an MSYS shell Hi, Sorry, please ignore the previous patch, I had the old one there... With blessings, thank you!
Review of attachment 279827 [details] [review]: I'm not a Windows expert, but this looks reasonable to me.
Hello Colin, Thanks for the review, the patch was pushed as 011b7c44. Will close this bug now. With blessings, thank you!
It would be interesting to see if os.path.expanduser('~') works with msys?, I know it does on regular Windows and Linux...
Hello Simon, This is what I get, supposing the user name is 'foo', under default circumstances, under MSYS given by mozilla-build: c:/Users/foo Under cmd.exe, I get C:\Users\fanc999. Shall we use your recommendation instead? For your references, with blessings.
(Sorry, the fanc999 should read 'foo' as well...)
(In reply to comment #6) > Shall we use your recommendation instead? If it works as expected I think it is definitely better to let Python abstract the platform than re-doing it ourselves.
Created attachment 281997 [details] [review] giscanner/cachestore.py: Clean up a bit Hello Simon, This is my patch for this based on your suggestions. Please note that this is built on top of the previous patch as that patch was pushed previously as it was given A-C-N. p.s.: By the way, any chance to look at bug 728313 (the build the g-i files using distutils bug), and possibly 732669 (the getting rid of the .def/.symbols files and using visibility/dllexport to export symbols bug)? With blessings, thank you!
Re-opening to consider new patch.
Review of attachment 281997 [details] [review]: Yay, three less lines of code and it's probably a more robust implementation.
Review of attachment 281997 [details] [review]: Hello Simon, Thanks for the reviews, the patch was pushed as 3701b320. Will close this bug shortly. With blessings.
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]