forked from dipu-bd/lightnovel-crawler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
60 lines (49 loc) · 1.27 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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
if sys.version_info[:2] < (3, 6):
raise RuntimeError(
'Lightnovel crawler only supports Python 3.6 and later.')
try:
from pathlib import Path
import setuptools
from setuptools import config, setup
finally:
pass
run_pyi = 'package' in sys.argv
if run_pyi:
sys.argv.remove('package')
# end if
if len(sys.argv) == 1:
sys.argv += ['build']
# end if
def parse_requirements(filename):
with open(filename, 'r', encoding='utf8') as f:
requirements = f.read().strip().split('\n')
requirements = [
r.strip() for r in requirements
if r.strip() and not r.startswith('#')
]
return requirements
# end def
config.read_configuration('setup.cfg')
packages = setuptools.find_packages()
sources_packages = [
('lncrawl/' + p.as_posix()).replace('/', '.')
for p in Path('sources').glob('**')
]
setup(
packages=packages + sources_packages,
package_dir = {
'lncrawl.sources': 'sources'
},
package_data = {
'lncrawl': ['**/*.*', 'VERSION'],
'lncrawl.sources': ['*.*'],
},
install_requires=parse_requirements('requirements-app.txt'),
)
if run_pyi:
from setup_pyi import package
package()
# end if