forked from ArchiveTeam/wpull
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
147 lines (124 loc) · 3.76 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
#!/usr/bin/env python
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
from distutils.version import StrictVersion
import os.path
import re
import os
import sys
import platform
def get_version():
path = os.path.join('wpull', 'version.py')
with open(path, 'r') as version_file:
content = version_file.read()
return re.search(r"__version__ = u?'(.+)'", content).group(1)
version = get_version()
StrictVersion(version)
PROJECT_PACKAGES = [
'wpull',
'wpull.abstract',
'wpull.backport',
'wpull.coprocessor',
'wpull.database',
'wpull.document',
'wpull.document.htmlparse',
'wpull.driver',
'wpull.ftp',
'wpull.ftp.ls',
'wpull.http',
'wpull.processor',
'wpull.proxy',
'wpull.recorder.',
'wpull.scraper',
'wpull.testing',
'wpull.thirdparty',
]
PROJECT_PACKAGE_DIR = {}
setup_kwargs = dict(
name='wpull',
version=version,
description='Wget-compatible web downloader and crawler.',
author='Christopher Foo',
author_email='chris.foo@gmail.com',
url='https://github.com/chfoo/wpull',
package_data={'': [
'cert/ca-bundle.pem',
'testing/*/*.css',
'testing/*/*.htm',
'testing/*/*.html',
'testing/*/*.txt',
'testing/*/*.lua',
'testing/*/*.rst',
'testing/*/*.js',
'testing/*/*.png',
'testing/*/*.xml',
'testing/*.lua',
'testing/*.pem',
'driver/*.js',
'proxy/proxy.crt',
'proxy/proxy.key',
]},
classifiers=[
'Development Status :: 5 - Production/Stable',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Topic :: Internet :: File Transfer Protocol (FTP)',
'Topic :: Internet :: WWW/HTTP',
'Topic :: System :: Archiving',
],
packages=PROJECT_PACKAGES,
package_dir=PROJECT_PACKAGE_DIR,
)
setup_kwargs['install_requires'] = [
'tornado', 'trollius', 'chardet', 'sqlalchemy',
'namedlist', 'html5lib', 'dnspython3',
]
setup_kwargs['scripts'] = ['scripts/wpull', 'scripts/wpull3']
if os.environ.get('USE_CX_FREEZE'):
from cx_Freeze import setup, Executable
wpull_package_dir = '.'
wpull_package_src_dir = './wpull/'
sys.path.insert(0, os.path.dirname(wpull_package_dir))
extension = '.exe' if platform.system() == 'Windows' else ''
setup_kwargs['executables'] = [
Executable(
os.path.join(wpull_package_src_dir, '__main__.py'),
targetName='wpull' + extension,
shortcutName='Wpull ' + version,
)
]
setup_kwargs['options'] = {
'build_exe': {
'includes': [
'lxml._elementpath',
'sqlalchemy.dialects.sqlite',
],
'zip_includes': [
(os.path.join(wpull_package_src_dir, 'cert', 'ca-bundle.pem'),
'wpull/cert/ca-bundle.pem'),
],
'include_files': [
(
os.path.join(wpull_package_src_dir, 'driver', 'phantomjs.js'),
'phantomjs.js'
),
(
os.path.join(wpull_package_src_dir, 'proxy', 'proxy.crt'),
'proxy.crt'
),
(
os.path.join(wpull_package_src_dir, 'proxy', 'proxy.key'),
'proxy.key'
),
]
}
}
if __name__ == '__main__':
if sys.version_info[0] < 3:
raise Exception('Sorry, Python 2 is not supported.')
setup(**setup_kwargs)