wmllint tutorial
Moderator: Forum Moderators
Forum rules
- Please use [code] BBCode tags in your posts for embedding WML snippets.
- To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
- Elvish_Hunter
- Posts: 1600
- Joined: September 4th, 2009, 2:39 pm
- Location: Lintanir Forest...
Re: wmllint tutorial
That's what I thought as well, but at the time of my answer I had no proof of this.Anonymissimus wrote:E_H: Perhaps wmlscope or other python tools also have this particular bug ? If so, modifying wmltools.py is probably the way to go.
I did more investigations, and I found that the problem is in the getopt.getopt function: under Windows, if an argument ends with a backslash a double quote is appended. This is what modified copies of wmlindent and wmllint print:
Code: Select all
C:\Users\admin>c:\python27\python.exe "C:\Program Files (x86)\Battle for Wesnoth
1.10.5\data\tools\wmlindent" "C:\Users\admin\Documents\My Games\Wesnoth1.10\dat
a\add-ons\The_Sojournings_of_Grog\"
C:\Users\admin\Documents\My Games\Wesnoth1.10\data\add-ons\The_Sojournings_of_Gr
og"
Options: []
Arguments: ['C:\\Users\\admin\\Documents\\My Games\\Wesnoth1.10\\data\\add-ons\
\The_Sojournings_of_Grog"']
C:\Users\admin>c:\python27\python.exe "C:\Program Files (x86)\Battle for Wesnoth
1.10.5\data\tools\wmlindent" "C:\Users\admin\Documents\My Games\Wesnoth1.10\dat
a\add-ons\The_Sojournings_of_Grog"
C:\Users\admin\Documents\My Games\Wesnoth1.10\data\add-ons\The_Sojournings_of_Gr
og
Options: []
Arguments: ['C:\\Users\\admin\\Documents\\My Games\\Wesnoth1.10\\data\\add-ons\
\The_Sojournings_of_Grog']
C:\Users\admin>c:\python27\python.exe "C:\Program Files (x86)\Battle for Wesnoth
1.10.5\data\tools\wmllint" --dryrun "C:\Program Files (x86)\Battle for Wesnoth
1.10.5\data\core" "C:\Users\admin\Documents\My Games\Wesnoth1.10\data\add-ons\Th
e_Sojournings_of_Grog\"
Argument: C:\Program Files (x86)\Battle for Wesnoth 1.10.5\data\core
Argument: C:\Users\admin\Documents\My Games\Wesnoth1.10\data\add-ons\The_Sojour
nings_of_Grog"
Code: Select all
for i,arg in enumerate(arguments):
if arg.endswith('"'):
arguments[i] = arg[:-1]
An alternative may be replacing getopt with argparse or optparse, but at the moment I don't have enough knowledge of these two libraries to decide in this direction.
Current maintainer of these add-ons, all on 1.16:
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
- Elvish_Hunter
- Posts: 1600
- Joined: September 4th, 2009, 2:39 pm
- Location: Lintanir Forest...
Re: wmllint tutorial
Double post to announce a commit.
I just committed in trunk, [rev]56380[/rev], a bugfix for wmllint, wmlscope and wmlindent. It is the enumerate() block mentioned in my former post. In case that no issue is found, I'll backport the fix to 1.10 as well.
Also, since the 1.4 series has ceased its development a lot of time ago, here there is a fixed copy of wmllint 1.4.
I just committed in trunk, [rev]56380[/rev], a bugfix for wmllint, wmlscope and wmlindent. It is the enumerate() block mentioned in my former post. In case that no issue is found, I'll backport the fix to 1.10 as well.
Also, since the 1.4 series has ceased its development a lot of time ago, here there is a fixed copy of wmllint 1.4.
- Attachments
-
wmllint_1.4.zip
- (21.82 KiB) Downloaded 156 times
Current maintainer of these add-ons, all on 1.16:
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
Re: wmllint tutorial
There is nothing wrong with committing changes to an otherwise unmaintained legacy branch.Elvish_Hunter wrote:Also, since the 1.4 series has ceased its development a lot of time ago, here there is a fixed copy of wmllint 1.4.
Author of the unofficial UtBS sequels Invasion from the Unknown and After the Storm.
- Elvish_Hunter
- Posts: 1600
- Joined: September 4th, 2009, 2:39 pm
- Location: Lintanir Forest...
Re: wmllint tutorial
Whew, finally I found some time to answer.shadowmaster wrote:There is nothing wrong with committing changes to an otherwise unmaintained legacy branch.
Of course there is nothing wrong

1) I'd have to checkout the 1.4 branch only for one commit, although I should be able to checkout only the tools directory.
2) Even on the non fixed wmllint, there is a simple way to avoid triggering the bug: be sure that every parameter does not end with a backslash.
3) There are only a few people porting from 1.4 and before, and I'm sure that all of them are skilled enough to download the patched version above and paste it in their tools directory, while using their administrator permissions.
Please correct me if I'm wrong.

Current maintainer of these add-ons, all on 1.16:
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
-
- Inactive Developer
- Posts: 165
- Joined: February 4th, 2011, 6:19 am
- Contact:
Re: wmllint tutorial
As long as we're talking about wmllint Windows problems, I'll note that my patch #3751 deals with Windows refusing to let a rename overwrite an existing file, which blocks wmllint from reverting, or converting a second time when there is a previous cfg-bak.
Ports:
Prudence (Josh Roby) | By the Sword (monochromatic) | The Eight of Cembulad (Lintana~ & WYRMY)
Resources:
UMC Timeline (Dec) | List of Unported UMC (Dec) | wmllint++ (Feb)
Prudence (Josh Roby) | By the Sword (monochromatic) | The Eight of Cembulad (Lintana~ & WYRMY)
Resources:
UMC Timeline (Dec) | List of Unported UMC (Dec) | wmllint++ (Feb)
- Elvish_Hunter
- Posts: 1600
- Joined: September 4th, 2009, 2:39 pm
- Location: Lintanir Forest...
Re: wmllint tutorial
As I already anticipated some posts above, I just backported the wmllint/scope/indent fix to 1.10, [rev]56436[/rev].
Thanks, I'll take a look at it.Groggy_Dice wrote:As long as we're talking about wmllint Windows problems, I'll note that my patch #3751 deals with Windows refusing to let a rename overwrite an existing file, which blocks wmllint from reverting, or converting a second time when there is a previous cfg-bak.
Current maintainer of these add-ons, all on 1.16:
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)