Skip to content

python3Packages.py-cpuinfo: add sysctl to runtime dependencies#115220

Merged
SuperSandro2000 merged 1 commit intoNixOS:staging-nextfrom
bobrik:ivan/py-cpuinfo-sysctl
Mar 6, 2021
Merged

python3Packages.py-cpuinfo: add sysctl to runtime dependencies#115220
SuperSandro2000 merged 1 commit intoNixOS:staging-nextfrom
bobrik:ivan/py-cpuinfo-sysctl

Conversation

@bobrik
Copy link
Contributor

@bobrik bobrik commented Mar 6, 2021

Motivation for this change

There is a test a new version that caught the issue.

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.

@bobrik
Copy link
Contributor Author

bobrik commented Mar 6, 2021

Please consider merging #115221 at the same time.

@mweinelt
Copy link
Member

mweinelt commented Mar 6, 2021

Please consider merging #115221 at the same time.

Please consider merging them into them same branch, so we don't have to.

@ofborg ofborg bot added the 6.topic: python Python is a high-level, general-purpose programming language. label Mar 6, 2021
@mweinelt
Copy link
Member

mweinelt commented Mar 6, 2021

Also if this is a fix for the py-cpuinfo bump (0a0fb23) that is currently in staging-next, please retarget your change to staging-next.

@bobrik
Copy link
Contributor Author

bobrik commented Mar 6, 2021

This PR fixes x86_64-darwin, the other one fixes aarch64-darwin. I put them in different PRs because they fix two different issues. I can put both commits in this PR if you still think it's better that way.

@bobrik
Copy link
Contributor Author

bobrik commented Mar 6, 2021

Please retarget your change to staging-next.

What's the right way to do it? I can't use /rebase here and if I change the target branch, Github will try to pull all of the staging that isn't already in staging-next along with my commit.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 6, 2021

Failed to rebase

@mweinelt
Copy link
Member

mweinelt commented Mar 6, 2021

/rebase staging-next

@ofborg ofborg bot requested a review from costrouc March 6, 2021 02:00
@ofborg ofborg bot added 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 1001-2500 This PR causes many rebuilds on Darwin and should most likely target the staging branches. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels Mar 6, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Mar 6, 2021

Failed to rebase

@mweinelt
Copy link
Member

mweinelt commented Mar 6, 2021

There is a conflict, so you have to do it by hand.

Please retarget your change to staging-next.

What's the right way to do it? I can't use /rebase here and if I change the target branch, Github will try to pull all of the staging that isn't already in staging-next along with my commit.

Rebase onto staging-next and git push --force-with-lease. At the same time the push happens, try to change the target branch of this pull request, so we don't unnecessarily notify too many people.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 6, 2021

Failed to rebase

@bobrik bobrik force-pushed the ivan/py-cpuinfo-sysctl branch from 3d53784 to 49f7a2c Compare March 6, 2021 02:10
@bobrik bobrik changed the base branch from staging to staging-next March 6, 2021 02:11
@bobrik
Copy link
Contributor Author

bobrik commented Mar 6, 2021

Rebased.

@ofborg ofborg bot added 2.status: merge conflict This PR has merge conflicts with the target branch and removed 2.status: merge conflict This PR has merge conflicts with the target branch labels Mar 6, 2021
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious, why do they need sysctl as a buildtime dependency?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests depend on it.

Copy link
Member

@mweinelt mweinelt Mar 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is odd, since you already added it to propagatedBuildInputs, which are available during the checkPhase. I'm not sure if sysctl even needs to be propagated. It would probably even be sufficient as buildInputs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't you need sysctl in propagatedBuildInputs if you want to use py-cpuinfo somewhere?

I've tried removing sysctl from nativeBuildInputs and the tests fail. It works with checkInputs so I amended to use that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh yeah, I was mixing this up with something else. Having it in propagatedBuildInputs should be sufficient. It should be available during the checkPhase then.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I must be holding it wrong, but it doesn't work with just propagatedBuildInputs on aarch64-darwin for me.

With this:

  # On Darwin sysctl is used to read CPU information.
  propagatedBuildInputs = lib.optionals stdenv.isDarwin [ sysctl ];

  preCheck = ''
    type -f sysctl
    exit 1
  '';

I see:

pytestCheckPhase
Executing pytestCheckPhase
/nix/store/l4ha6r368qyba7klmzgiyhbrxpcyqdc4-stdenv-darwin/setup: line 88: type: sysctl: not found

What am I missing?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we need to patch the path to sysctl in the python code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated with a somewhat ugly substituteInPlace, let me know if you have something better in mind.

@SuperSandro2000
Copy link
Member

Rebase onto staging-next and git push --force-with-lease. At the same time the push happens, try to change the target branch of this pull request, so we don't unnecessarily notify too many people.

Are you searching for git rebase --onto=master @~1 ?

@mweinelt
Copy link
Member

mweinelt commented Mar 6, 2021

Rebase onto staging-next and git push --force-with-lease. At the same time the push happens, try to change the target branch of this pull request, so we don't unnecessarily notify too many people.

Are you searching for git rebase --onto=master @~1 ?

Likely, yeah.

@bobrik bobrik force-pushed the ivan/py-cpuinfo-sysctl branch from 49f7a2c to daf8d99 Compare March 6, 2021 02:39
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When propagating checkInputs shouldn't require sysctl but I tested it and the test fails. Maybe we need to hardcode the path or wrap python to set the path right?

@bobrik bobrik force-pushed the ivan/py-cpuinfo-sysctl branch from daf8d99 to a28c94e Compare March 6, 2021 05:17
@bobrik bobrik force-pushed the ivan/py-cpuinfo-sysctl branch from a28c94e to d4b7278 Compare March 6, 2021 05:28
@ofborg ofborg bot added 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 1001-2500 This PR causes many rebuilds on Linux and should target the staging branches. and removed 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels Mar 6, 2021
@siraben
Copy link
Member

siraben commented Mar 6, 2021

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

1 package built:
  • python3Packages.py-cpuinfo

Copy link
Member

@siraben siraben left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nix-shell:~/.../nixpkgs-review/pr-115220-1]$ python
Python 3.8.8 (default, Feb 21 2021, 06:37:46) 
[Clang 7.1.0 (tags/RELEASE_710/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from cpuinfo import get_cpu_info
>>> 
>>> for key, value in get_cpu_info().items():
...         print("{0}: {1}".format(key, value))
... 
python_version: 3.8.8.final.0 (64 bit)
cpuinfo_version: [7, 0, 0]
cpuinfo_version_string: 7.0.0
arch: X86_64
bits: 64
count: 4
arch_string_raw: x86_64
vendor_id_raw: GenuineIntel
brand_raw: Intel(R) Core(TM) i5-4288U CPU @ 2.60GHz
hz_advertised_friendly: 2.6000 GHz
hz_actual_friendly: 2.6000 GHz
hz_advertised: [2600000000, 0]
hz_actual: [2600000000, 0]
l2_cache_size: 262144
stepping: 1
model: 69
family: 6
flags: ['1gbpage', 'abm', 'acpi', 'aes', 'apic', 'avx', 'avx1.0', 'avx2', 'bmi1', 'bmi2', 'clflush', 'clfsh', 'cmov', 'cx16', 'cx8', 'de', 'ds', 'ds_cpl', 'dscpl', 'dtes64', 'dts', 'em64t', 'erms', 'est', 'f16c', 'fma', 'fpu', 'fpu_csds', 'fxsr', 'ht', 'htt', 'ibrs', 'invpcid', 'l1df', 'lahf', 'lahf_lm', 'lzcnt', 'mca', 'mce', 'mdclear', 'mmx', 'mon', 'monitor', 'movbe', 'msr', 'mtrr', 'osxsave', 'pae', 'pat', 'pbe', 'pcid', 'pclmulqdq', 'pdcm', 'pge', 'pni', 'popcnt', 'pse', 'pse36', 'rdrand', 'rdrnd', 'rdtscp', 'rdwrfsgs', 'seglim64', 'sep', 'smep', 'ss', 'ssbd', 'sse', 'sse2', 'sse3', 'sse4.1', 'sse4.2', 'sse4_1', 'sse4_2', 'ssse3', 'stibp', 'syscall', 'tm', 'tm2', 'tpr', 'tsc', 'tsc_thread_offset', 'tscdeadline', 'tsci', 'tsctmr', 'vme', 'vmx', 'x2apic', 'xd', 'xsave', 'xtpr']
l2_cache_line_size: 256
l2_cache_associativity: 6

@SuperSandro2000
Copy link
Member

This is a semi-automatic executed nixpkgs-review with nixpkgs-review-checks extension. It is checked by a human on a best effort basis and does not build all packages (e.g. lumo, tensorflow or pytorch).
If you have any questions or problems please reach out to SuperSandro2000 on IRC.

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

3 packages built:
  • python37Packages.py-cpuinfo
  • python38Packages.py-cpuinfo
  • python39Packages.py-cpuinfo

@SuperSandro2000 SuperSandro2000 merged commit fe3df71 into NixOS:staging-next Mar 6, 2021
@bobrik bobrik deleted the ivan/py-cpuinfo-sysctl branch March 6, 2021 22:14
@bobrik bobrik mentioned this pull request Aug 16, 2021
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: python Python is a high-level, general-purpose programming language. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 1001-2500 This PR causes many rebuilds on Darwin and should most likely target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 1001-2500 This PR causes many rebuilds on Linux and should target the staging branches.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants