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

pythonPackages: add plexauth, plexapi, plexwebsocket #78011

Merged
merged 3 commits into from Jan 21, 2020

Conversation

colemickens
Copy link
Member

Motivation for this change

These are used by home-assistant when the plex component is used.

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.

@colemickens
Copy link
Member Author

@jonringer:

Two of these don't have any tests in their source. What is the convention for doCheck in that case? I left it in and set it to true in case they add tests in the future?

For plexapi, it complained about a missing dep, I added it, and then it gave zero test output...

Is this expected? Does that mean pytest runs them silently if they pass? Thanks for the info....

 nix-build -A python3Packages.plexapi
these derivations will be built:
  /nix/store/4yzfxmpk9k18gk5vmkibc0s9lagvv45d-python3.7-PlexAPI-3.2.0.drv
building '/nix/store/4yzfxmpk9k18gk5vmkibc0s9lagvv45d-python3.7-PlexAPI-3.2.0.drv'...
Sourcing python-catch-conflicts-hook.sh
Sourcing python-remove-bin-bytecode-hook.sh
Sourcing setuptools-build-hook
Using setuptoolsBuildPhase
Using setuptoolsShellHook
Sourcing pip-install-hook
Using pipInstallPhase
Sourcing python-imports-check-hook.sh
Using pythonImportsCheckPhase
Sourcing setuptools-check-hook
Using setuptoolsCheckPhase
unpacking sources
unpacking source archive /nix/store/ljs4h4vqir1yvr2mxj62ak9sgblz4icf-source
source root is source
setting SOURCE_DATE_EPOCH to timestamp 315619200 of file source/tools/plex-teardowntest.py
patching sources
configuring
no configure script, doing nothing
building
Executing setuptoolsBuildPhase
running bdist_wheel
running build
running build_py
creating build
creating build/lib
creating build/lib/plexapi
copying plexapi/video.py -> build/lib/plexapi
copying plexapi/utils.py -> build/lib/plexapi
copying plexapi/sync.py -> build/lib/plexapi
copying plexapi/settings.py -> build/lib/plexapi
copying plexapi/server.py -> build/lib/plexapi
copying plexapi/playqueue.py -> build/lib/plexapi
copying plexapi/playlist.py -> build/lib/plexapi
copying plexapi/photo.py -> build/lib/plexapi
copying plexapi/myplex.py -> build/lib/plexapi
copying plexapi/media.py -> build/lib/plexapi
copying plexapi/library.py -> build/lib/plexapi
copying plexapi/exceptions.py -> build/lib/plexapi
copying plexapi/config.py -> build/lib/plexapi
copying plexapi/compat.py -> build/lib/plexapi
copying plexapi/client.py -> build/lib/plexapi
copying plexapi/base.py -> build/lib/plexapi
copying plexapi/audio.py -> build/lib/plexapi
copying plexapi/alert.py -> build/lib/plexapi
copying plexapi/__init__.py -> build/lib/plexapi
installing to build/bdist.linux-x86_64/wheel
running install
running install_lib
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/wheel
creating build/bdist.linux-x86_64/wheel/plexapi
copying build/lib/plexapi/__init__.py -> build/bdist.linux-x86_64/wheel/plexapi
copying build/lib/plexapi/alert.py -> build/bdist.linux-x86_64/wheel/plexapi
copying build/lib/plexapi/audio.py -> build/bdist.linux-x86_64/wheel/plexapi
copying build/lib/plexapi/base.py -> build/bdist.linux-x86_64/wheel/plexapi
copying build/lib/plexapi/client.py -> build/bdist.linux-x86_64/wheel/plexapi
copying build/lib/plexapi/compat.py -> build/bdist.linux-x86_64/wheel/plexapi
copying build/lib/plexapi/config.py -> build/bdist.linux-x86_64/wheel/plexapi
copying build/lib/plexapi/exceptions.py -> build/bdist.linux-x86_64/wheel/plexapi
copying build/lib/plexapi/library.py -> build/bdist.linux-x86_64/wheel/plexapi
copying build/lib/plexapi/media.py -> build/bdist.linux-x86_64/wheel/plexapi
copying build/lib/plexapi/myplex.py -> build/bdist.linux-x86_64/wheel/plexapi
copying build/lib/plexapi/photo.py -> build/bdist.linux-x86_64/wheel/plexapi
copying build/lib/plexapi/playlist.py -> build/bdist.linux-x86_64/wheel/plexapi
copying build/lib/plexapi/playqueue.py -> build/bdist.linux-x86_64/wheel/plexapi
copying build/lib/plexapi/server.py -> build/bdist.linux-x86_64/wheel/plexapi
copying build/lib/plexapi/settings.py -> build/bdist.linux-x86_64/wheel/plexapi
copying build/lib/plexapi/sync.py -> build/bdist.linux-x86_64/wheel/plexapi
copying build/lib/plexapi/utils.py -> build/bdist.linux-x86_64/wheel/plexapi
copying build/lib/plexapi/video.py -> build/bdist.linux-x86_64/wheel/plexapi
running install_egg_info
running egg_info
creating PlexAPI.egg-info
writing PlexAPI.egg-info/PKG-INFO
writing dependency_links to PlexAPI.egg-info/dependency_links.txt
writing requirements to PlexAPI.egg-info/requires.txt
writing top-level names to PlexAPI.egg-info/top_level.txt
writing manifest file 'PlexAPI.egg-info/SOURCES.txt'
reading manifest file 'PlexAPI.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'PlexAPI.egg-info/SOURCES.txt'
Copying PlexAPI.egg-info to build/bdist.linux-x86_64/wheel/PlexAPI-3.2.0-py3.7.egg-info
running install_scripts
adding license file "LICENSE.txt" (matched pattern "LICEN[CS]E*")
adding license file "AUTHORS.txt" (matched pattern "AUTHORS*")
creating build/bdist.linux-x86_64/wheel/PlexAPI-3.2.0.dist-info/WHEEL
creating 'dist/PlexAPI-3.2.0-py3-none-any.whl' and adding 'build/bdist.linux-x86_64/wheel' to it
adding 'plexapi/__init__.py'
adding 'plexapi/alert.py'
adding 'plexapi/audio.py'
adding 'plexapi/base.py'
adding 'plexapi/client.py'
adding 'plexapi/compat.py'
adding 'plexapi/config.py'
adding 'plexapi/exceptions.py'
adding 'plexapi/library.py'
adding 'plexapi/media.py'
adding 'plexapi/myplex.py'
adding 'plexapi/photo.py'
adding 'plexapi/playlist.py'
adding 'plexapi/playqueue.py'
adding 'plexapi/server.py'
adding 'plexapi/settings.py'
adding 'plexapi/sync.py'
adding 'plexapi/utils.py'
adding 'plexapi/video.py'
adding 'PlexAPI-3.2.0.dist-info/AUTHORS.txt'
adding 'PlexAPI-3.2.0.dist-info/LICENSE.txt'
adding 'PlexAPI-3.2.0.dist-info/METADATA'
adding 'PlexAPI-3.2.0.dist-info/WHEEL'
adding 'PlexAPI-3.2.0.dist-info/top_level.txt'
adding 'PlexAPI-3.2.0.dist-info/RECORD'
removing build/bdist.linux-x86_64/wheel
Finished executing setuptoolsBuildPhase
installing
Executing pipInstallPhase
/build/source/dist /build/source
Processing ./PlexAPI-3.2.0-py3-none-any.whl
Requirement already satisfied: requests in /nix/store/sz8jskb1qkblwbwdp91mngh9c7m3kvix-python3.7-requests-2.22.0/lib/python3.7/site-packages (from PlexAPI==3.2.0) (2.22.0)
Requirement already satisfied: tqdm in /nix/store/w1ldm4gb8bahd0dswcy50rbjxf4ba8yv-python3.7-tqdm-4.40.2/lib/python3.7/site-packages (from PlexAPI==3.2.0) (4.40.2)
Requirement already satisfied: websocket-client in /nix/store/5586zvybx51riz524mz6ci2v88zkd6lk-python3.7-websocket_client-0.56.0/lib/python3.7/site-packages (from PlexAPI==3.2.0) (0.56.0)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /nix/store/hsq42yg3hlsq56x9fdgim1p5mpyianjl-python3.7-chardet-3.0.4/lib/python3.7/site-packages (from requests->PlexAPI==3.2.0) (3.0.4)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /nix/store/66d0iy9idnmxvn76ycvmkr7m45n0lbwx-python3.7-urllib3-1.25.7/lib/python3.7/site-packages (from requests->PlexAPI==3.2.0) (1.25.7)
Requirement already satisfied: certifi>=2017.4.17 in /nix/store/gwyk3ch8589mapwwf5h9lbgb0zjsksw1-python3.7-certifi-2019.11.28/lib/python3.7/site-packages (from requests->PlexAPI==3.2.0) (2019.11.28)
Requirement already satisfied: idna<2.9,>=2.5 in /nix/store/59685kz9w62b14q1zfhv6cana4rbqwgv-python3.7-idna-2.8/lib/python3.7/site-packages (from requests->PlexAPI==3.2.0) (2.8)
Requirement already satisfied: six in /nix/store/wpd893dshlnnf44i2ymmw4cwwq2jm6cg-python3.7-six-1.13.0/lib/python3.7/site-packages (from websocket-client->PlexAPI==3.2.0) (1.13.0)
Installing collected packages: PlexAPI
Successfully installed PlexAPI-3.2.0
/build/source
Finished executing pipInstallPhase
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/n7xann6cihk8y7ig9cb8544zif8dp12l-python3.7-PlexAPI-3.2.0
strip is /nix/store/x5m45fcnky99r0k41kmdwmjb7zw5k4z4-binutils-2.31.1/bin/strip
stripping (with command strip and flags -S) in /nix/store/n7xann6cihk8y7ig9cb8544zif8dp12l-python3.7-PlexAPI-3.2.0/lib
patching script interpreter paths in /nix/store/n7xann6cihk8y7ig9cb8544zif8dp12l-python3.7-PlexAPI-3.2.0
checking for references to /build/ in /nix/store/n7xann6cihk8y7ig9cb8544zif8dp12l-python3.7-PlexAPI-3.2.0...
running install tests
no Makefile or custom buildPhase, doing nothing
pythonCatchConflictsPhase
pythonRemoveBinBytecodePhase
pythonImportsCheckPhase
Executing pythonImportsCheckPhase
setuptoolsCheckPhase
Executing setuptoolsCheckPhase
running test
WARNING: Testing via this command is deprecated and will be removed in a future version. Users looking for a generic test entry point independent of test runner are encouraged to use tox.
running egg_info
writing PlexAPI.egg-info/PKG-INFO
writing dependency_links to PlexAPI.egg-info/dependency_links.txt
writing requirements to PlexAPI.egg-info/requires.txt
writing top-level names to PlexAPI.egg-info/top_level.txt
reading manifest file 'PlexAPI.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'PlexAPI.egg-info/SOURCES.txt'
running build_ext

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK
Finished executing setuptoolsCheckPhase
pytestcachePhase
/nix/store/n7xann6cihk8y7ig9cb8544zif8dp12l-python3.7-PlexAPI-3.2.0

propagatedBuildInputs = [ requests tqdm websocket_client ];

doCheck = true;
checkInputs = [ pytest pillow ];
Copy link
Contributor

Choose a reason for hiding this comment

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

or disable python2.7. I'm fine with either tbh

Suggested change
checkInputs = [ pytest pillow ];
checkInputs = [ pytest pillow ]
++ lib.optionals isPy27 [ mock ];
builder for '/nix/store/babalivzngycash5y3vk2xra333q9cv1-python2.7-PlexAPI-3.2.0.drv' failed with exit code 1; last 10 log lines:
      from mock import patch, MagicMock
  ImportError: No module named mock


  ----------------------------------------------------------------------
  Ran 7 tests in 0.000s

  FAILED (errors=7)
  Test failed: <unittest.runner.TextTestResult run=7 errors=7 failures=0>
  error: Test failed: <unittest.runner.TextTestResult run=7 errors=7 failures=0>

@colemickens
Copy link
Member Author

So how do I disable packages for python2? All I can think of is adding the attribute to python3Packages instead of all python packages, but it seems like that would only be for a single python3 version instead all of the python3 versions which might be preferred?

[cole@xeep:~/code/nixpkgs-ha-pkgs-plex]$ nix-build -A python2Packages.plexauth
error: aiohttp-3.6.2 not supported for interpreter python2.7
(use '--show-trace' to show detailed location information)

[cole@xeep:~/code/nixpkgs-ha-pkgs-plex]$ nix-build -A python2Packages.plexwebsocket
error: aiohttp-3.6.2 not supported for interpreter python2.7
(use '--show-trace' to show detailed location information)

@colemickens colemickens force-pushed the nixpkgs-ha-pkgs-plex branch 3 times, most recently from 5a5e3f0 to 882f8c2 Compare January 19, 2020 23:28
@colemickens
Copy link
Member Author

Cool. I figured it out from your other review. I assume that the disablement should propogate too? IE: if aiohttp is disabled in py27, then anything that uses it should also be explicitly disabled? That's what I did here for the two that use aiohttp.

Thanks! Hopefully its good to go.

@jonringer
Copy link
Contributor

if aiohttp is disabled, then this version will also be disabled

@colemickens
Copy link
Member Author

Suggested changes applied. Thanks!

Copy link
Contributor

@jonringer jonringer left a comment

Choose a reason for hiding this comment

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

diff LGTM
commits LGTM

python38 failures related to aiohttp package

[8 built (1 failed), 2 copied (0.5 MiB), 0.1 MiB DL]
error: build of '/nix/store/rjhi7a5gaxb9g514m4lxnip2lclbfbhj-env.drv' failed
https://github.com/NixOS/nixpkgs/pull/78011
2 package failed to build:
python38Packages.plexauth python38Packages.plexwebsocket

5 package built:
python27Packages.plexapi python37Packages.plexapi python37Packages.plexauth python37Packages.plexwebsocket python38Packages.plexapi

@jonringer
Copy link
Contributor

@GrahamcOfBorg build python27Packages.plexapi python37Packages.plexapi python37Packages.plexauth python37Packages.plexwebsocket python38Packages.plexapi

@jonringer
Copy link
Contributor

darwin builds are timing out, if it's broken, we will revisit it :)

@jonringer jonringer merged commit 4e26252 into NixOS:master Jan 21, 2020
@colemickens colemickens deleted the nixpkgs-ha-pkgs-plex branch January 30, 2020 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants