Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

master: Add linux support to setup.py #173

Merged
merged 2 commits into from
Apr 3, 2018
Merged

master: Add linux support to setup.py #173

merged 2 commits into from
Apr 3, 2018

Conversation

leamas
Copy link
Contributor

@leamas leamas commented Apr 3, 2018

This PR is the underpinnings in master for #170 and #172. Basically, it makes mkchromecast to a complete pypi package on the Linux side, installable using pip3 and related tools. This simplifies things for both packagers and users on platforms without a native package.

If/when this PR is accepted, #170 and #172 need to be rebased to the new master before being merged, but that is a later issue. Basically, this PR is first part of #172.

The PR contains untested changes with respect to MacOS builds. So, please verify this before merging!

leamas added 2 commits April 3, 2018 08:03
Distutils/setup.py runs into potential problems when there is both a
module mkchromecast and a script mkchromecast. Resolve issue by moving
script to new location bin/.

Drop the .py suffix since it is a script and make it 755.

Add sys.path code to make it run both when installed and git-cloned.

The shebang is problematic. /usr/bin/python is wrong on most platforms,
since this is a python3 script. Updating to /usr/bin/python3 which
should be fine in many but not all cases -  the upstream python packages
just installs /usr/bin/python3.6 etc., not python3.

When the shebang fails, invocations like "python3.6 scripts/mkchromecast"
will always work (and should be documented somewhere).

Packaging toolchains typically patches the shebang as required, so this
is less of a problem in downstream packaging.
Add code to use setup.py also on Linux platforms. This is basically
to move installation code from the Debian packaging to the upstream
package. It makes the package a standard python package with correct
locations and will make maintenance as well as packaging on other distros
simpler.
@leamas leamas mentioned this pull request Apr 3, 2018
@muammar muammar changed the base branch from master to devel April 3, 2018 13:39
@muammar muammar merged commit 2998f88 into muammar:devel Apr 3, 2018
@leamas
Copy link
Contributor Author

leamas commented Apr 3, 2018

oops.. this will not work without moving mkchromecast.py to bin/mkchromecast. A patch of same commit as in #173 but rebased to devel is available at https://paste.fedoraproject.org/paste/Y3zjc79vuHoBpaUW3qhhlg (silly github does not support attached patches).

@muammar
Copy link
Owner

muammar commented Apr 3, 2018

I think it was moved:

muammar@nuc ~/github/mkchromecast [devel] 
± % ls                                                                                                                                                                                                      !10029
archive  changelog.md     example.py  images   Makefile  mkchromecast    mkchromecast.desktop  notifier   requirements.txt  start_tray.py
bin      CONTRIBUTING.md  fedora      LICENSE  man       mkchromecast.1  nodejs                README.md  setup.py          test.py

muammar@nuc ~/github/mkchromecast [devel] 
± % ls bin                                                                                                                                                                                                  !10032
audiodevice  mkchromecast  node

@muammar
Copy link
Owner

muammar commented Apr 3, 2018

setup.py is not working for macOS:

muammar@zarathustra ~/github/mkchromecast [devel]
± %  python setup.py build_ext                                                                                                                         !11162
/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'package'
  warnings.warn(msg)
running build_ext

I have to look at it in more details.

@leamas
Copy link
Contributor Author

leamas commented Apr 3, 2018

Ouch... although I had a bad feeling not being able to test, this indeed lookks strange. Are you sure the previous commit (with the old setup.py) works, or is it an unrelated external change in the environment?

@muammar
Copy link
Owner

muammar commented Apr 3, 2018

yeap, it worked before.

@leamas
Copy link
Contributor Author

leamas commented Apr 3, 2018

Wish I could help since it's my mess, but alas... Just an idea: tried packages: ['Mkchromecast'] instead of package: since it seemingly chokes on package:?

@leamas
Copy link
Contributor Author

leamas commented Apr 3, 2018

BTW, but most likely unrelated: I forgot to nuke the bad shebang.

@leamas
Copy link
Contributor Author

leamas commented Apr 4, 2018

Glad that you fixed it. Also glad it wasn't me;) I never touched the Makefile, and package: is just not supported by distutils these days: https://docs.python.org/3.6/distutils/apiref.html.

I have seen some other changes like this breaking things lately.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants