Skip to content
This repository was archived by the owner on Apr 1, 2023. It is now read-only.

Hardcode packages variable in setup.py to prevent installation of files in 'tests' directory#32

Merged
marioortizmanero merged 3 commits intovidify:masterfrom
Nowa-Ammerlaan:setup.py-fix
Dec 9, 2019
Merged

Hardcode packages variable in setup.py to prevent installation of files in 'tests' directory#32
marioortizmanero merged 3 commits intovidify:masterfrom
Nowa-Ammerlaan:setup.py-fix

Conversation

@Nowa-Ammerlaan
Copy link
Contributor

@Nowa-Ammerlaan Nowa-Ammerlaan commented Dec 9, 2019

Hello,

I've ran into a small problem with the setup.py file. Portage (gentoo's package manager) kept complaining about my ebuild:

>>> Failed to emerge dev-python/spotify-music-videos-1.8, Log file:

>>>  '/var/tmp/portage/dev-python/spotify-music-videos-1.8/temp/build.log'

* Messages for package dev-python/spotify-music-videos-1.8:

* ERROR: dev-python/spotify-music-videos-1.8::localrepo failed (install phase):
*   Package installs 'tests' package which is forbidden and likely a bug in the build system.
* 
* Call stack:
*     ebuild.sh, line  125:  Called src_install
*   environment, line 3423:  Called distutils-r1_src_install
*   environment, line 1119:  Called _distutils-r1_run_foreach_impl 'distutils-r1_python_install'
*   environment, line  466:  Called python_foreach_impl 'distutils-r1_run_phase' 'distutils-r1_python_install'
*   environment, line 2970:  Called multibuild_foreach_variant '_python_multibuild_wrapper' 'distutils-r1_run_phase' 'distutils-r1_python_install'
*   environment, line 2284:  Called _multibuild_run '_python_multibuild_wrapper' 'distutils-r1_run_phase' 'distutils-r1_python_install'
*   environment, line 2282:  Called _python_multibuild_wrapper 'distutils-r1_run_phase' 'distutils-r1_python_install'
*   environment, line  803:  Called distutils-r1_run_phase 'distutils-r1_python_install'
*   environment, line 1087:  Called distutils-r1_python_install
*   environment, line 1005:  Called die
* The specific snippet of code:
*               die "Package installs '${p}' package which is forbidden and likely a bug in the build system.";

I was a bit confused about this, as I also wrote ebuilds for some dependencies (lyricwikia, python-vlc) which also have a 'tests' directory, yet portage was absolutely fine with these ebuilds.

In my initial ebuild I fixed this by just patching out the whole 'tests' directory prior to installing. However, this solution is imperfect so I kept looking for what was differentiating this repository from the lyricwikia one.

It took some time but I finally found the problem, in setup.py. The line packages=find_packages(), causes setuptools to find all directories, including 'tests', (which shouldn't be installed). Hardcoding it to ['spotify-videos'] similarly to the setup.py's I found in other repositories fixes the problem.

[EDIT]: See also: gentoo/gentoo#13870

Nowa-Ammerlaan added a commit to Nowa-Ammerlaan/gentoo that referenced this pull request Dec 9, 2019
…fy song

Commit number 5, move some deps that were here to deps of this package.

And improved the patch to actually fix the issue in setup.py,
instead of just removing the 'tests' directory,
see also: vidify/vidify#32

Bug: https://bugs.gentoo.org/701922
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@riseup.net>
Package-Manager: Portage-2.3.80, Repoman-2.3.19
Package-Manager: Portage-2.3.81, Repoman-2.3.20
@marioortizmanero
Copy link
Member

marioortizmanero commented Dec 9, 2019

Thanks for your contribution :)) I initially just used a lazy find_packages() but yeah, hardcoding them is a better idea since it's just one. Let me do a couple tests and I'll merge it.

Edit: it seems you missed a , after the packages parameter. Can you fix that so that I can merge the PR?

@Nowa-Ammerlaan
Copy link
Contributor Author

Nowa-Ammerlaan commented Dec 9, 2019

it seems you missed a , after the packages parameter. Can you fix that so that I can merge the PR?

Aah I missed that one, that's what I get for being lazy and just copying the change instead of applying the patch I pushed to my branch of the Gentoo repo earlier (I had it with the ',' there). Thanks for catching that

@marioortizmanero
Copy link
Member

Sorry, one last thing: the module name is spotify_videos, not spotify-videos.

@Nowa-Ammerlaan
Copy link
Contributor Author

Nowa-Ammerlaan commented Dec 9, 2019

Sorry, one last thing: the module name is spotify_videos, not spotify-videos.

Oops, sorry about that, I had it correct in the patch I uploaded to the Gentoo repo, but then made a mistake copying it (again).

I think there's a lesson for me here: always apply the patch that has been proven to work instead of being lazy and thinking I can get away with copying the changes :D

@marioortizmanero
Copy link
Member

Don't worry it works perfectly now :)

@marioortizmanero marioortizmanero merged commit a7c9abe into vidify:master Dec 9, 2019
@Nowa-Ammerlaan Nowa-Ammerlaan deleted the setup.py-fix branch December 9, 2019 20:02
@marioortizmanero
Copy link
Member

@AndrewAmmerlaan I've released the 1.8.1 version with this hotfix, in case you wanted to download the .tar.gz file for the Gentoo installation: https://github.com/marioortizmanero/spotify-music-videos/releases/tag/1.8.1

Nowa-Ammerlaan added a commit to Nowa-Ammerlaan/gentoo that referenced this pull request Dec 10, 2019
…fy song

Version bump to 1.8.1 and remove now obsolete patch,
changed src_uri because this version is not on pypi yet

see also: vidify/vidify#32

Bug: https://bugs.gentoo.org/701922
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@riseup.net>
Package-Manager: Portage-2.3.81, Repoman-2.3.20
@Nowa-Ammerlaan
Copy link
Contributor Author

Nowa-Ammerlaan commented Dec 10, 2019

@AndrewAmmerlaan I've released the 1.8.1 version with this hotfix, in case you wanted to download the .tar.gz file for the Gentoo installation: https://github.com/marioortizmanero/spotify-music-videos/releases/tag/1.8.1

Awesome, thank you, I've updated the ebuild and removed the patch form my pull request in the gentoo repository

Nowa-Ammerlaan added a commit to Nowa-Ammerlaan/gentoo that referenced this pull request Dec 16, 2019
…fy song

Version bump to 1.8.1 and remove now obsolete patch,
changed src_uri because this version is not on pypi yet

see also: vidify/vidify#32

Bug: https://bugs.gentoo.org/701922
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@riseup.net>
Package-Manager: Portage-2.3.82, Repoman-2.3.20
Nowa-Ammerlaan added a commit to Nowa-Ammerlaan/gentoo that referenced this pull request Dec 16, 2019
…fy song

Bug: https://bugs.gentoo.org/701922
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@riseup.net>
Package-Manager: Portage-2.3.80, Repoman-2.3.19
Package-Manager: Portage-2.3.80, Repoman-2.3.19

dev-python/spotify-music-videos: Show Youtube videos/lyrics for Spotify song

Version bump to 1.8.1 and remove now obsolete patch,
changed src_uri because this version is not on pypi yet

see also: vidify/vidify#32

Bug: https://bugs.gentoo.org/701922
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@riseup.net>
Package-Manager: Portage-2.3.82, Repoman-2.3.20
Nowa-Ammerlaan added a commit to Nowa-Ammerlaan/gentoo that referenced this pull request Dec 16, 2019
…fy song

Bug: https://bugs.gentoo.org/701922
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@riseup.net>
Package-Manager: Portage-2.3.80, Repoman-2.3.19
Package-Manager: Portage-2.3.80, Repoman-2.3.19

dev-python/spotify-music-videos: Show Youtube videos/lyrics for Spotify song

Version bump to 1.8.1 and remove now obsolete patch,
changed src_uri because this version is not on pypi yet

see also: vidify/vidify#32

Bug: https://bugs.gentoo.org/701922
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@riseup.net>
Package-Manager: Portage-2.3.82, Repoman-2.3.20

dev-python/spotify-music-videos: Show Youtube videos/lyrics for Spotify song

Version bump to 1.8.1 and remove now obsolete patch,
changed src_uri because this version is not on pypi yet

see also: vidify/vidify#32

Bug: https://bugs.gentoo.org/701922
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@riseup.net>
Package-Manager: Portage-2.3.82, Repoman-2.3.20
Nowa-Ammerlaan added a commit to Nowa-Ammerlaan/gentoo that referenced this pull request Dec 16, 2019
…fy song

Bug: https://bugs.gentoo.org/701922
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@riseup.net>
Package-Manager: Portage-2.3.80, Repoman-2.3.19
Package-Manager: Portage-2.3.80, Repoman-2.3.19

dev-python/spotify-music-videos: Show Youtube videos/lyrics for Spotify song

Version bump to 1.8.1 and remove now obsolete patch,
changed src_uri because this version is not on pypi yet

see also: vidify/vidify#32

Bug: https://bugs.gentoo.org/701922
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@riseup.net>
Package-Manager: Portage-2.3.82, Repoman-2.3.20

dev-python/spotify-music-videos: Show Youtube videos/lyrics for Spotify song

Version bump to 1.8.1 and remove now obsolete patch,
changed src_uri because this version is not on pypi yet

see also: vidify/vidify#32

Bug: https://bugs.gentoo.org/701922
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@riseup.net>
Package-Manager: Portage-2.3.82, Repoman-2.3.20

dev-python/spotify-music-videos: Show Youtube videos/lyrics for Spoti…

…fy song

Bug: https://bugs.gentoo.org/701922
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@riseup.net>
Package-Manager: Portage-2.3.82, Repoman-2.3.20
Nowa-Ammerlaan added a commit to Nowa-Ammerlaan/gentoo that referenced this pull request Dec 17, 2019
…fy song

Bug: https://bugs.gentoo.org/701922
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@riseup.net>
Package-Manager: Portage-2.3.80, Repoman-2.3.19
Package-Manager: Portage-2.3.80, Repoman-2.3.19

dev-python/spotify-music-videos: Show Youtube videos/lyrics for Spotify song

Version bump to 1.8.1 and remove now obsolete patch,
changed src_uri because this version is not on pypi yet

see also: vidify/vidify#32

Bug: https://bugs.gentoo.org/701922
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@riseup.net>
Package-Manager: Portage-2.3.82, Repoman-2.3.20

dev-python/spotify-music-videos: Show Youtube videos/lyrics for Spotify song

Version bump to 1.8.1 and remove now obsolete patch,
changed src_uri because this version is not on pypi yet

see also: vidify/vidify#32

Bug: https://bugs.gentoo.org/701922
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@riseup.net>
Package-Manager: Portage-2.3.82, Repoman-2.3.20

dev-python/spotify-music-videos: Show Youtube videos/lyrics for Spoti…

…fy song

Bug: https://bugs.gentoo.org/701922
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@riseup.net>
Package-Manager: Portage-2.3.82, Repoman-2.3.20

dev-python/spotify-music-videos:

Package-Manager: Portage-2.3.82, Repoman-2.3.20
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants