/
setup.py
85 lines (75 loc) · 2.56 KB
/
setup.py
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
#!/usr/bin/env python
import os
import re
from setuptools import setup
import distutils.command.build
import distutils.command.clean
import distutils.command.sdist
man_file = 'chooser.1'
man_src = 'chooser.rst'
def build_man_file(man_file):
if not os.path.isfile(man_file):
try:
import docutils
except:
raise RuntimeError('docutils required to build man file')
import docutils.core
import docutils.writers.manpage
w = docutils.writers.manpage.Writer()
docutils.core.publish_file(source_path=man_src,
destination_path=man_file, writer=w)
class build(distutils.command.build.build):
def run(self):
build_man_file(man_file)
distutils.command.build.build.run(self)
class sdist(distutils.command.sdist.sdist):
def run(self):
build_man_file(man_file)
distutils.command.sdist.sdist.run(self)
class clean(distutils.command.clean.clean):
def run(self):
distutils.command.clean.clean.run(self)
if os.path.isfile(man_file):
os.unlink(man_file)
NAME = 'chooser'
VERSION = '0.3.5.2'
AUTHOR = 'Lev E. Givon'
AUTHOR_EMAIL = 'lev@columbia.edu'
URL = 'https://github.com/lebedov/chooser/'
DESCRIPTION = 'Choose browser when opening a URI'
with open('README.rst', 'r') as f:
LONG_DESCRIPTION = f.read()
LONG_DESCRIPTION = re.search('.*(^Package Description.*)', LONG_DESCRIPTION, re.MULTILINE|re.DOTALL).group(1)
LICENSE = 'BSD'
CLASSIFIERS = [
'Development Status :: 3 - Alpha',
'Environment :: X11 Applications',
'Intended Audience :: End Users/Desktop',
'License :: OSI Approved :: BSD License',
'Operating System :: POSIX',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 3',
'Topic :: Desktop Environment',
'Topic :: Internet :: WWW/HTTP'
]
DATA_FILES = [('man/man1', [man_file])]
CMDCLASS = {'build': build,
'clean': clean,
'sdist': sdist}
if __name__ == "__main__":
setup(
name = NAME,
version = VERSION,
author = AUTHOR,
author_email = AUTHOR_EMAIL,
license = LICENSE,
classifiers = CLASSIFIERS,
description = DESCRIPTION,
long_description = LONG_DESCRIPTION,
url = URL,
scripts = ['chooser'],
install_requires = ['pyxdg',
'wxPython >= 4.0.*'],
data_files = DATA_FILES,
cmdclass = CMDCLASS)