docopt / docopt.nim

Command line arguments parser that will make you smile (port of docopt to Nim)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Docopt fails to run on OS X and Nim v0.12.0 – could not import: pcre_free_study

boydgreenfield opened this issue · comments

Example:

let doc = """
Usage: counted --help
       counted -v...
       counted go [go]
       counted (--path=<path>)...
       counted <file> <file>
Try: counted -vvvvvvvvvv
     counted go go
     counted --path ./here --path ./there
     counted this.txt that.txt
"""

import strutils
import docopt


let args = docopt(doc)
echo args

if args["-v"]:
    echo capitalize(repeat("very ", args["-v"].len - 1) & "verbose")

for path in @(args["--path"]):
    echo read_file(path)

Compiles fine, but returns the following error when you run it:

could not import: pcre_free_study

This is not a bug of this library.

nre module from standard library cannot be used because your system has an ancient version of PCRE.

Hi Oleh -- I should have been more explicit -- I'm on OS X 10.10, and
everything worked fine before updating to Nim v0.12 and docopt v0.6.2.

I'll check what happens with docopt 0.6.1 and also try manually using the
nre module, but I think this is worth some kind of warning or fix for given
that (a) it's a regression (perhaps Nim not docopt); and (b) my setup is
pretty common and relatively up to date.

On Thu, Nov 5, 2015 at 2:07 PM Oleh Prypin notifications@github.com wrote:

Closed #13 #13.


Reply to this email directly or view it on GitHub
#13 (comment).

Yes, Nim 0.12.0 finally puts the change introduced here into a release. Strange that nobody on Mac complained about regular expressions not working there. This may be a big problem.

docopt.nim v0.6.2 works only with Nim 0.12.0, docopt.nim v0.6.1 works with older versions. The changes were too numerous.

Please do check nre itself. e.g.

import nre
echo("abc".match(re"(\w)").get.captures[0] == "a")

If nre works then we'll investigate here, if not, maybe you can bring this to attention of Nim's community.

I also expect re to not work because the update of the wrapper affected it too.

Ok, updating PCRE fixes this. This probably should have made it into the Nim release notes, but indeed it's introduced in the above linked commit.

For any others' stumbling on this, brew upgrade pcre fixes this as long as you have >= 8.36. Thanks for the prompt reply, and sorry for the trouble @BlaXpirit.

This probably should have made it into the Nim release notes

Agreed, hopefully it will help others. :)

Thanks for keeping an eye on this and the diligent follow up @dom96!

I only wish I got to it sooner, it's been sitting in my
GitHub notifications way too long.

On Monday, 18 January 2016, Nick Greenfield notifications@github.com
wrote:

Thanks for keeping an eye on this and the diligent follow up @dom96
https://github.com/dom96!


Reply to this email directly or view it on GitHub
#13 (comment).

I am experiencing the same problem on OSX 10.11.6, nim 0.16.0 and docopt just installed via nimble.
I do have PCRE 8.39 but I still get the very same error could not import: pcre_free_study.