Skip to content

Commit 0c9cb74

Browse files
committed
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: 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
1 parent 4cb62e3 commit 0c9cb74

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

setup.py

100644100755
+8-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python3
22

33
from distutils.core import setup
4-
import os
4+
import os, subprocess
55

66
data_files = [
77
('share/icons/hicolor/16x16/apps', ['icons/hicolor/16x16/apps/fluxgui.svg']),
@@ -26,14 +26,19 @@
2626
('share/applications', ['desktop/fluxgui.desktop'])]
2727

2828
scripts = ['fluxgui']
29+
2930
if (os.path.exists("xflux")):
30-
scripts.append('xflux')
31+
# Unlike for 'scripts', the 'setup.py' doesn't modify the
32+
# permissions on files installed using 'data_files', so we need to
33+
# set the permissions ourselves.
34+
subprocess.call(['chmod', 'a+rx', 'xflux'])
35+
data_files.append(('bin', ['xflux']))
3136
else:
3237
print("""WARNING: if you are running 'python setup.py' manually, and not as
3338
part of Debian package creation, then you need to download the 'xflux'
3439
binary separately. You can do this by running
3540
36-
python ./download-xflux.py
41+
./download-xflux.py
3742
3843
before running 'setup.py'.""")
3944

0 commit comments

Comments
 (0)