-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsetup.py
More file actions
169 lines (155 loc) · 4.77 KB
/
Copy pathsetup.py
File metadata and controls
169 lines (155 loc) · 4.77 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
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""The setup script."""
import os
import sys
from setuptools import setup, find_packages
from distutils.core import Extension
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read()
requirements = [
'psutil',
]
setup_requirements = [
'pytest',
'pytest-runner',
]
test_requirements = [
'pytest',
]
extra_compile_args = [
'-Wall',
'-Wextra',
'-Werror',
'-Wfatal-errors',
'-Wpedantic',
# Some internal Python library code does not like this with C++11.
# '-Wno-c++11-compat-deprecated-writable-strings',
# '-std=c++11',
'-std=c11',
# Until we use m_coalesce
# '-Wno-unused-private-field',
# # Temporary
# '-Wno-unused-variable',
# '-Wno-unused-parameter',
]
if sys.platform.startswith('linux'):
extra_compile_args.extend(
[
# Linux, GCC complains about casting PyCFunction.
'-Wno-cast-function-type',
]
)
DEBUG = False
# DEBUG = True
if DEBUG:
extra_compile_args.extend(['-g3', '-O0', '-DDEBUG=1', '-UNDEBUG'])
else:
extra_compile_args.extend(['-O3', '-UDEBUG', '-DNDEBUG'])
# Extensions
ext_modules = [
Extension(
"pymemtrace.custom",
sources=[
'pymemtrace/src/cpy/cCustom.c',
],
include_dirs=[
'/usr/local/include',
os.path.join('pymemtrace', 'src', 'include'),
],
library_dirs=[os.getcwd(), ], # path to .a or .so file(s)
extra_compile_args=extra_compile_args,
),
Extension(
"pymemtrace.cPyMemTrace",
sources=[
'pymemtrace/src/c/get_rss.c',
'pymemtrace/src/c/ht.c',
'pymemtrace/src/c/pymemtrace_util.c',
'pymemtrace/src/c/pymemtrace_threading.c',
'pymemtrace/src/cpy/cPyMemTrace.c',
],
include_dirs=[
'/usr/local/include',
os.path.join('pymemtrace', 'src', 'include'),
],
library_dirs=[os.getcwd(), ], # path to .a or .so file(s)
extra_compile_args=extra_compile_args,
),
Extension(
"pymemtrace.cMemLeak",
sources=[
'pymemtrace/src/cpy/cMemLeak.c',
],
include_dirs=[
'/usr/local/include',
os.path.join('pymemtrace', 'src', 'include'),
],
library_dirs=[os.getcwd(), ], # path to .a or .so file(s)
extra_compile_args=extra_compile_args,
),
]
if sys.version_info.major >= 3 and sys.version_info.minor >= 13:
ext_modules.append(
Extension(
"pymemtrace.cPyRefTraceExample",
sources=[
'pymemtrace/src/cpy/cPyRefTraceExample.c',
],
include_dirs=[
'/usr/local/include',
os.path.join('pymemtrace', 'src', 'include'),
],
library_dirs=[os.getcwd(), ], # path to .a or .so file(s)
extra_compile_args=extra_compile_args,
),
)
setup(
name='pymemtrace',
version='0.6.3',
description="Python memory tracing.",
long_description=readme + '\n\n' + history,
long_description_content_type='text/x-rst',
author="Paul Ross",
author_email='apaulross@gmail.com',
url='https://github.com/paulross/pymemtrace',
packages=find_packages(), # include=['pymemtrace']),
include_package_data=True,
install_requires=requirements,
license="MIT license",
zip_safe=False,
keywords='pymemtrace',
# https://pypi.org/classifiers/
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Natural Language :: English',
'Programming Language :: C',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: Implementation :: CPython',
# https://devguide.python.org/versions/
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
'Programming Language :: Python :: 3.14',
'Programming Language :: Python :: 3.15',
'Topic :: Software Development',
],
test_suite='tests',
tests_require=test_requirements,
setup_requires=setup_requirements,
entry_points={
'console_scripts': [
'pymemtrace_ref_trace_analyse=pymemtrace.util.ref_trace_analyse:main',
'pymemtrace_dtrace_log_analyse=pymemtrace.util.dtrace_log_analyse:main',
],
},
# Extensions
ext_modules=ext_modules
)