-
-
Notifications
You must be signed in to change notification settings - Fork 85
/
setup.py
194 lines (162 loc) Β· 5.58 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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
#!/usr/bin/env python
import os
import subprocess
import warnings
from unittest import TestSuite
from setuptools import setup, find_packages
try:
# need recommonmark for build_htmlhelp command
import recommonmark
except ImportError:
pass
NAME = 'Orange3-Text'
MAJOR = 1
MINOR = 16
MICRO = 1
IS_RELEASED = True
VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO)
FULL_VERSION = VERSION
DESCRIPTION = 'Orange3 TextMining add-on.'
README_FILE = os.path.join(os.path.dirname(__file__), 'README.pypi')
LONG_DESCRIPTION = open(README_FILE).read()
AUTHOR = 'Bioinformatics Laboratory, FRI UL'
AUTHOR_EMAIL = '[email protected]'
URL = "https://github.com/biolab/orange3-text"
DOWNLOAD_URL = "https://github.com/biolab/orange3-text/tarball/{}".format(VERSION)
KEYWORDS = [
# [PyPi](https://pypi.python.org) packages with keyword "orange3 add-on"
# can be installed using the Orange Add-on Manager
'orange3-text',
'data mining',
'orange3 add-on',
]
ENTRY_POINTS = {
'orange3.addon': (
'text = orangecontrib.text',
),
# Entry point used to specify packages containing tutorials accessible
# from welcome screen. Tutorials are saved Orange Workflows (.ows files).
'orange.widgets.tutorials': (
# Syntax: any_text = path.to.package.containing.tutorials
'exampletutorials = orangecontrib.text.tutorials',
),
# Entry point used to specify packages containing widgets.
'orange.widgets': (
# Syntax: category name = path.to.package.containing.widgets
# Widget category specification can be seen in
# orangecontrib/text/widgets/__init__.py
'Text Mining = orangecontrib.text.widgets',
),
# Register widget help
"orange.canvas.help": (
'html-index = orangecontrib.text.widgets:WIDGET_HELP_PATH',),
}
def git_version():
""" Return the git revision as a string. Copied from numpy setup.py. """
def _minimal_ext_cmd(cmd):
# construct minimal environment
env = {}
for k in ['SYSTEMROOT', 'PATH']:
v = os.environ.get(k)
if v is not None:
env[k] = v
# LANGUAGE is used on win32
env['LANGUAGE'] = 'C'
env['LANG'] = 'C'
env['LC_ALL'] = 'C'
out = subprocess.Popen(cmd, stdout=subprocess.PIPE, env=env).communicate()[0]
return out
try:
out = _minimal_ext_cmd(['git', 'rev-parse', 'HEAD'])
GIT_REVISION = out.strip().decode('ascii')
except OSError:
GIT_REVISION = "Unknown"
return GIT_REVISION
def get_version_info():
""" Copied from numpy setup.py. """
global FULL_VERSION
FULL_VERSION = VERSION
if os.path.exists('.git'):
GIT_REVISION = git_version()
elif os.path.exists('orangecontrib/text/version.py'):
# must be a source distribution, use existing version file
# load it as a separate module to not load orangecontrib/text/__init__.py
from importlib.machinery import SourceFileLoader
version = SourceFileLoader('orangecontrib.text.version',
'orangecontrib/text/version.py').load_module()
GIT_REVISION = version.git_revision
else:
GIT_REVISION = "Unknown"
if not IS_RELEASED:
FULL_VERSION += '.dev0+' + GIT_REVISION[:7]
return FULL_VERSION, GIT_REVISION
def write_version_py(filename='orangecontrib/text/version.py'):
""" Copied from numpy setup.py. """
cnt = """
# THIS FILE IS GENERATED FROM ORANGE3-TEXT SETUP.PY
short_version = '%(version)s'
version = '%(version)s'
full_version = '%(full_version)s'
git_revision = '%(git_revision)s'
release = %(isrelease)s
if not release:
version = full_version
short_version += ".dev"
"""
FULL_VERSION, GIT_REVISION = get_version_info()
a = open(filename, 'w')
try:
a.write(cnt % {'version': VERSION,
'full_version': FULL_VERSION,
'git_revision': GIT_REVISION,
'isrelease': str(IS_RELEASED)})
finally:
a.close()
INSTALL_REQUIRES = sorted(set(
line.partition('#')[0].strip()
for line in open(os.path.join(os.path.dirname(__file__), 'requirements.txt'))
) - {''})
def temp_test_suite():
warnings.warn(
"The package does not support testing with this command. Please use"
"python -m unittest discover", FutureWarning)
return TestSuite([])
DATA_FILES = []
def include_documentation(local_dir, install_dir):
global DATA_FILES
doc_files = []
for dirpath, _, files in os.walk(local_dir):
doc_files.append(
(
dirpath.replace(local_dir, install_dir),
[os.path.join(dirpath, f) for f in files],
)
)
DATA_FILES.extend(doc_files)
if __name__ == "__main__":
include_documentation("doc/_build/html", "help/orange3-text")
write_version_py()
setup(
name=NAME,
description=DESCRIPTION,
long_description=LONG_DESCRIPTION,
long_description_content_type='text/markdown',
version=FULL_VERSION,
author=AUTHOR,
author_email=AUTHOR_EMAIL,
url=URL,
download_url=DOWNLOAD_URL,
packages=find_packages(),
include_package_data=True,
install_requires=INSTALL_REQUIRES,
data_files=DATA_FILES,
entry_points=ENTRY_POINTS,
keywords=KEYWORDS,
namespace_packages=['orangecontrib'],
zip_safe=False,
test_suite="setup.temp_test_suite",
extras_require={
'test': ['coverage'],
'doc': ['sphinx', 'recommonmark', 'sphinx_rtd_theme', 'docutils'],
},
)