forked from nabla-c0d3/nassl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtasks.py
84 lines (61 loc) · 2.11 KB
/
tasks.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
from pathlib import Path
from invoke import task, Collection
import build_tasks
from nassl import __version__
root_path = Path(__file__).parent.absolute()
@task
def test(ctx):
# Run the test suite
ctx.run('pytest')
# Run linters
ctx.run('mypy nassl')
ctx.run('flake8 nassl')
@task
def package_linux_wheels(ctx):
"""Build the Linux 32 and 64 bit wheels using Docker.
"""
ctx.run(f'docker run --rm -v {root_path}:/io quay.io/pypa/manylinux1_i686 bash /io/build_linux_wheels.sh')
ctx.run(f'docker run --rm -v {root_path}:/io quay.io/pypa/manylinux1_x86_64 bash /io/build_linux_wheels.sh')
@task
def package_wheel(ctx):
"""Build the binary wheel for the current system; works on Windows anc macOS.
"""
ctx.run('python setup.py bdist_wheel')
@task
def package_windows_wheels(ctx):
"""Build the binary wheels for Windows; this expects Python to be installed at specific locations.
"""
for python_exe in ['D:\Python36\python.exe', 'D:\Python37\python.exe']:
ctx.run(f'{python_exe} setup.py bdist_wheel')
@task
def release(ctx):
raise NotImplementedError()
response = input(f'Release version "{__version__}" ? y/n')
if response.lower() != 'y':
print('Cancelled')
return
# Ensure the tests pass
test(ctx)
# Add the git tag
ctx.run(f"git tag -a {__version__} -m '{__version__}'")
ctx.run('git push --tags')
# Build the Windows wheel
build_wheel(ctx)
# Build the Linux wheels
build_linux_wheel(ctx)
# Setup all the tasks
ns = Collection()
ns.add_task(release)
ns.add_task(test)
package = Collection('package')
package.add_task(package_linux_wheels, 'linux_wheels')
package.add_task(package_windows_wheels, 'windows_wheels')
package.add_task(package_wheel, 'wheel')
ns.add_collection(package)
build = Collection('build')
build.add_task(build_tasks.build_zlib, 'zlib')
build.add_task(build_tasks.build_legacy_openssl, 'legacy_openssl')
build.add_task(build_tasks.build_modern_openssl, 'modern_openssl')
build.add_task(build_tasks.build_nassl, 'nassl')
build.add_task(build_tasks.build_all, 'all')
ns.add_collection(build)