From 28d3b0b1a562144702a4d4df87d09adb3b641707 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Fri, 16 Dec 2022 12:58:00 -0800 Subject: [PATCH] avoid direct distutils --- setup.py | 27 ++++++++++++--------------- src/python/epicscorelibs/config.py | 5 ++--- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/setup.py b/setup.py index 3ef073559..ad3d2aa52 100755 --- a/setup.py +++ b/setup.py @@ -8,12 +8,9 @@ from setuptools import Command, Distribution from setuptools.command import install -from distutils.command import build from setuptools_dso import Extension, setup, DSO, build_dso -from distutils import log - mydir = os.path.abspath(os.path.dirname(__file__)) @@ -76,7 +73,7 @@ def finalize_options(self): ) def run(self): - log.info("In GetVersionError") + print("In GetVersionError") self.mkpath(self.build_temp) defs = {} readmake(defs, 'configure', 'CONFIG_BASE_VERSION') @@ -84,9 +81,9 @@ def run(self): outfile = os.path.join(self.build_temp, 'epicsVersion.h') if self.dry_run: - log.info("Would write %s", outfile) + print("Would write %s", outfile) else: - log.info("Writing %s", outfile) + print("Writing %s", outfile) with open(outfile, 'w') as F: F.write(""" #ifndef INC_epicsVersion_H @@ -119,9 +116,9 @@ def run(self): outfile = os.path.join(self.build_temp, 'generated.c') if self.dry_run: - log.info("Would write %s", outfile) + print("Would write %s", outfile) else: - log.info("Writing %s", outfile) + print("Writing %s", outfile) with open(outfile, 'w') as F: F.write(""" #include @@ -157,7 +154,7 @@ def run(self): defS.append(D) if len(defM)==0 or len(defS)==0: - log.warn("Warning: generated error string table is empty!") + print("Warning: generated error string table is empty!") # MSVC doesn't like zero length C arrays # so give it something defS.append({'macro':'S_generic', 'value':'1', 'desc':'placeholder'}) @@ -183,9 +180,9 @@ def run(self): outfile = os.path.join(self.build_temp, 'epicsVCS.h') if self.dry_run: - log.info("Would write %s", outfile) + print("Would write %s", outfile) else: - log.info("Writing %s", outfile) + print("Writing %s", outfile) with open(outfile, 'w') as F: F.write(""" #ifndef EPICS_VCS_VERSION @@ -214,12 +211,12 @@ def finalize_options(self): ) def run(self): - log.info("In Expand") + print("In Expand") for template, outname, files in self.distribution.x_expand or []: template = os.path.normcase(template) outname = os.path.join(self.build_temp, os.path.normcase(outname)) - log.info("expand %s -> %s", template, outname) + print("expand %s -> %s", template, outname) with open(template, 'r') as F: tmpl = F.read() @@ -257,7 +254,7 @@ def finalize_options(self): def run(self): for stem, outname in self.distribution.x_api_h or []: outname = os.path.join(self.build_lib, 'epicscorelibs', 'include', os.path.basename(outname)) - log.info('make %s -> %s', stem, outname) + print('make %s -> %s', stem, outname) out = ''' #ifndef %(guard)s #define %(guard)s @@ -315,7 +312,7 @@ def finalize_options(self): ('build_temp', 'build_temp'), ) def run(self): - log.info("In InstallHeaders") + print("In InstallHeaders") for pkg, files in (self.distribution.x_headers or {}).items(): print("Install headers for", pkg) pkgdir = os.path.join(*[self.build_lib]+pkg.split('.')) diff --git a/src/python/epicscorelibs/config.py b/src/python/epicscorelibs/config.py index 6133709fc..3a24bba27 100644 --- a/src/python/epicscorelibs/config.py +++ b/src/python/epicscorelibs/config.py @@ -1,12 +1,11 @@ """Host configuration information using EPICS names and build flags. -Patterned after distutils.sysconfig +Patterned after sysconfig """ from copy import deepcopy import platform import sysconfig -import distutils.sysconfig __all__ = ( 'get_config_var', @@ -26,7 +25,7 @@ def _makeconf(): }[platform.system()] # select epics CMPLR_CLASS - CC = sysconfig.get_config_var('CC') or distutils.sysconfig.get_config_var('CC') + CC = sysconfig.get_config_var('CC') if CC is None and osname=='WIN32': cmplrname = conf['CMPLR_CLASS'] = 'msvc' elif CC is None: