1
|
|
|
#!/usr/bin/env python3 |
2
|
|
|
|
3
|
|
|
# Start ignoring PyImportSortBear as imports below may yield syntax errors |
4
|
|
|
from coalib import assert_supported_version, VERSION, VERSION_FILE, BUS_NAME |
5
|
|
|
|
6
|
|
|
assert_supported_version() |
7
|
|
|
# Stop ignoring |
8
|
|
|
|
9
|
|
|
import datetime |
10
|
|
|
import locale |
11
|
|
|
import sys |
12
|
|
|
from os import getenv |
13
|
|
|
from subprocess import call |
14
|
|
|
|
15
|
|
|
import setuptools.command.build_py |
16
|
|
|
from coalib.misc.BuildManPage import BuildManPage |
17
|
|
|
from coalib.output.dbus.BuildDbusService import BuildDbusService |
18
|
|
|
from setuptools import find_packages, setup |
19
|
|
|
from setuptools.command.test import test as TestCommand |
20
|
|
|
|
21
|
|
|
try: |
22
|
|
|
locale.getlocale() |
23
|
|
|
except (ValueError, UnicodeError): |
|
|
|
|
24
|
|
|
locale.setlocale(locale.LC_ALL, 'en_US.UTF-8') |
|
|
|
|
25
|
|
|
|
26
|
|
|
|
27
|
|
|
class BuildPyCommand(setuptools.command.build_py.build_py): |
|
|
|
|
28
|
|
|
|
29
|
|
|
def run(self): |
30
|
|
|
self.run_command('build_manpage') |
31
|
|
|
self.run_command('build_dbus') |
32
|
|
|
setuptools.command.build_py.build_py.run(self) |
|
|
|
|
33
|
|
|
|
34
|
|
|
|
35
|
|
|
class PyTestCommand(TestCommand): |
|
|
|
|
36
|
|
|
|
37
|
|
|
def run_tests(self): |
38
|
|
|
# import here, cause outside the eggs aren't loaded |
39
|
|
|
import pytest |
40
|
|
|
errno = pytest.main([]) |
41
|
|
|
sys.exit(errno) |
|
|
|
|
42
|
|
|
|
43
|
|
|
|
44
|
|
|
class BuildDocsCommand(setuptools.command.build_py.build_py): |
|
|
|
|
45
|
|
|
apidoc_command = ('sphinx-apidoc', '-f', '-o', 'docs/API/', |
46
|
|
|
'coalib') |
47
|
|
|
doc_command = ('make', '-C', 'docs', 'html') |
48
|
|
|
|
49
|
|
|
def run(self): |
50
|
|
|
call(self.apidoc_command) |
|
|
|
|
51
|
|
|
call(self.doc_command) |
52
|
|
|
|
53
|
|
|
|
54
|
|
|
# Generate API documentation only if we are running on readthedocs.org |
55
|
|
|
on_rtd = getenv('READTHEDOCS', None) != None |
56
|
|
|
if on_rtd: |
57
|
|
|
call(BuildDocsCommand.apidoc_command) |
|
|
|
|
58
|
|
|
if "dev" in VERSION: |
59
|
|
|
current_version = datetime.datetime.now().strftime("%Y%m%d%H%M%S") |
60
|
|
|
call(['python3', '.misc/adjust_version_number.py', 'coalib/VERSION', |
61
|
|
|
'-b {}'.format(current_version)]) |
62
|
|
|
with open(VERSION_FILE, 'r') as ver: |
|
|
|
|
63
|
|
|
VERSION = ver.readline().strip() |
64
|
|
|
|
65
|
|
|
with open('requirements.txt') as requirements: |
|
|
|
|
66
|
|
|
required = requirements.read().splitlines() |
67
|
|
|
|
68
|
|
|
with open('test-requirements.txt') as requirements: |
69
|
|
|
test_required = requirements.read().splitlines() |
70
|
|
|
|
71
|
|
|
with open("README.rst") as readme: |
|
|
|
|
72
|
|
|
long_description = readme.read() |
73
|
|
|
|
74
|
|
|
|
75
|
|
|
if __name__ == "__main__": |
|
|
|
|
76
|
|
|
data_files = [('.', ['coala.1']), ('.', [BUS_NAME + '.service'])] |
|
|
|
|
77
|
|
|
|
78
|
|
|
setup(name='coala', |
79
|
|
|
version=VERSION, |
|
|
|
|
80
|
|
|
description='Code Analysis Application (coala)', |
81
|
|
|
author="The coala developers", |
82
|
|
|
maintainer="Lasse Schuirmann, Fabian Neuschmidt, Mischa Kr\xfcger" |
83
|
|
|
if not on_rtd else "L.S., F.N., M.K.", |
84
|
|
|
maintainer_email=('[email protected], ' |
85
|
|
|
'[email protected], ' |
86
|
|
|
'[email protected]'), |
87
|
|
|
url='http://coala-analyzer.org/', |
88
|
|
|
platforms='any', |
89
|
|
|
packages=find_packages(exclude=["build.*", "tests", "tests.*"]), |
90
|
|
|
install_requires=required, |
91
|
|
|
tests_require=test_required, |
92
|
|
|
package_data={'coalib': ['default_coafile', "VERSION", |
93
|
|
|
'bearlib/languages/definitions/*.coalang']}, |
94
|
|
|
license="AGPL-3.0", |
95
|
|
|
data_files=data_files, |
96
|
|
|
long_description=long_description, |
97
|
|
|
entry_points={ |
98
|
|
|
"console_scripts": [ |
99
|
|
|
"coala = coalib.coala:main", |
100
|
|
|
"coala-ci = coalib.coala_ci:main", |
101
|
|
|
"coala-dbus = coalib.coala_dbus:main", |
102
|
|
|
"coala-json = coalib.coala_json:main", |
103
|
|
|
"coala-format = coalib.coala_format:main", |
104
|
|
|
"coala-delete-orig = coalib.coala_delete_orig:main"]}, |
105
|
|
|
# from http://pypi.python.org/pypi?%3Aaction=list_classifiers |
106
|
|
|
classifiers=[ |
107
|
|
|
'Development Status :: 4 - Beta', |
108
|
|
|
|
109
|
|
|
'Environment :: Console', |
110
|
|
|
'Environment :: MacOS X', |
111
|
|
|
'Environment :: Win32 (MS Windows)', |
112
|
|
|
'Environment :: X11 Applications :: Gnome', |
113
|
|
|
|
114
|
|
|
'Intended Audience :: Science/Research', |
115
|
|
|
'Intended Audience :: Developers', |
116
|
|
|
|
117
|
|
|
'License :: OSI Approved :: GNU Affero General Public License ' |
118
|
|
|
'v3 or later (AGPLv3+)', |
119
|
|
|
|
120
|
|
|
'Operating System :: OS Independent', |
121
|
|
|
|
122
|
|
|
'Programming Language :: Python :: Implementation :: CPython', |
123
|
|
|
'Programming Language :: Python :: 3.3', |
124
|
|
|
'Programming Language :: Python :: 3.4', |
125
|
|
|
'Programming Language :: Python :: 3.5', |
126
|
|
|
'Programming Language :: Python :: 3 :: Only', |
127
|
|
|
|
128
|
|
|
'Topic :: Scientific/Engineering :: Information Analysis', |
129
|
|
|
'Topic :: Software Development :: Quality Assurance', |
130
|
|
|
'Topic :: Text Processing :: Linguistic'], |
131
|
|
|
cmdclass={'build_manpage': BuildManPage, |
|
|
|
|
132
|
|
|
'build_dbus': BuildDbusService, |
|
|
|
|
133
|
|
|
'build_py': BuildPyCommand, |
|
|
|
|
134
|
|
|
'docs': BuildDocsCommand, |
135
|
|
|
'test': PyTestCommand}) |
|
|
|
|
136
|
|
|
|