-
-
Notifications
You must be signed in to change notification settings - Fork 252
Expand file tree
/
Copy pathsetup.py
More file actions
executable file
·106 lines (87 loc) · 3 KB
/
setup.py
File metadata and controls
executable file
·106 lines (87 loc) · 3 KB
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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import platform
from distutils.command.build import build
from bpython import __version__, package_dir
try:
from setuptools import setup
using_setuptools = True
except ImportError:
from distutils.core import setup
using_setuptools = False
try:
from distutils.command.build_py import build_py_2to3 as build_py
except ImportError:
from distutils.command.build_py import build_py
try:
from babel.messages.frontend import compile_catalog as _compile_catalog
from babel.messages.frontend import extract_messages
using_translations = True
except ImportError:
using_translations = False
cmdclass = dict(build_py=build_py, build=build)
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
build.sub_commands.append(('compile_catalog', None))
cmdclass['compile_catalog'] = compile_catalog
cmdclass['extract_messages'] = extract_messages
if platform.system() in ['FreeBSD', 'OpenBSD']:
man_dir = 'man'
else:
man_dir = 'share/man'
data_files = [
# man pages
(os.path.join(man_dir, 'man1'), ['doc/bpython.1']),
(os.path.join(man_dir, 'man5'), ['doc/bpython-config.5']),
# desktop shortcut
(os.path.join('share', 'applications'), ['data/bpython.desktop'])
]
# 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.",
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 = [
'pygments'
],
packages = ["bpython", "bpython.translations", "bpdb"],
data_files = data_files,
package_data = {
'bpython': ['logo.png'],
'bpython.translations': mo_files
},
entry_points = {
'console_scripts': [
'bpython = bpython.cli:main',
'bpython-urwid = bpython.urwid:main',
],
'gui_scripts': [
'bpython-gtk = bpython.gtk_:main'
]
},
scripts = ([] if using_setuptools else ['data/bpython',
'data/bpython-gtk']),
cmdclass = cmdclass
)
# vim: encoding=utf-8 sw=4 ts=4 sts=4 ai et sta