forked from vrasneur/icapclient
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsetup.py
More file actions
executable file
·51 lines (41 loc) · 1.67 KB
/
setup.py
File metadata and controls
executable file
·51 lines (41 loc) · 1.67 KB
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
#!/usr/bin/env python
# -*- mode: python; coding: utf-8 -*-
from setuptools import setup
from distutils.core import Extension
from distutils.spawn import find_executable
import os
from subprocess import check_output
import sys
if sys.version_info < (3,):
sys.stderr.write("Only Python3 or higher is supported.")
sys.exit(1)
api_config = 'c-icap-libicapapi-config'
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
if not find_executable(api_config):
raise OSError('Cannot find the "%s" command' % api_config)
extra_compile_args = ['-std=gnu99', '-Wextra']
extra_compile_args.extend(check_output([api_config, '--cflags']).decode('utf-8').split())
# ugly fix for issue #1. actual fix should probably be within cicap
# -fPIE shouldn't be in the compile args
if '-fPIE' in extra_compile_args:
extra_compile_args.remove('-fPIE')
extra_link_args = check_output([api_config, '--libs']).decode('utf-8').split()
ext = Extension(name='icapclient', sources=['icapclient.c', 'ICAPConnection.c', 'ICAPResponse.c', 'cicap_compat.c'],
extra_compile_args=extra_compile_args,
extra_link_args=extra_link_args)
name_str = 'icapclient3'
version_str = '1.2.1'
url_str = 'https://github.com/fim/%s' % name_str
tarball_str = '%s/tarball/%s' % (url_str, version_str)
setup(name=name_str,
version=version_str,
description='Python3 module for creating ICAP clients',
long_description=read("README.rst"),
author='Serafeim Mellos',
author_email='fim@mellos.io',
url=url_str,
download_url=tarball_str,
keywords=['icap', 'antivirus'],
setup_requires=['wheel'],
ext_modules=[ext])