-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsetup.py
56 lines (51 loc) · 1.79 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
from setuptools import setup
_DYLIB_NAME = 'challenge_bypass_ristretto_ffi'
def build_native(spec):
# build rust library
cargo_build = ['cargo', 'build', '--release']
build = spec.add_external_build(
cmd=['sh', '-c', 'echo "Running cargo build..."; {}'.format(" ".join(cargo_build))],
path='./challenge-bypass-ristretto-ffi'
)
spec.add_cffi_module(
# The Python module name
module_path='challenge_bypass_ristretto._native',
# The C library being bound
dylib=lambda: build.find_dylib(_DYLIB_NAME, in_path='target/release'),
header_filename=lambda: build.find_header('lib.h', in_path='./src'),
rtld_flags=['NOW', 'NODELETE']
)
def readme():
with open('README.md') as f:
return f.read()
def _myversion():
return dict(
# Unfortunately PyPI rejects package versions with a local part.
# Define a local scheme that never has a local part.
local_scheme=lambda version: "",
)
setup(
name='python-challenge-bypass-ristretto',
packages=['challenge_bypass_ristretto', 'challenge_bypass_ristretto.tests'],
zip_safe=False,
platforms='any',
setup_requires=['milksnake', 'setuptools_scm'],
install_requires=['cffi', 'attrs'],
extras_require={
"tests": [
"testtools",
"hypothesis",
],
},
use_scm_version=_myversion,
url='https://github.com/LeastAuthority/python-challenge-bypass-ristretto',
milksnake_tasks=[
build_native
],
author='Ramakrishnan Muthukrishnan',
author_email='[email protected]',
license = 'Mozilla Public License v2',
description='Bindings for Brave\'s Ristretto-flavored Privacy Pass library.',
long_description=readme(),
long_description_content_type='text/markdown'
)