/
setup.py
173 lines (131 loc) · 4.46 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
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
""" Setup script for the strikeparse application.
"""
#from distutils import log
#from itertools import chain
#from os import walk
#from os.path import join
#from subprocess import check_call
#from subprocess import CalledProcessError
#from setuptools import Command
#from setuptools import find_packages
#from setuptools import setup
#def _listdir(root):
# """ Recursively list all files under 'root'.
# """
# for path, _, names in walk(root):
# yield path, tuple(join(path, name) for name in names)
# return
#_DATA = "etc/",
#_CONFIG = {
# "name": "strikeparse",
# "author": "Michael Durrant",
# "author_email": "mmdurrant@gmail.com",
# "url": "",
# "package_dir": {"": ""},
# "packages": find_packages(""),
## "entry_points": {
## "console_scripts": ("cli = strikeparse.kitparse:main",),
## },
# "data_files": list(chain.from_iterable(_listdir(root) for root in _DATA))
#}
#def _version():
# """ Get the local package version.
# """
# path = join("", "__version__.py")
# namespace = {}
# with open(path) as stream:
# exec(stream.read(), namespace)
# return namespace["__version__"]
#class _CustomCommand(Command):
# """ Abstract base class for a custom setup command.
# """
# # Each user option is a tuple consisting of the option's long name (ending
# # with "=" if it accepts an argument), its single-character alias, and a
# # description.
# description = ""
# user_options = [] # this must be a list
# def initialize_options(self):
# """ Set the default values for all user options.
# """
# return
# def finalize_options(self):
# """ Set final values for all user options.
# This is run after all other option assignments have been completed
# (e.g. command-line options, other commands, etc.)
# """
# return
# def run(self):
# """ Execute the command.
# Raise SystemExit to indicate failure.
# """
# raise NotImplementedError
#class UpdateCommand(_CustomCommand):
# """ Custom setup command to pull from a remote branch.
# """
# description = "update from a remote branch"
# user_options = [
# ("remote=", "r", "remote name [default: tracking remote]"),
# ("branch=", "b", "branch name [default: tracking branch]"),
# ]
# def initialize_options(self):
# """ Set the default values for all user options.
# """
# self.remote = "" # default to tracking remote
# self.branch = "" # default to tracking branch
# return
# def run(self):
# """ Execute the command.
# """
# args = {"remote": self.remote, "branch": self.branch}
# cmdl = "git pull --ff-only {remote:s} {branch:s}".format(**args)
# try:
# check_call(cmdl.split())
# except CalledProcessError:
# raise SystemExit(1)
# log.info("package version is now {:s}".format(_version()))
# return
#class VirtualenvCommand(_CustomCommand):
# """ Custom setup command to create a virtualenv environment.
# """
# description = "create a virtualenv environment"
# user_options = [
# ("name=", "m", "environment name [default: venv]"),
# ("python=", "p", "Python interpreter"),
# ("requirements=", "r", "pip requirements file"),
# ]
# def initialize_options(self):
# """ Set the default values for all user options.
# """
# self.name = "venv"
# self.python = None # default to version used to install virtualenv
# self.requirements = None
# return
# def run(self):
# """ Execute the command.
# """
# venv = "virtualenv {:s}"
# if self.python:
# venv += " -p {:s}"
# pip = "{0:s}/bin/pip install -r {2:s}" if self.requirements else None
# args = self.name, self.python, self.requirements
# try:
# check_call(venv.format(*args).split())
# if pip:
# log.info("installing requirements")
# check_call(pip.format(*args).split())
# except CalledProcessError:
# raise SystemExit(1)
# return
#def main():
# """ Execute the setup commands.
# """
# _CONFIG["version"] = _version()
# _CONFIG["cmdclass"] = {
# "virtualenv": VirtualenvCommand,
# "update": UpdateCommand,
# }
# setup(**_CONFIG)
# return 0
## Make the script executable.
#if __name__ == "__main__":
# raise SystemExit(main())