Python: More setup cleanup
Vicki Pfau vi@endrift.com
Thu, 28 Jun 2018 15:46:26 -0700
3 files changed,
4 insertions(+),
39 deletions(-)
M
src/platform/python/CMakeLists.txt
→
src/platform/python/CMakeLists.txt
@@ -5,8 +5,10 @@ include_directories(AFTER ${PYTHON_INCLUDE_DIRS})
get_property(INCLUDE_DIRECTORIES DIRECTORY PROPERTY INCLUDE_DIRECTORIES) set(INCLUDE_FLAGS) +set(INCLUDE_FLAGS_STR "") foreach(DIR IN LISTS INCLUDE_DIRECTORIES) - list(APPEND INCLUDE_FLAGS "-I${DIR}") + list(APPEND INCLUDE_FLAGS "-I${DIR}") + set(INCLUDE_FLAGS_STR "${INCLUDE_FLAGS_STR} \"-I${DIR}\"") endforeach() file(GLOB PYTHON_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/*.h)@@ -64,5 +66,5 @@ string(REPLACE ".py" "" TEST_NAME "${TEST_NAME}")
add_test(NAME python-${TEST_NAME} COMMAND ${PYTHON_EXECUTABLE} setup.py build -b ${CMAKE_CURRENT_BINARY_DIR} pytest --extras --addopts ${TEST} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) - set_tests_properties(python-${TEST_NAME} PROPERTIES ENVIRONMENT "${PATH}=${CMAKE_CURRENT_BINARY_DIR}/..;BINDIR=${CMAKE_CURRENT_BINARY_DIR}/..;LIBDIR=${CMAKE_CURRENT_BINARY_DIR}/..;CPPFLAGS=${INCLUDE_FLAGS}") + set_tests_properties(python-${TEST_NAME} PROPERTIES ENVIRONMENT "${PATH}=${CMAKE_CURRENT_BINARY_DIR}/..;BINDIR=${CMAKE_CURRENT_BINARY_DIR}/..;LIBDIR=${CMAKE_CURRENT_BINARY_DIR}/..;CPPFLAGS=${INCLUDE_FLAGS_STR}") endforeach()
M
src/platform/python/_builder.py
→
src/platform/python/_builder.py
@@ -13,8 +13,6 @@ libdir = os.environ.get("LIBDIR")
cpp = shlex.split(os.environ.get("CPP", "cc -E")) cppflags = shlex.split(os.environ.get("CPPFLAGS", "")) -if __name__ == "__main__": - cppflags.extend(sys.argv[1:]) cppflags.extend(["-I" + incdir, "-I" + srcdir, "-I" + bindir]) ffi.set_source("mgba._pylib", """
D
src/platform/python/setup.py.in
@@ -1,35 +0,0 @@
-from setuptools import setup -import re -import os -import sys - -os.environ["BINDIR"] = "${CMAKE_BINARY_DIR}" -os.environ["LIBDIR"] = "${CMAKE_INSTALL_PREFIX}/${LIBDIR}" -os.environ["CPPFLAGS"] = " ".join([d for d in "${INCLUDE_FLAGS}".split(";") if d]) - -classifiers = [ - "Programming Language :: C", - "Programming Language :: Python :: 2", - "Programming Language :: Python :: 3", - "License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)", - "Topic :: Games/Entertainment", - "Topic :: System :: Emulators" -] - -setup(name="${BINARY_NAME}", - version="${LIB_VERSION_STRING}", - author="Jeffrey Pfau", - author_email="jeffrey@endrift.com", - url="http://github.com/mgba-emu/mgba/", - packages=["mgba"], - package_dir={ - "mgba": "${CMAKE_CURRENT_SOURCE_DIR}/mgba" - }, - setup_requires=['cffi>=1.6', 'pytest-runner'], - install_requires=['cffi>=1.6', 'cached-property'], - extras_require={'pil': ['Pillow>=2.3'], 'cinema': ['pyyaml', 'pytest']}, - tests_require=['pytest'], - cffi_modules=["${CMAKE_CURRENT_SOURCE_DIR}/_builder.py:ffi"], - license="MPL 2.0", - classifiers=classifiers - )