Skip to content

Commit

Permalink
Update setup.py for Python 3
Browse files Browse the repository at this point in the history
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:
pypa/setuptools#210. Basically, you get an
error about a failed parse when setup tools tries to rad the binary as
a Python or #! script :P
  • Loading branch information
ntc2 committed Dec 24, 2018
1 parent 4cb62e3 commit 0c9cb74
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions setup.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -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']),
Expand All @@ -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'.""")

Expand Down

0 comments on commit 0c9cb74

Please sign in to comment.