Skip to content

Commit 81e3388

Browse files
committed
Only install curtsies with Python 2.6 and newer
1 parent 7748e2e commit 81e3388

File tree

1 file changed

+34
-19
lines changed

1 file changed

+34
-19
lines changed

setup.py

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import os
66
import platform
7+
import sys
78

89
from distutils.command.build import build
910

@@ -132,6 +133,35 @@ def initialize_options(self):
132133
]
133134
data_files.extend(man_pages)
134135

136+
extras_require = {
137+
'urwid' : ['urwid']
138+
}
139+
140+
packages = ['bpython', 'bpython.test', 'bpython.translations', 'bpdb']
141+
142+
entry_points = {
143+
'console_scripts': [
144+
'bpython = bpython.cli:main',
145+
'bpython-urwid = bpython.urwid:main [urwid]'
146+
],
147+
'gui_scripts': [
148+
'bpython-gtk = bpython.gtk_:main'
149+
]
150+
}
151+
152+
scripts = [] if using_setuptools else ['data/bpython',
153+
'data/bpython-gtk',
154+
'data/bpython-urwid']
155+
156+
if sys.version_info[:2] >= (2, 6):
157+
# curtsies only supports 2.6 and onwards
158+
extras_require['curtsies'] = ['curtsies>=0.0.32', 'greenlet']
159+
packages.append("bpython.curtsiesfrontend")
160+
entry_points['console_scripts'].append(
161+
'bpython-curtsies = bpython.curtsies:main [curtsies]')
162+
if not using_setuptools:
163+
scripts.append('data/bpython-curtsies')
164+
135165
# translations
136166
mo_files = list()
137167
for language in os.listdir(translations_dir):
@@ -152,32 +182,17 @@ def initialize_options(self):
152182
install_requires = [
153183
'pygments'
154184
],
155-
extras_require = {
156-
'curtsies': ['curtsies>=0.0.32', 'greenlet'],
157-
'urwid' : ['urwid']
158-
},
185+
extras_require = extras_require,
159186
tests_require = ['mock'],
160-
packages = ["bpython", "bpython.test", "bpython.translations", "bpdb", "bpython.curtsiesfrontend"],
187+
packages = packages,
161188
data_files = data_files,
162189
package_data = {
163190
'bpython': ['logo.png'],
164191
'bpython.translations': mo_files,
165192
'bpython.test': ['test.config', 'test.theme']
166193
},
167-
entry_points = {
168-
'console_scripts': [
169-
'bpython = bpython.cli:main',
170-
'bpython-urwid = bpython.urwid:main [urwid]',
171-
'bpython-curtsies = bpython.curtsies:main [curtsies]',
172-
],
173-
'gui_scripts': [
174-
'bpython-gtk = bpython.gtk_:main'
175-
]
176-
},
177-
scripts = ([] if using_setuptools else ['data/bpython',
178-
'data/bpython-gtk',
179-
'data/bpython-curtsies',
180-
'data/bpython-urwid']),
194+
entry_points = entry_points,
195+
scripts = scripts,
181196
cmdclass = cmdclass,
182197
test_suite = 'bpython.test'
183198
)

0 commit comments

Comments
 (0)