-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
110 lines (89 loc) · 2.65 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
102
103
104
105
106
107
108
109
110
#!/usr/bin/env python
# vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
import setuptools
from setuptools.command.build_py import build_py
from sphinx.setup_command import BuildDoc
import py_compile
import glob
import os
import codecs
import re
here = os.path.abspath(os.path.dirname(__file__))
def read(*parts):
with codecs.open(os.path.join(here, *parts), 'r') as fp:
return fp.read()
def find_version(*file_paths):
version_file = read(*file_paths)
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
version_file, re.M)
if version_match:
return version_match.group(1)
raise RuntimeError("Unable to find version string.")
class PostBuild(build_py):
def run(self):
build_py.run(self)
print("compiling prmptc")
py_compile.compile('bin/prmpt')
cmdclass = {
# Post build step
"build_py": PostBuild,
# Build docs
'build_sphinx': BuildDoc,
}
name = "prmpt"
version = find_version("prmpt", "__init__.py")
setuptools.setup(
name=name,
version=version,
description="A command line prompt markup language",
author="Lee Netherton",
author_email="[email protected]",
url="https://github.com/ltn100/prmpt",
license="MIT licence, see LICENCE",
packages=["prmpt"],
classifiers=[
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 3",
"Topic :: Software Development",
"Topic :: Software Development :: User Interfaces",
"Topic :: System :: Shells",
"Topic :: System :: System Shells",
"Topic :: Terminals",
"Topic :: Terminals :: Terminal Emulators/X Terminals",
"Topic :: Utilities",
"Operating System :: POSIX",
"Operating System :: POSIX :: Linux",
"Operating System :: Unix",
"Operating System :: MacOS"
],
scripts=["bin/prmpt"],
data_files=[
(
"share/prmpt/skel",
[f for f in glob.glob("skel/*") if os.path.isfile(f)]
),
(
"share/prmpt/skel/functions",
[f for f in glob.glob("skel/functions/*") if os.path.isfile(f)]
),
],
cmdclass=cmdclass,
command_options={
'build_sphinx': {
'project': ('setup.py', name),
'version': ('setup.py', version),
'source_dir': ('setup.py', 'docs')
}
},
setup_requires=[
"wheel",
"sphinx",
"sphinx_rtd_theme"
],
install_requires=[
"future",
"configparser"
],
)