-
-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathsetup.py
192 lines (174 loc) · 4.98 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
# -*- coding: utf-8 -*-
"""``darc`` - Darkweb Crawler Project
========================================
``darc`` is designed as a swiss army knife for darkweb crawling.
It integrates ``requests`` to collect HTTP request and response
information, such as cookies, header fields, etc. It also bundles
``selenium`` to provide a fully rendered web page and screenshot
of such view.
The general process of ``darc`` can be described as following:
There are two types of *workers*:
* ``crawler`` -- runs the ``darc.crawl.crawler`` to provide a
fresh view of a link and test its connectability
* ``loader`` -- run the ``darc.crawl.loader`` to provide an
in-depth view of a link and provide more visual information
"""
import sys
import subprocess
version_info = sys.version_info[:2]
# version string
__version__ = '1.0.3'
# setup attributes
attrs = dict(
name='python-darc',
version=__version__,
description='Darkweb crawler & search engine.',
long_description=__doc__,
author='Jarry Shaw',
author_email='[email protected]',
maintainer='Jarry Shaw',
maintainer_email='[email protected]',
url='https://github.com/JarryShaw/darc',
download_url='https://github.com/JarryShaw/darc/archive/v%s.tar.gz' % __version__,
# py_modules
packages=[
'darc',
'darc.proxy',
'darc.sites',
'darc.model',
'darc.model.tasks',
'darc.model.web',
],
# scripts
# ext_modules
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3 :: Only',
'Topic :: Software Development',
'Topic :: Utilities',
'Typing :: Typed',
],
# distclass
# script_name
# script_args
# options
license='BSD 3-Clause License',
keywords=[
'darkweb',
'crawler',
],
platforms=[
'any'
],
# cmdclass
# data_files
# package_dir
# obsoletes
# provides
# requires
# command_packages
# command_options
package_data={
'': [
'LICENSE',
'README.md',
],
'darc': [
'py.typed',
],
},
# include_package_data
# libraries
# headers
# ext_package
# include_dirs
# password
# fullname
# long_description_content_type
# python_requires
# zip_safe,
install_requires=[
'beautifulsoup4[html5lib]',
'file-magic',
'peewee',
'pottery',
'psutil',
'python-datauri',
'redis[hiredis]',
'requests-futures',
'requests[socks]',
'selenium<4',
'stem',
'typing_extensions',
# version compatibility
'dataclasses; python_version < "3.7"',
],
entry_points={
'console_scripts': [
'darc = darc.__main__:main',
]
},
extras_require={
# database
'SQLite': ['pysqlite3'],
'MySQL': ['PyMySQL[rsa]'],
'PostgreSQL': ['psycopg2'],
},
setup_requires=[
#'bpc-walrus; python_version < "3.8"',
'python-walrus==0.1.5rc1; python_version < "3.8"',
],
)
try:
from setuptools import find_namespace_packages, setup
from setuptools.command.build_py import build_py
attrs['packages'] = find_namespace_packages(
exclude=[
'test*',
'docs*',
'sample*',
],
include=[
'darc*',
],
)
attrs.update(dict(
include_package_data=True, # type: ignore
# libraries
# headers
# ext_package
# include_dirs
# password
# fullname
long_description_content_type='text/x-rst',
python_requires='>=3.6',
# zip_safe=True,
))
except ImportError:
from distutils.core import setup # type: ignore[no-redef]
from distutils.command.build_py import build_py # type: ignore[assignment]
class build(build_py):
"""Add on-build backport code conversion."""
def run(self): # type: ignore[no-untyped-def]
if version_info < (3, 8):
try:
subprocess.check_call( # nosec
[sys.executable, '-m', 'walrus', '--no-archive', 'darc']
)
except subprocess.CalledProcessError as error:
print('Failed to perform assignment expression backport compiling.'
'Please consider manually install `bpc-walrus` and try again.', file=sys.stderr)
sys.exit(error.returncode)
build_py.run(self)
# set-up script for pip distribution
setup(cmdclass={
'build_py': build,
}, **attrs) # type: ignore[arg-type]