16
16
17
17
# pylint: disable-msg=missing-module-docstring
18
18
import io
19
+ import logging
19
20
import os
20
21
import sys
21
- from distutils import log
22
- from distutils .command .build import build
23
22
24
- from setuptools import Extension , find_packages , setup
23
+ from setuptools import (
24
+ Extension ,
25
+ setup
26
+ )
25
27
from setuptools .command .build_ext import build_ext
28
+ from setuptools .command .build_py import build_py
29
+
26
30
27
31
BASE_DIR = os .path .dirname (__file__ )
28
32
VERSION_FILENAME = os .path .join (
32
36
with open (VERSION_FILENAME , encoding = "utf-8" ) as f :
33
37
exec (f .read (), PACKAGE_INFO )
34
38
39
+
40
+ logger = logging .getLogger (__name__ )
41
+
35
42
def is_alpine_distro ():
36
43
"""Checks if current system is Alpine Linux."""
37
44
if os .path .exists ("/etc/alpine-release" ):
@@ -64,7 +71,7 @@ def link_oboe_lib(src_lib):
64
71
The src_lib parameter is the name of the library file under solarwinds_apm/extension the above mentioned symlinks will
65
72
point to. If a file with the provided name does not exist, no symlinks will be created."""
66
73
67
- log .info ("Create links to platform specific liboboe library file" )
74
+ logger .info ("Create links to platform specific liboboe library file" )
68
75
link_dst = ('liboboe-1.0.so' , 'liboboe-1.0.so.0' )
69
76
cwd = os .getcwd ()
70
77
try :
@@ -75,11 +82,11 @@ def link_oboe_lib(src_lib):
75
82
if os .path .exists (dst ):
76
83
# if the destination library files exist already, they need to be deleted, otherwise linking will fail
77
84
os .remove (dst )
78
- log .info ("Removed %s" % dst )
85
+ logger .info ("Removed %s" % dst )
79
86
os .symlink (src_lib , dst )
80
- log .info ("Created new link at {} to {}" .format (dst , src_lib ))
87
+ logger .info ("Created new link at {} to {}" .format (dst , src_lib ))
81
88
except Exception as ecp :
82
- log .info ("[SETUP] failed to set up links to C-extension library: {e}" .format (e = ecp ))
89
+ logger .info ("[SETUP] failed to set up links to C-extension library: {e}" .format (e = ecp ))
83
90
finally :
84
91
os .chdir (cwd )
85
92
@@ -89,7 +96,7 @@ def os_supported():
89
96
90
97
91
98
if not (python_version_supported () and os_supported ()):
92
- log .warn (
99
+ logger .warn (
93
100
"[SETUP] This package supports only Python 3.5 and above on Linux. "
94
101
"Other platform or python versions may not work as expected." )
95
102
@@ -112,10 +119,10 @@ def os_supported():
112
119
runtime_library_dirs = ['$ORIGIN' ]),
113
120
]
114
121
115
- class CustomBuild (build ):
122
+ class CustomBuild (build_py ):
116
123
def run (self ):
117
124
self .run_command ('build_ext' )
118
- build .run (self )
125
+ build_py .run (self )
119
126
120
127
121
128
class CustomBuildExt (build_ext ):
@@ -143,7 +150,7 @@ def run(self):
143
150
cmdclass = {
144
151
'build_ext' : CustomBuildExt ,
145
152
'build_ext_lambda' : CustomBuildExtLambda ,
146
- 'build ' : CustomBuild ,
153
+ 'build_py ' : CustomBuild ,
147
154
},
148
155
version = PACKAGE_INFO ["__version__" ],
149
156
author = 'SolarWinds, LLC' ,
0 commit comments