Add test for before_build executing in a shell
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"CIBW_BEFORE_BUILD": "{python} -c \"import sys; open('/tmp/pythonversion.txt', 'w').write(sys.version)\"",
|
||||
"CIBW_BEFORE_BUILD_WINDOWS": "{python} -c \"import sys; open('c:\\pythonversion.txt', 'w').write(sys.version)\""
|
||||
"CIBW_BEFORE_BUILD": "{python} -c \"import sys; open('/tmp/pythonversion.txt', 'w').write(sys.version)\" && {python} -c \"import sys; open('/tmp/pythonexecutable.txt', 'w').write(sys.executable)\"",
|
||||
"CIBW_BEFORE_BUILD_WINDOWS": "{python} -c \"import sys; open('c:\\pythonversion.txt', 'w').write(sys.version)\" && {python} -c \"import sys; open('c:\\pythonexecutable.txt', 'w').write(sys.executable)\""
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
from setuptools import setup, Extension
|
||||
import sys
|
||||
import sys, os
|
||||
|
||||
if sys.argv[-1] != '--name':
|
||||
# assert that the Python version as written to version.txt in the CIBW_BEFORE_BUILD step
|
||||
# assert that the Python version as written to pythonversion.txt in the CIBW_BEFORE_BUILD step
|
||||
# is the same one as is currently running.
|
||||
version_file = 'c:\\pythonversion.txt' if sys.platform == 'win32' else '/tmp/pythonversion.txt'
|
||||
with open(version_file) as f:
|
||||
@@ -11,6 +11,20 @@ if sys.argv[-1] != '--name':
|
||||
print('sys.version', sys.version)
|
||||
assert stored_version == sys.version
|
||||
|
||||
# check that the executable also was written
|
||||
executable_file = 'c:\\pythonexecutable.txt' if sys.platform == 'win32' else '/tmp/pythonexecutable.txt'
|
||||
with open(executable_file) as f:
|
||||
stored_executable = f.read()
|
||||
|
||||
stored_executable_real = os.path.realpath(stored_executable)
|
||||
sys_executable_real = os.path.realpath(sys.executable)
|
||||
|
||||
print('stored_executable_real', stored_executable_real)
|
||||
print('sys_executable_real', sys_executable_real)
|
||||
assert stored_executable_real == sys_executable_real
|
||||
|
||||
print('PATH', os.environ['PATH'])
|
||||
|
||||
setup(
|
||||
name="spam",
|
||||
ext_modules=[Extension('spam', sources=['spam.c'])],
|
||||
|
||||
Reference in New Issue
Block a user