-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
51 lines (36 loc) · 1.23 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
#!/usr/bin/env python
import re
from setuptools import setup
from setuptools.command.install import install
import subprocess
def find_version():
with open('./janus/__init__.py', 'r') as f:
for line in f:
line = line.strip()
match = re.search(r'^VERSION *= *.(\d+\.\d+\.\d+).$', line)
if match:
return match.group(1)
def find_install_requires(requires_list):
with open('./requirements.txt', 'r') as f:
for line in f:
line = line.strip()
if not line or line.startswith('#'):
continue
requires_list.append(line)
VERSION = find_version()
assert VERSION
INSTALL_REQUIRES = []
find_install_requires(INSTALL_REQUIRES)
class CustomInstall(install):
def run(self):
subprocess.run(['python', 'build_tree_sitter_lang_lib.py'])
super().run()
PACKAGE_DATA = {'janus': ['build-tree-sitter/my-languages.so']}
setup(name='Janus',
version=VERSION,
url='https://github.com/usharerose/janus.git',
install_requires=INSTALL_REQUIRES,
packages=['janus'],
package_data=PACKAGE_DATA,
cmdclass={'install': CustomInstall},
entry_points={'console_scripts': ['janus=janus.cli:main']})