nim-regex icon indicating copy to clipboard operation
nim-regex copied to clipboard

error installation `Error: 'srcdir' should be: 'srcDir'`

Open enthus1ast opened this issue 5 years ago • 21 comments

[david@eb ~]$ nimble install regex@#head
Downloading https://github.com/nitely/nim-regex using git
       Tip: 1 messages have been suppressed, use --verbose to show them.
     Error: Could not read package info file in /tmp/nimble_6678/githubcom_nitelynimregex_#head/regex.nimble;
        ...   Reading as ini file failed with: 
        ...     Invalid section: .
        ...   Evaluating as NimScript file failed with: 
        ...     /tmp/nimble_6678/githubcom_nitelynimregex_#head/regex_6678.nims(12, 1) Error: 'srcdir' should be: 'srcDir'
        ... printPkgInfo() failed.
[david@eb ~]$ nim --version
Nim Compiler Version 1.1.1 [Linux: amd64]
Compiled at 2020-01-03
Copyright (c) 2006-2019 by Andreas Rumpf

git hash: 12ad02731f33bd54d180ad519051905a66d17604
active boot switches: -d:release

enthus1ast avatar Jan 04 '20 12:01 enthus1ast

I think this was fixed in nimble[0], however the latest release is older than the fix. That said, I cannot reproduce the error.

[0] https://github.com/nim-lang/nimble/pull/744

nitely avatar Jan 04 '20 13:01 nitely

you have stylecheck:error in your config, probably

SolitudeSF avatar Jan 04 '20 13:01 SolitudeSF

mmh the stylecheck checking every dependency, even Nim itself instead of the project/app/lib being built is a PITA.

nitely avatar Jan 04 '20 13:01 nitely

cc @alaviss @dom96

This is breaking nimble-packages testing. Any reason why this isn't being fixed? Simplest fix is to remove the styleCheck until this change becomes old enough.

genotrance avatar Feb 10 '20 03:02 genotrance

What if we rename srcdir to srcDir in regex.nimble? I can't reproduce this, so no idea whether that fixes it.

Simplest fix is to remove the styleCheck until this change becomes old enough.

I guess that should fix nimble-package CI, but it won't help those using the style checker.

nitely avatar Feb 10 '20 03:02 nitely

Agreed - best to change regex.nimble to srcDir since that's the correct fix anyway.

genotrance avatar Feb 10 '20 03:02 genotrance

I just did that. Let me know if it's fixed now.

nitely avatar Feb 10 '20 03:02 nitely

I did this:

when (NimMajor, NimMinor) >= (1, 1):
  srcDir = "src"
else:
  srcdir = "src"

Now it fails for me with Error: 'srcDir' should be: 'srcdir'. I guess the reason is I'm using choosenim (Nim 1.1 with an old nimble version?).

nitely avatar Feb 10 '20 04:02 nitely

Koch pulls a specific Nimble commit - https://github.com/nim-lang/Nim/blob/devel/koch.nim#L137. Only if run with --latest, does it pull latest Nimble.

Seems like you need to turn off the style check as well.

genotrance avatar Feb 10 '20 04:02 genotrance

@genotrance Why does Nimble care about this anyway? Nim is style insensitive, why isn't Nimble?

dom96 avatar Feb 15 '20 22:02 dom96

@dom96: His config makes Nim care.

https://github.com/nitely/nim-regex/blob/master/config.nims#L4

genotrance avatar Feb 16 '20 00:02 genotrance

Seems like you need to turn off the style check as well.

That won't quite work. Users import nim-regex and then compile their programs with the stylecheck on, and AFAIK nim-regex gets stylechecked as well. That'll fail depending on the Nim version, and I'll receive complains.

I didn't try this, though, may be it won't fail? I'll try it later.

nitely avatar Feb 16 '20 00:02 nitely

Most people aren't keeping styleCheck:error by default. That is not the Nim default. It is breaking both in Nim package testing as well as during install time since the setting is in your root.

genotrance avatar Feb 17 '20 02:02 genotrance

See https://github.com/nitely/nim-regex/pull/40. I guess I should remove that config, and just reject PRs fixing style...

nitely avatar Feb 17 '20 03:02 nitely

@kaushalmodi - what's your take on this?

@dom96 - changing srcdir to srcDir is causing more heartburn than expected. What do you suggest to get this resolved?

genotrance avatar Feb 17 '20 03:02 genotrance

@genotrance Unless the packages (like regex) pass the stylechecks, the users cannot use styleCheck:error for their own packages depending on them.

I like consistencies and enforce styleCheck:error in my config. If the nimble and other popular packages cannot play well with styleCheck:error, they may be that feature should be removed.

My take would be to do whatever is needed to make styleCheck:error work. How can I help there?

kaushalmodi avatar Feb 17 '20 03:02 kaushalmodi

I appreciate your point of view and that packages like nim-regex could conform so that users can use the flag. That being said, the whole point of Nim's style insensitivity is to allow users and packages the flexibility that they prefer and not impose it on others. Regardless, I don't want to make it a big discussion around this feature. @Araq can share his thoughts on this in general.

The specific question here is that Nimble recently changed srcdir to srcDir. and nim-regex used srcdir and it is causing complaints with newer Nimble versions. nimterop on the other hand always used srcDir but I never got complaints that I had it wrong in my config all this time. It isn't as popular as regex though.

Not sure how to proceed here. Ideas appreciated.

genotrance avatar Feb 17 '20 03:02 genotrance

Not sure how to proceed here. Ideas appreciated.

It looks like removing styleCheck:error from nim-regex config.nims is the only way forward.

kaushalmodi avatar Feb 17 '20 03:02 kaushalmodi

@nitely I apologize for my PR causing all this trouble.

kaushalmodi avatar Feb 17 '20 03:02 kaushalmodi

I've removed the config for the time being https://github.com/nitely/nim-regex/commit/4360c267af5390221f285561195b1166b3fec1c9

nitely avatar Feb 17 '20 04:02 nitely

So use --styleCheck:hint.

Araq avatar Feb 17 '20 07:02 Araq