-
Notifications
You must be signed in to change notification settings - Fork 60
/
setup.py
101 lines (86 loc) · 3.49 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/usr/bin/env python
"""
Usage of this setup.py script:
python setup.py install [, --prefix=$PREFIX]
"""
from __future__ import print_function
#from builtins import str
__author__ = 'Hans Petter Langtangen <[email protected]>'
__acknowledgements__ = 'Johannes H. Ring',
from setuptools import setup
import os, sys, glob, gzip, tempfile
# Make sure we import from doconce in this package, not an installed one:
# (need this for extracting the version below)
sys.path.insert(0, os.path.join('lib'))
__version__ = '1.4.13'
man_filename = os.path.join("doc", "man", "man1", "doconce.1")
if "install" in sys.argv:
# Compresses the man page
try:
man_inputfile = open(man_filename, 'rb')
man_contents = man_inputfile.read()
man_inputfile.close()
# Temporary destination for the man page
tmp_filename = tempfile.mktemp(os.path.sep + os.path.basename(man_filename) + ".gz")
# Make dir if the path doesn't already exist
base_dir = os.path.dirname(tmp_filename)
if not os.path.exists(base_dir):
os.makedirs(base_dir)
man_outputfile = gzip.open(tmp_filename, 'wb')
man_outputfile.write(man_contents)
man_outputfile.close()
man_filename = tmp_filename
except IOError as msg:
print("Unable to compress man page: %s" % msg)
setup(
version = __version__,
author = "Hans Petter Langtangen",
author_email = "[email protected]",
maintainer = "Kristian Gregorius Hustad",
maintainer_email = "[email protected]",
description = __doc__,
license = "BSD",
name = "DocOnce",
url = "https://github.com/hplgit/doconce",
classifiers = [
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Intended Audience :: Education',
'Intended Audience :: Other Audience',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: BSD License',
'Operating System :: MacOS',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX',
'Operating System :: Unix',
'Programming Language :: Python',
'Topic :: Documentation',
'Topic :: Software Development :: Documentation',
'Topic :: Text Processing :: Markup',
'Topic :: Text Processing :: Markup :: HTML',
'Topic :: Text Processing :: Markup :: LaTeX',
'Topic :: Text Processing :: Markup :: XML',
],
package_dir = {'': 'lib'},
packages = ['doconce'],
# list individual modules if not all files are wanted as part
# of the package (note: this does not work
# with package_data - must just specify the package name)
#py_modules = ['doconce.common', 'doconce.doconce', ...]
package_data = {'': ['sphinx_themes.zip', 'html_images.zip', 'reveal.js.zip', 'deck.js.zip', 'csss.zip', 'latex_styles.zip']},
scripts = [os.path.join('bin', f) for f in ['doconce']],
data_files=[(os.path.join("share", "man", "man1"),[man_filename,]),],
install_requires=[
'pygments',
#'preprocess',
# PIP will pull outdated preprocess from PyPi if preprocess is not already installed
# do pip install --upgrade git+https://github.com/doconce/preprocess instead
'mako',
'future'
],
)
# Clean up the temporary compressed man page
if man_filename.endswith(".gz") and os.path.isfile(man_filename):
if "-q" not in sys.argv or "--quiet" not in sys.argv:
print("Removing %s" % man_filename)
os.remove(man_filename)