-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathsetup.py
More file actions
82 lines (64 loc) · 2.81 KB
/
Copy pathsetup.py
File metadata and controls
82 lines (64 loc) · 2.81 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
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
import os, sys
from setuptools import setup, Extension
# Version information
def get_version_number():
with open('VERSION', 'r') as f:
for line in f:
return line.split('.')
return ()
# Alpha build information
# Builder must create a file in the fpbinary root directory called "ALPHA"
# with the alpha build string in it if they want the build to have a version
# with extra information appended to it.
def get_alpha_str():
if os.path.exists('ALPHA'):
with open('ALPHA', 'r') as f:
for line in f:
return line.strip()
return None
version_tuple = get_version_number()
if len(version_tuple) < 3:
raise SystemError("Couldn't find the module version number!")
version = '{}.{}.{}'.format(version_tuple[0], version_tuple[1], version_tuple[2])
alpha_str = get_alpha_str()
if alpha_str is not None:
version += alpha_str
with open("README.rst", "r") as fh:
long_description = fh.read()
extra_compile_args = []
fpbinary_module = Extension('fpbinary',
define_macros=[('MAJOR_VERSION', version_tuple[0]),
('MINOR_VERSION', version_tuple[1]),
('MICRO_VERSION', version_tuple[2]),
('VERSION_STRING', version)],
sources=['src/fpbinarymodule.c',
'src/fpbinaryglobaldoc.c',
'src/fpbinarycommon.c',
'src/fpbinarysmall.c',
'src/fpbinarylarge.c',
'src/fpbinaryobject.c',
'src/fpbinarycomplexobject.c',
'src/fpbinaryswitchable.c',
'src/fpbinaryarrayfuncs.c',
'src/fpbinaryenums.c'],
extra_compile_args=extra_compile_args)
setup(name='fpbinary',
version=version,
description='Provides binary fixed point functionality.',
long_description=long_description,
python_requires='>=2.7',
classifiers=[
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX',
'Operating System :: MacOS :: MacOS X',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3'],
url="https://github.com/smlgit/fpbinary",
author_email='smlgit@protonmail.com',
keywords='fixed-point, binary, bit-accurate, dsp, fpga',
license='GPL-2.0 License',
project_urls={
'Source': 'https://github.com/smlgit/fpbinary',
'Documentation': 'https://fpbinary.readthedocs.io/en/latest/',
},
ext_modules=[fpbinary_module])