From 0c9cb740b222b0725863e7c8cd75415980014f2b Mon Sep 17 00:00:00 2001 From: Nathan Collins Date: Sun, 23 Dec 2018 23:04:36 -0800 Subject: [PATCH] Update setup.py for Python 3 Apparently you can no longer install arbitrary binaries using `scripts`. Instead you need to use `data_files` now. Discussion of error in Python 3 when trying to use `scripts` to install binaries here: https://github.com/pypa/setuptools/issues/210. Basically, you get an error about a failed parse when setup tools tries to rad the binary as a Python or #! script :P --- setup.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) mode change 100644 => 100755 setup.py diff --git a/setup.py b/setup.py old mode 100644 new mode 100755 index 15501e7..df9fb85 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 from distutils.core import setup -import os +import os, subprocess data_files = [ ('share/icons/hicolor/16x16/apps', ['icons/hicolor/16x16/apps/fluxgui.svg']), @@ -26,14 +26,19 @@ ('share/applications', ['desktop/fluxgui.desktop'])] scripts = ['fluxgui'] + if (os.path.exists("xflux")): - scripts.append('xflux') + # Unlike for 'scripts', the 'setup.py' doesn't modify the + # permissions on files installed using 'data_files', so we need to + # set the permissions ourselves. + subprocess.call(['chmod', 'a+rx', 'xflux']) + data_files.append(('bin', ['xflux'])) else: print("""WARNING: if you are running 'python setup.py' manually, and not as part of Debian package creation, then you need to download the 'xflux' binary separately. You can do this by running - python ./download-xflux.py + ./download-xflux.py before running 'setup.py'.""")