Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nimscript.findExe should find .cmd files #16661

Open
disruptek opened this issue Dec 21, 2020 · 5 comments
Open

nimscript.findExe should find .cmd files #16661

disruptek opened this issue Dec 21, 2020 · 5 comments
Labels
OS (stdlib) Related to OS modules in standard library

Comments

@disruptek
Copy link
Contributor

Per title, I want the following in my skiplists.nimble:

requires "https://github.com/disruptek/testes >= 0.7.1 & < 1.0.0"

task test, "run unit tests":
  exec findExe"testes"

but instead I need to use

requires "https://github.com/disruptek/testes >= 0.7.1 & < 1.0.0"

task test, "run unit tests":
  when defined(windows):
    exec "testes.cmd"
  else:
    exec findExe"testes"

because it seems that on Windows (such as found in GitHub Actions CI) Nimble doesn't install the testes binary in such a way that findExe can invoke it.

Perhaps relevant bits from https://github.com/disruptek/testes .nimble:

bin = @["testes"]      # build the binary for basic test running
installExt = @["nim"]  # we need to install testes.nim also
skipDirs = @["tests"]  # so stupid...  who doesn't want tests?

Annoyingly, nimble check complains that I need the skipDirs statement even when I include this.

@dom96
Copy link
Contributor

dom96 commented Jan 10, 2021

Not much we can do about this in Nimble AFAIK.

I think this is actually a Nim bug. The findExe in Nimscript should find .cmd, the os.findExe proc has a parameter to influence this: https://nim-lang.org/docs/os.html#findExe%2Cstring%2Cbool%2CopenArray%5Bstring%5D. I'll move it to the Nim repo.

Annoyingly, nimble check complains that I need the skipDirs statement even when I include this.

Have you tried installNim = ["testes.nim"]?

@dom96 dom96 transferred this issue from nim-lang/nimble Jan 10, 2021
@dom96 dom96 changed the title hybrid package's binary cannot be found by findExe nimscript.findExe should find .cmd files Jan 10, 2021
@disruptek
Copy link
Contributor Author

This is what I get when I add installNim = ["testes.nim"] to my testes.nimble:

     Error: Could not validate package:
        ... Could not read package info file in /home/adavidoff/git/testes/testes.nimble;
        ...   Reading as ini file failed with: 
        ...     Invalid section: .
        ...   Evaluating as NimScript file failed with: 
        ...     /home/adavidoff/git/testes/testes.nimble(14, 1) Error: undeclared identifier: 'installNim'
        ... printPkgInfo() failed.
nimble v0.12.0 compiled at 2021-01-10 00:52:13
git hash: couldn't determine git hash

Despite the error message, this is the nightly release build of Nimble from the following nightly release:

Nim Compiler Version 1.5.1 [Linux: amd64]
Compiled at 2021-01-10
Copyright (c) 2006-2021 by Andreas Rumpf

git hash: dbff2cd938b326279de0f3f97b2dd8c54a90468a
active boot switches: -d:release

@dom96
Copy link
Contributor

dom96 commented Jan 10, 2021

Sorry, I meant installFiles.

@disruptek
Copy link
Contributor Author

     Error: Package 'testes' has an incorrect structure. It should contain a single directory hierarchy for source files, named 'testespkg', but file 'testicles.nim' is in a directory named 'tests' instead. This will be an error in the future.
      Hint: If 'tests' contains source files for building 'testes', rename it to 'testespkg'. Otherwise, prevent its installation by adding `skipDirs = @["tests"]` to the .nimble file.
   Failure: Validation failed

@timotheecour
Copy link
Member

timotheecour commented Jan 11, 2021

The findExe in Nimscript should find .cmd, the os.findExe proc has a parameter to influence this

it should indeed find .cmd by default given these definitions:

proc findExe(exe: string; followSymlinks: bool = true; extensions: openArray[string] = ExeExts): string
ExeExts = ["exe", "cmd", "bat"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OS (stdlib) Related to OS modules in standard library
Projects
None yet
Development

No branches or pull requests

3 participants