55
66from glob import glob
77
8- from distutils import log
9- from distutils .errors import CompileError
108from setuptools import Command , Distribution
119from setuptools_dso import DSO , Extension , setup , build_dso , ProbeToolchain
1210from epicscorelibs .config import get_config_var
@@ -48,8 +46,8 @@ def cexpand(iname, oname, defs={}, dry_run=False):
4846
4947 defs dict used to expand "@MACRO@", or replace "#cmakedefine MACRO VALUE" lines
5048 """
51- log . info ('expand %s -> %s' , iname , oname )
52- log . debug ('With %s' , defs )
49+ print ('expand %s -> %s' , iname , oname )
50+ print ('With %s' , defs )
5351 with open (iname , 'r' ) as F :
5452 inp = F .read ()
5553
@@ -70,12 +68,12 @@ def csub(M):
7068 out = re .sub (r'^\s*#\s*cmakedefine\s+([^\s]+)(?:\s+(.*))?$' , csub , out , 0 , re .MULTILINE )
7169
7270 if dry_run :
73- log . info ('Would write %s' , oname )
71+ print ('Would write %s' , oname )
7472 else :
75- log . info ('Write %s' , oname )
76- log . info ('>>>>>>>>' )
77- log . info ('%s' , out )
78- log . info ('<<<<<<<<' )
73+ print ('Write %s' , oname )
74+ print ('>>>>>>>>' )
75+ print ('%s' , out )
76+ print ('<<<<<<<<' )
7977 with open (oname , 'w' ) as F :
8078 F .write (out )
8179
@@ -108,7 +106,7 @@ def finalize_options(self):
108106
109107 @logexc
110108 def run (self ):
111- log . info ("In Expand" )
109+ print ("In Expand" )
112110 self .mkpath (os .path .join (self .build_temp , 'event2' ))
113111 self .mkpath (os .path .join (self .build_lib , 'pvxslibs' , 'include' , 'pvxs' ))
114112 self .mkpath (os .path .join (self .build_lib , 'pvxslibs' , 'dbd' ))
@@ -373,7 +371,9 @@ def run(self):
373371 mangled_type = type .upper ().replace (' ' ,'_' ).replace ('*' , 'P' )
374372 try :
375373 DEFS ['EVENT__SIZEOF_' + mangled_type ] = str (probe .sizeof (type ))
376- except CompileError :
374+ except Exception as e :
375+ if e .__class__ .__name__ != 'CompileError' :
376+ raise # see https://github.com/epics-base/setuptools_dso/issues/45
377377 DEFS ['EVENT__SIZEOF_' + mangled_type ] = '0'
378378 DEFS ['EVENT__HAVE_' + mangled_type ] = None
379379 else :
@@ -382,7 +382,9 @@ def run(self):
382382 try :
383383 DEFS ['EVENT__SIZEOF_SSIZE_T' ] = str (probe .sizeof ('ssize_t' ))
384384 DEFS ['EVENT__ssize_t' ] = 'ssize_t'
385- except CompileError :
385+ except Exception as e :
386+ if e .__class__ .__name__ != 'CompileError' :
387+ raise # see https://github.com/epics-base/setuptools_dso/issues/45
386388 DEFS ['EVENT__SIZEOF_SSIZE_T' ] = str (probe .sizeof ('SSIZE_T' ))
387389 DEFS ['EVENT__ssize_t' ] = 'SSIZE_T'
388390 # libevent CMakeLists.txt defaults to 'int' if neither is available, which seems wrong...
@@ -425,9 +427,9 @@ def run(self):
425427 DEFS , dry_run = self .dry_run )
426428
427429 if self .dry_run :
428- log . info ('Would create pvxsVCS.h' )
430+ print ('Would create pvxsVCS.h' )
429431 else :
430- log . info ('Writing pvxsVCS.h' )
432+ print ('Writing pvxsVCS.h' )
431433 with open (os .path .join (self .build_temp , 'pvxsVCS.h' ), 'w' ) as F :
432434 F .write ('''
433435#ifndef PVXS_VCS_VERSION
@@ -452,7 +454,7 @@ def finalize_options(self):
452454 ('build_temp' , 'build_temp' ),
453455 )
454456 def run (self ):
455- log . info ("In InstallHeaders" )
457+ print ("In InstallHeaders" )
456458
457459 for header in glob ('src/pvxs/*.h' ):
458460 self .copy_file (header ,
@@ -713,7 +715,6 @@ def define_DSOS(self):
713715 license = 'BSD' ,
714716 classifiers = [
715717 'Development Status :: 5 - Production/Stable' ,
716- 'Programming Language :: Python :: 2.7' ,
717718 'Programming Language :: Python :: 3' ,
718719 'Programming Language :: Python :: Implementation :: CPython' ,
719720 'Intended Audience :: Science/Research' ,
@@ -725,7 +726,7 @@ def define_DSOS(self):
725726 'Operating System :: Microsoft :: Windows' ,
726727 ],
727728 keywords = 'epics scada' ,
728- python_requires = '>=2.7 ' ,
729+ python_requires = '>=3.8 ' ,
729730
730731 # setup/build time dependencies listed in pyproject.toml
731732 # cf. PEP 518
0 commit comments