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

check-esxi-hardware: refactor from python2 to python3 #102282

Merged
merged 5 commits into from Nov 23, 2020

Conversation

@freezeboy
Copy link
Contributor

@freezeboy freezeboy commented Oct 31, 2020

Motivation for this change

Working on issue: #101964

I took the opportunity to update the dependencies to support python3

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
@SuperSandro2000
Copy link
Member

@SuperSandro2000 SuperSandro2000 commented Oct 31, 2020

Result of nixpkgs-review pr 102282 run on x86_64-linux 1

12 packages built:
  • check-esxi-hardware
  • python27Packages.nocasedict
  • python27Packages.nocaselist
  • python27Packages.pywbem
  • python27Packages.yamlloader
  • python37Packages.nocasedict
  • python37Packages.nocaselist
  • python37Packages.yamlloader
  • python38Packages.nocasedict
  • python38Packages.nocaselist
  • python38Packages.pywbem
  • python38Packages.yamlloader

@SuperSandro2000
Copy link
Member

@SuperSandro2000 SuperSandro2000 commented Oct 31, 2020

Result of nixpkgs-review pr 102282 run on x86_64-darwin 1

12 packages built:
  • check-esxi-hardware
  • python27Packages.nocasedict
  • python27Packages.nocaselist
  • python27Packages.pywbem
  • python27Packages.yamlloader
  • python37Packages.nocasedict
  • python37Packages.nocaselist
  • python37Packages.yamlloader
  • python38Packages.nocasedict
  • python38Packages.nocaselist
  • python38Packages.pywbem
  • python38Packages.yamlloader

@@ -27,7 +27,7 @@ in python2Packages.buildPythonApplication rec {
runHook postInstall
'';

propagatedBuildInputs = with python2Packages; [ pywbem ];
propagatedBuildInputs = with python3Packages; [ pywbem requests ];
Copy link
Contributor

@jonringer jonringer Nov 1, 2020

Suggested change
propagatedBuildInputs = with python3Packages; [ pywbem requests ];
propagatedBuildInputs = with python3Packages; [ pywbem requests setuptools ];
[nix-shell:~/.cache/nixpkgs-review/pr-102282]$ ./results/check-esxi-hardware/bin/check_esxi_hardware.py --help
Traceback (most recent call last):
  File "/nix/store/fx2jz12qvfvv3q4ckwqbzyrfgis67sdz-check-esxi-hardware-20200710/bin/.check_esxi_hardware.py-wrapped", line 290, in <module>
    import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'

Copy link
Member

@SuperSandro2000 SuperSandro2000 Nov 1, 2020

Lets take this opportunity to add a simple test for that:

  checkPhase = ''
    $out/bin/check_esxi_hardware.py --help
  '';

Copy link
Member

@FRidh FRidh Nov 1, 2020

setuptools is a default build dependency, so this test will always succeed during a build, regardless of whether setuptools is available during runtime outside a build. Note this is also a bit of an issue with pythonImportsCheck and all tests.

Copy link
Contributor

@jonringer jonringer Nov 1, 2020

you might be able to do something like:

  checkPhase = ''
    unset PYTHONPATH
    $out/bin/check_esxi_hardware.py --help
  '';


let
bName = "check_esxi_hardware";
pName = stdenv.lib.replaceStrings [ "_" ] [ "-" ] bName;

in python2Packages.buildPythonApplication rec {
in python3Packages.buildPythonApplication rec {
Copy link
Member

@FRidh FRidh Nov 1, 2020

There is an executable that is installed that has an extension, please remove the extension. Executables in /bin should not have any.

@freezeboy freezeboy force-pushed the update-check-esxi-hardware branch 2 times, most recently from 0695491 to b1ec9db Nov 1, 2020
@peterhoeg
Copy link
Member

@peterhoeg peterhoeg commented Nov 10, 2020

I really want to try this out but we have this check deployed on many locations so I need to be sure it doesn't break anything. Has anyone tried this against actual ESXi instances?

@jonringer
Copy link
Contributor

@jonringer jonringer commented Nov 10, 2020

@peterhoeg

NIX_PATH=nixpkgs=https://github.com/freezeboy/nixpkgs/archive/update-check-esxi-hardware.tar.gz nix-shell -p check-esxi-hardware

@peterhoeg
Copy link
Member

@peterhoeg peterhoeg commented Nov 10, 2020

Thanks @jonringer - it wasn't so much about "how" to try it out but more if anyone had actually given this a go.

@nixos-discourse
Copy link

@nixos-discourse nixos-discourse commented Nov 15, 2020

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review/3032/368

@SuperSandro2000
Copy link
Member

@SuperSandro2000 SuperSandro2000 commented Nov 23, 2020

@freezeboy Can you resolve the merge conflict?

@freezeboy freezeboy force-pushed the update-check-esxi-hardware branch from b1ec9db to d44abad Nov 23, 2020
Copy link
Contributor

@jonringer jonringer left a comment

LGTM
shows usage

https://github.com/NixOS/nixpkgs/pull/102282
13 packages built:
check-esxi-hardware python27Packages.nocasedict python27Packages.nocaselist python27Packages.pywbem python27Packages.yamlloader python37Packages.nocasedict python37Packages.nocaselist python37Packages.pywbem python37Packages.yamlloader python38Packages.nocasedict python38Packages.nocaselist python38Packages.pywbem python38Packages.yamlloader

@jonringer jonringer merged commit b29a031 into NixOS:master Nov 23, 2020
19 checks passed
19 checks passed
@github-actions[bot]
tests
Details
@github-actions[bot]
action
Details
@ofborg[bot]
Evaluation Performance Report Evaluator Performance Report
Details
@github-actions[bot]
Wait for ofborg
Details
@ofborg[bot]
check-esxi-hardware, check-esxi-hardware.passthru.tests on aarch64-linux Success
Details
@ofborg[bot]
check-esxi-hardware, check-esxi-hardware.passthru.tests on x86_64-linux Success
Details
@ofborg[bot]
grahamcofborg-eval ^.^!
Details
@ofborg[bot]
grahamcofborg-eval-check-maintainers matching changed paths to changed attrs...
Details
@ofborg[bot]
grahamcofborg-eval-check-meta config.nix: checkMeta = true
Details
@ofborg[bot]
grahamcofborg-eval-darwin nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="d44abad"; rev="d44abad45021142f82ebd2e602ef45501b0da7f2"; } ./pkgs/t
Details
@ofborg[bot]
grahamcofborg-eval-lib-tests nix-build --arg pkgs import ./. {} ./lib/tests/release.nix
Details
@ofborg[bot]
grahamcofborg-eval-nixos nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="d44abad"; rev="d44abad45021142f82ebd2e602ef45501b0da7f2"; } ./nixos/
Details
@ofborg[bot]
grahamcofborg-eval-nixos-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="d44abad"; rev="d44abad45021142f82ebd2e602ef45501b0da7f2"; } ./nixos/
Details
@ofborg[bot]
grahamcofborg-eval-nixos-options nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="d44abad"; rev="d44abad45021142f82ebd2e602ef45501b0da7f2"; } ./nixos/
Details
@ofborg[bot]
grahamcofborg-eval-nixpkgs-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="d44abad"; rev="d44abad45021142f82ebd2e602ef45501b0da7f2"; } ./pkgs/t
Details
@ofborg[bot]
grahamcofborg-eval-nixpkgs-tarball nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="d44abad"; rev="d44abad45021142f82ebd2e602ef45501b0da7f2"; } ./pkgs/t
Details
@ofborg[bot]
grahamcofborg-eval-nixpkgs-unstable-jobset nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="d44abad"; rev="d44abad45021142f82ebd2e602ef45501b0da7f2"; } ./pkgs/t
Details
@ofborg[bot]
grahamcofborg-eval-package-list nix-env -qa --json --file .
Details
@ofborg[bot]
grahamcofborg-eval-package-list-no-aliases nix-env -qa --json --file . --arg config { allowAliases = false; }
Details
@freezeboy freezeboy deleted the update-check-esxi-hardware branch Nov 23, 2020
@jonringer
Copy link
Contributor

@jonringer jonringer commented Nov 23, 2020

Thanks @jonringer - it wasn't so much about "how" to try it out but more if anyone had actually given this a go.

if there was an issue with the interpreter, it's usually very apparent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

6 participants