-
Notifications
You must be signed in to change notification settings - Fork 252
/
setup.py
102 lines (84 loc) · 3.24 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
#!/usr/bin/env python
'''
Setup script.
To install lizard:
sudo setup.py build install
'''
import codecs
import os
import re
from setuptools import setup, Command
try:
here = os.path.dirname(os.path.abspath(__file__))
version = '0.0.0'
changes = os.path.join(here, "CHANGELOG.md")
pattern = r'^\#*\s*(?P<version>[0-9]+.[0-9]+(.[0-9]+)?)'
with codecs.open(changes, encoding='utf-8') as changes:
for line in changes:
match = re.match(pattern, line)
if match:
version = match.group("version")
break
# Save last Version
def save_version():
version_path = os.path.join(here, "lizard_ext/version.py")
with open(version_path) as version_file_read:
content_file = version_file_read.read()
VSRE = r"^version = ['\"]([^'\"]*)['\"]"
mo = re.search(VSRE, content_file, re.M)
current_version = mo.group(1)
content_file = content_file.replace(current_version, "{}".format(version))
with open(version_path, 'w') as version_file_write:
version_file_write.write(content_file)
save_version()
except:
from lizard_ext import version
class VersionCommand(Command):
description = 'Show library version'
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
print(version)
setup(
name='lizard',
version=version,
description='''A code analyzer without caring the C/C++ header files. ''' +
'''It works with Java, C/C++, JavaScript, Python, Ruby, Swift, Objective C. Metrics includes cyclomatic complexity number etc.''',
long_description=open('README.rst').read(),
url='http://www.lizard.ws',
project_urls={
'Source': 'https://github.com/terryyin/lizard',
},
download_url='https://pypi.python.org/lizard/',
license='MIT',
platforms='any',
classifiers=['Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Intended Audience :: End Users/Desktop',
'License :: Freeware',
'Operating System :: POSIX',
'Operating System :: Microsoft :: Windows',
'Operating System :: MacOS :: MacOS X',
'Topic :: Software Development :: Quality Assurance',
'Programming Language :: C',
'Programming Language :: C++',
'Programming Language :: Java',
'Programming Language :: JavaScript',
'Programming Language :: Objective C',
'Programming Language :: Python',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11'],
cmdclass={'version': VersionCommand},
packages=['lizard_ext', 'lizard_languages'],
#data_files=[('lizard_ext', [])],
py_modules=['lizard'],
install_requires=['pygments'],
entry_points={'console_scripts': ['lizard = lizard:main']},
author='Terry Yin',
author_email='terry@odd-e.com',
)