add setup.py macro handling; fix test command and artifact name
authorrobin
Mon, 23 Aug 2021 15:51:48 +0100
changeset 92 0b0a17f9d877
parent 91 c88d10cdad57
child 93 d900ddb6b63a
add setup.py macro handling; fix test command and artifact name
.github/workflows/buildwheels.yml
setup.py
--- a/.github/workflows/buildwheels.yml	Mon Aug 23 15:49:03 2021 +0100
+++ b/.github/workflows/buildwheels.yml	Mon Aug 23 15:51:48 2021 +0100
@@ -33,7 +33,7 @@
       #CIBW_BEFORE_TEST: pip install --no-cache-dir pyphen
       #CIBW_TEST_REQUIRES: "${{ matrix.os != 'macos-latest' && 'pyphen pycairo rlPyCairo' || 'pyphen' }}"
       CIBW_TEST_SKIP: "*-macosx*"
-      CIBW_TEST_COMMAND: python -c "import sys,os;r=os.system(' '.join((sys.executable,os.path.join(r'{project}','setup.py'),'test')));sys.exit(('!!!!! test command --> %s !!!!!'%r) if r else r)"
+      CIBW_TEST_COMMAND: python -c "import sys,os;r=os.system(' '.join((sys.executable,os.path.join(r'{project}','setup.py'),'test')));sys.exit(('===== test command --> %s ====='%r) if r else r)"
       CIBW_BUILD_VERBOSITY: 3
     strategy:
       fail-fast: true
@@ -67,7 +67,7 @@
 
       - uses: actions/upload-artifact@v2
         with:
-          name: lin-win-mac
+          name: pyrxp-lin-win-mac
           path: ./wheelhouse/*.whl
   email:
     name: email
--- a/setup.py	Mon Aug 23 15:49:03 2021 +0100
+++ b/setup.py	Mon Aug 23 15:51:48 2021 +0100
@@ -15,7 +15,6 @@
 			raise ValueError('test command may only be used alone sys.argv[1:]=%s' % repr(sys.argv[1:]))
 		cmd = sys.argv[-1]
 		os.chdir(os.path.join(pkgDir,'test'))
-		
 		r = os.system(' '.join((sys.executable, 'runAll.py')))
 		sys.exit(('!!!!! runAll.py --> %s exited with error !!!!!' % r) if r else r)
 	elif 'null-cmd' in sys.argv or 'null-command' in sys.argv:
@@ -36,6 +35,15 @@
 	LIBRARIES=[]
 	EXT_MODULES = []
 	EXT_KWARGS = {}
+	DEFINE_MACROS=[('CHAR_SIZE', 16)]
+	for ev in ('DEBUG_INPUT',):
+		evv = os.environ.get(ev,'')
+		try:
+			evv = int(evv)
+		except:
+			pass
+		if os.environ.get(ev,''):
+			DEFINE_MACROS.append((ev,evv))
 
 	#building pyRXP
 	if sys.platform=="win32":
@@ -64,7 +72,7 @@
 	EXT_MODULES =	[Extension( 'pyRXPU',
 								[pyRXP_c]+RXPLIBSOURCES,
 								include_dirs=[RXPDIR],
-								define_macros=[('CHAR_SIZE', 16),],
+								define_macros=DEFINE_MACROS,
 								library_dirs=[],
 								# libraries to link against
 								libraries=LIBS,