FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
bpython/setup.py at master · coolcoding/bpython · GitHub
coolcoding
/
bpython
Public
forked from
bpython/bpython
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
bpython
/
setup.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
295 lines (246 loc) · 8.62 KB
Breadcrumbs
bpython
/
setup.py
Copy path
File metadata and controls
executable file
·
295 lines (246 loc) · 8.62 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import
os
import
platform
import
re
import
subprocess
import
sys
from
distutils
.
command
.
build
import
build
from
setuptools
import
setup
from
setuptools
.
command
.
install
import
install
as
_install
try
:
from
babel
.
messages
.
frontend
import
compile_catalog
as
_compile_catalog
from
babel
.
messages
.
frontend
import
extract_messages
as
_extract_messages
from
babel
.
messages
.
frontend
import
update_catalog
as
_update_catalog
from
babel
.
messages
.
frontend
import
init_catalog
as
_init_catalog
using_translations
=
True
except
ImportError
:
using_translations
=
False
try
:
import
sphinx
from
sphinx
.
setup_command
import
BuildDoc
if
sphinx
.
__version__
==
'1.1.2'
:
# Sphinx 1.1.2 is buggy and building bpython with that version fails.
# See #241.
using_sphinx
=
False
else
:
using_sphinx
=
True
except
ImportError
:
using_sphinx
=
False
# version handling
def
git_describe_to_python_version
(
version
):
"""Convert output from git describe to PEP 440 conforming versions."""
version_info
=
version
.
split
(
'-'
)
if
len
(
version_info
)
<
2
:
return
'unknown'
# we always have $version-$release
release_type
=
version_info
[
1
]
version_data
=
{
'version'
:
version_info
[
0
],
'release_type'
:
release_type
,
}
if
len
(
version_info
)
==
4
:
version_data
[
'commits'
]
=
version_info
[
2
]
else
:
version_data
[
'commits'
]
=
0
if
release_type
==
'release'
:
if
len
(
version_info
)
==
2
:
# format: $version-release
# This is the case at time of the release.
fmt
=
'{version}'
elif
len
(
version_info
)
==
4
:
# format: $version-release-$commits-$hash
# This is the case after a release.
fmt
=
'{version}-{commits}'
elif
release_type
==
'dev'
:
# format: $version-dev-$commits-$hash or $version-dev
fmt
=
'{version}.dev{commits}'
else
:
match
=
re
.
match
(
r'^(alpha|beta|rc)(\d*)$'
,
release_type
)
if
match
is
None
:
return
'unknown'
if
len
(
version_info
)
==
2
:
fmt
=
'{version}{release_type}'
elif
len
(
version_info
)
==
4
:
fmt
=
'{version}{release_type}-{commits}'
return
fmt
.
format
(
**
version_data
)
version_file
=
'bpython/_version.py'
version
=
'unknown'
try
:
# get version from git describe
proc
=
subprocess
.
Popen
([
'git'
,
'describe'
,
'--tags'
],
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
stdout
=
proc
.
communicate
()[
0
].
strip
()
if
sys
.
version_info
[
0
]
>
2
:
stdout
=
stdout
.
decode
(
'ascii'
)
if
proc
.
returncode
==
0
:
version
=
git_describe_to_python_version
(
stdout
)
except
OSError
:
pass
if
version
==
'unknown'
:
try
:
# get version from existing version file
with
open
(
version_file
)
as
vf
:
version
=
vf
.
read
().
strip
().
split
(
'='
)[
-
1
].
replace
(
'
\'
'
,
''
)
version
=
version
.
strip
()
except
IOError
:
pass
with
open
(
version_file
,
'w'
)
as
vf
:
vf
.
write
(
'# Auto-generated file, do not edit!
\n
'
)
vf
.
write
(
'__version__ =
\'
%s
\'
\n
'
%
(
version
, ))
class
install
(
_install
):
"""Force install to run build target."""
def
run
(
self
):
self
.
run_command
(
'build'
)
_install
.
run
(
self
)
cmdclass
=
{
'build'
:
build
,
'install'
:
install
}
from
bpython
import
package_dir
translations_dir
=
os
.
path
.
join
(
package_dir
,
'translations'
)
# localization options
if
using_translations
:
class
compile_catalog
(
_compile_catalog
):
def
initialize_options
(
self
):
"""Simply set default domain and directory attributes to the
correct path for bpython."""
_compile_catalog
.
initialize_options
(
self
)
self
.
domain
=
'bpython'
self
.
directory
=
translations_dir
self
.
use_fuzzy
=
True
class
update_catalog
(
_update_catalog
):
def
initialize_options
(
self
):
"""Simply set default domain and directory attributes to the
correct path for bpython."""
_update_catalog
.
initialize_options
(
self
)
self
.
domain
=
'bpython'
self
.
output_dir
=
translations_dir
self
.
input_file
=
os
.
path
.
join
(
translations_dir
,
'bpython.pot'
)
class
extract_messages
(
_extract_messages
):
def
initialize_options
(
self
):
"""Simply set default domain and output file attributes to the
correct values for bpython."""
_extract_messages
.
initialize_options
(
self
)
self
.
domain
=
'bpython'
self
.
output_file
=
os
.
path
.
join
(
translations_dir
,
'bpython.pot'
)
class
init_catalog
(
_init_catalog
):
def
initialize_options
(
self
):
"""Simply set default domain, input file and output directory
attributes to the correct values for bpython."""
_init_catalog
.
initialize_options
(
self
)
self
.
domain
=
'bpython'
self
.
output_dir
=
translations_dir
self
.
input_file
=
os
.
path
.
join
(
translations_dir
,
'bpython.pot'
)
build
.
sub_commands
.
insert
(
0
, (
'compile_catalog'
,
None
))
cmdclass
[
'compile_catalog'
]
=
compile_catalog
cmdclass
[
'extract_messages'
]
=
extract_messages
cmdclass
[
'update_catalog'
]
=
update_catalog
cmdclass
[
'init_catalog'
]
=
init_catalog
if
using_sphinx
:
class
BuildDocMan
(
BuildDoc
):
def
initialize_options
(
self
):
BuildDoc
.
initialize_options
(
self
)
self
.
builder
=
'man'
self
.
source_dir
=
'doc/sphinx/source'
self
.
build_dir
=
'build'
build
.
sub_commands
.
insert
(
0
, (
'build_sphinx_man'
,
None
))
cmdclass
[
'build_sphinx_man'
]
=
BuildDocMan
if
platform
.
system
()
in
[
'FreeBSD'
,
'OpenBSD'
]:
man_dir
=
'man'
else
:
man_dir
=
'share/man'
# manual pages
man_pages
=
[
(
os
.
path
.
join
(
man_dir
,
'man1'
), [
'build/man/bpython.1'
]),
(
os
.
path
.
join
(
man_dir
,
'man5'
), [
'build/man/bpython-config.5'
]),
]
else
:
man_pages
=
[]
data_files
=
[
# desktop shortcut
(
os
.
path
.
join
(
'share'
,
'applications'
), [
'data/bpython.desktop'
]),
# AppData
(
os
.
path
.
join
(
'share'
,
'appdata'
), [
'data/bpython.appdata.xml'
]),
# icon
(
os
.
path
.
join
(
'share'
,
'pixmaps'
), [
'data/bpython.png'
])
]
data_files
.
extend
(
man_pages
)
install_requires
=
[
'pygments'
,
'requests'
,
'curtsies >=0.1.18'
,
'greenlet'
,
'six >=1.5'
]
extras_require
=
{
'urwid'
: [
'urwid'
],
'watch'
: [
'watchdog'
],
'jedi'
: [
'jedi'
],
# need requests[security] for SNI support (only before 2.7.7)
':python_version == "2.6" or '
'python_full_version == "2.7.0" or '
\
'python_full_version == "2.7.1" or '
\
'python_full_version == "2.7.2" or '
\
'python_full_version == "2.7.3" or '
\
'python_full_version == "2.7.4" or '
\
'python_full_version == "2.7.5" or '
\
'python_full_version == "2.7.6"'
: [
'pyOpenSSL'
,
'pyasn1'
,
'ndg-httpsclient'
]
}
packages
=
[
'bpython'
,
'bpython.curtsiesfrontend'
,
'bpython.test'
,
'bpython.test.fodder'
,
'bpython.translations'
,
'bpdb'
]
entry_points
=
{
'console_scripts'
: [
'bpython = bpython.curtsies:main'
,
'bpython-curses = bpython.cli:main'
,
'bpython-urwid = bpython.urwid:main [urwid]'
,
'bpdb = bpdb:main'
]
}
tests_require
=
[]
if
sys
.
version_info
[
0
]
==
2
and
sys
.
version_info
[
1
]
<
7
:
tests_require
.
append
(
'unittest2'
)
if
(
sys
.
version_info
[
0
]
==
2
or
(
sys
.
version_info
[
0
]
==
3
and
sys
.
version_info
[
0
]
<
3
)):
tests_require
.
append
(
'mock'
)
# translations
mo_files
=
list
()
for
language
in
os
.
listdir
(
translations_dir
):
mo_subpath
=
os
.
path
.
join
(
language
,
'LC_MESSAGES'
,
'bpython.mo'
)
if
os
.
path
.
exists
(
os
.
path
.
join
(
translations_dir
,
mo_subpath
)):
mo_files
.
append
(
mo_subpath
)
setup
(
name
=
"bpython"
,
version
=
version
,
author
=
"Bob Farrell, Andreas Stuehrk et al."
,
author_email
=
"robertanthonyfarrell@gmail.com"
,
description
=
"Fancy Interface to the Python Interpreter"
,
license
=
"MIT/X"
,
url
=
"http://www.bpython-interpreter.org/"
,
long_description
=
"""bpython is a fancy interface to the Python
interpreter for Unix-like operating systems."""
,
install_requires
=
install_requires
,
extras_require
=
extras_require
,
tests_require
=
tests_require
,
packages
=
packages
,
data_files
=
data_files
,
package_data
=
{
'bpython'
: [
'sample-config'
],
'bpython.translations'
:
mo_files
,
'bpython.test'
: [
'test.config'
,
'test.theme'
]
},
entry_points
=
entry_points
,
cmdclass
=
cmdclass
,
test_suite
=
'bpython.test'
)
# vim: fileencoding=utf-8 sw=4 ts=4 sts=4 ai et sta
Back
|
FazBrowse Home
|
New Git URL