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

Change tests to not create python scripts during builds #182

Closed
Jauchi opened this issue Oct 5, 2021 · 2 comments
Closed

Change tests to not create python scripts during builds #182

Jauchi opened this issue Oct 5, 2021 · 2 comments

Comments

@Jauchi
Copy link

Jauchi commented Oct 5, 2021

Hello!
I want to package this tool for NixOS, but nix has no /usr/bin/env during the build (or testing) phase.
Would it be possible to create these scripts beforehand and just setting the execute-bit during testing?
Nix will replace /usr/bin/env in the shebang, just not for files that are created during the testing stage.

I am specifically referring to these parts:

br#"#!/usr/bin/env python
and
br#"#!/usr/bin/env python

For reference, this is my NixOS packaging request, describing the issue in greater detail: NixOS/nixpkgs#140644
Thank you very much!

@d-e-s-o
Copy link
Owner

d-e-s-o commented Oct 6, 2021

Thanks for working on a NixOS package! I don't think that we necessarily need to use /usr/bin/env. We can probably just reference /usr/bin/python3 and be done. Would that work for you?

But circling back a bit, why do you need the tests to begin with? Are you creating some kind of developer build? I am not against running tests as part of installation in general, but bear in mind that nitrocli tests assume a factory reset state of the key and may lock the stick if passwords have been changed. I doubt you'd want to run them on a user stick to validate installation or anything along those lines.

@Jauchi
Copy link
Author

Jauchi commented Oct 6, 2021

Hello, thank you for the quick answer.

Thanks for working on a NixOS package! I don't think that we necessarily need to use /usr/bin/env. We can probably just reference /usr/bin/python3 and be done. Would that work for you?

I just got an answer that showed me how to replace these paths at build time (kind of like a patch, but more dynamic), so probably no upstream "fix" required. NixOS/nixpkgs#140644 (comment)

But circling back a bit, why do you need the tests to begin with? Are you creating some kind of developer build? I am not against running tests as part of installation in general, but bear in mind that nitrocli tests assume a factory reset state of the key and may lock the stick if passwords have been changed. I doubt you'd want to run them on a user stick to validate installation or anything along those lines.

Thank you so much for pointing that out. According to https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks/rust.section.md#disabling-package-tests-disabling-package-tests testing things should be the default, I did not think much about it, to be honest.
I will try to implement some sort of configuration option to enable tests, but I agree the default should be to not test, in this case.

Thank you very much for the help, great job on nitrocli by the way, I absolutely love it!

@Jauchi Jauchi closed this as completed Oct 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants