trying to make sense of setuptools

This commit is contained in:
vscosta 2017-09-02 23:47:14 +01:00
parent b032803616
commit 93577a7481
5 changed files with 86 additions and 50 deletions

3
.gitignore vendored
View File

@ -213,3 +213,6 @@ cmake/compile_commands.json
cmake/cudd_config.h
cmake/docs/Doxyfile
*.stackdump
*.gz

View File

@ -5,8 +5,39 @@
include(FindPythonModule)
set (PROLOG_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/yapi.yap ${CMAKE_CURRENT_SOURCE_DIR}/jupyter.yap)
set (PYTHON_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/yapi.py ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py ${CMAKE_CURRENT_SOURCE_DIR}/__main__.py)
set (PROLOG_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/yapi.yap
${CMAKE_CURRENT_SOURCE_DIR}/jupyter.yap)
set (PYTHON_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/yap4py/yapi.py
${CMAKE_CURRENT_SOURCE_DIR}/yap4py/__init__.py
${CMAKE_CURRENT_SOURCE_DIR}/yap4py/__main__.py
)
set (PL ${pl_library} ${PROLOG_SOURCES} )
set (python_dlls
$<TARGET_FILE:libYap>
$<TARGET_FILE:YAPPython>
$<TARGET_FILE:matrix>
$<TARGET_FILE:regexp>
$<TARGET_FILE:yap_rl>
$<TARGET_FILE:tries>
$<TARGET_FILE:itries>
$<TARGET_FILE:sys>
$<TARGET_FILE:yap_random>
)
if (TARGET real)
list(APPEND python_dlls $<TARGET_FILE:real>
)
endif()
if (NOT WIN32)
list(APPEND python_dlls $<TARGET_FILE:YAP++>
)
endif()
file(RELATIVE_PATH RELATIVE_SOURCE ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR})
@ -24,7 +55,7 @@ SET_SOURCE_FILES_PROPERTIES(../../swig/yap.i PROPERTIES SWIG_MODULE_NAME yap)
if (WIN32)
set (SYS_DLLS ${GMP_LIBRARIES} c:/msys64/mingw64/bin/libgmp-10.dll)
#set (SYS_DLLS ${GMP_LIBRARIES} c:/msys64/mingw64/bin/libgmp-10.dll)
endif()
@ -39,61 +70,50 @@ endif()
# )
set (python_dlls $<TARGET_FILE:matrix>
$<TARGET_FILE:regexp>
$<TARGET_FILE:yap_rl>
$<TARGET_FILE:tries>
$<TARGET_FILE:itries>
$<TARGET_FILE:sys>
$<TARGET_FILE:yap_random>
)
if (TARGET real)
list(APPEND python_dlls $<TARGET_FILE:real>
)
endif()
if (NOT WIN32)
list(APPEND python_dlls $<TARGET_FILE:YAP++> $<TARGET_FILE:Py4YAP>
)
endif()
set (PL ${pl_library} ${PROLOG_SOURCES} )
add_custom_target( YAP4PY_SETUP
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/packages/swig/yap.i ${CMAKE_CURRENT_BINARY_DIR}
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/config.h ${CMAKE_CURRENT_BINARY_DIR}
COMMAND ${CMAKE_COMMAND} -E copy ${PYTHON_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/yap4py
COMMAND ${CMAKE_COMMAND} -E copy ${python_dlls} ${SYS_DLLS} ${CMAKE_BINARY_DIR}/libYap${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_BINARY_DIR}/${YAP_STARTUP} ${PYTHON_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/yap4py
COMMAND ${CMAKE_COMMAND} -E copy ${PL} ${CMAKE_CURRENT_BINARY_DIR}/yap4py/prolog
COMMAND ${CMAKE_COMMAND} -E copy ${pl_boot_library} ${CMAKE_CURRENT_BINARY_DIR}/yap4py/prolog/pl
COMMAND ${CMAKE_COMMAND} -E copy ${pl_os_library} ${CMAKE_CURRENT_BINARY_DIR}/yap4py/prolog/os
DEPENDS YAP4PY_SETUP_DIRS STARTUP ${python_dlls} ${PYTHON_SOURCES} ${PROLOG_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/setup.py ${SWIG_MODULE_Py2YAP_REAL_NAME} )
add_custom_target( YAP4PY_SETUP_DIRS
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/yap4py
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/yap4py/prolog
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/yap4py/prolog/pl
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/yap4py/prolog/os
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/yap4py/prolog
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/yap4py/prolog/pl
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/yap4py/prolog/os
)
add_custom_COMMAND( OUTPUT yap4py/prolog/lists,yap
COMMAND ${CMAKE_COMMAND} -E copy ${PL} yap4py/prolog
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS YAP4PY_SETUP_DIRS ${PL} )
add_custom_COMMAND( OUTPUT yap4py/prolog/pl/boot.yap
COMMAND ${CMAKE_COMMAND} -E copy ${pl_boot_library} yap4py/prolog/pl
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS YAP4PY_SETUP_DIRS ${pl_boot_library} )
add_custom_COMMAND( OUTPUT yap4py/prolog/os/yio.yap
COMMAND ${CMAKE_COMMAND} -E copy ${pl_os_library} yap4py/prolog/os
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS YAP4PY_SETUP_DIRS ${pl_os_library} )
add_custom_COMMAND( OUTPUT yap4py/startup.yss
COMMAND ${CMAKE_COMMAND} -E copy ${PYTHON_SOURCES} ${python_dlls} ${CMAKE_BINARY_DIR}/startup.yss yap4py
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS YAP4PY_SETUP_DIRS STARTUP )
add_custom_target( YAP4PY ALL
COMMAND ${PYTHON_EXECUTABLE} -m pip uninstall -y YAP4PY
COMMAND ${SWIG_EXECUTABLE} -python -modern -c++ -py3 -DX_API -I${CMAKE_SOURCE_DIR}/CXX -I${CMAKE_SOURCE_DIR}/include -I${CMAKE_SOURCE_DIR}/H -I${CMAKE_SOURCE_DIR}/H/generated -I${CMAKE_SOURCE_DIR}/OPTYap -I../../.. -o yap_wrap.cpp yap.i
COMMAND ${PYTHON_EXECUTABLE} setup.py sdist bdist_wheel
COMMAND ${PYTHON_EXECUTABLE} setup.py sdist bdist_conda
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS YAP4PY_SETUP)
DEPENDS yap4py/yapi.py yap4py/prolog/lists,yap yap4py/prolog/pl/boot.yap yap4py/startup.yss yap4py/prolog/os/yio.yap )
install(CODE "execute_process(
COMMAND ${PYTHON_EXECUTABLE} -m pip install --force --no-index -f packages/python/swig/dist YAP4PY
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})"
DEPENDS Py4YAP ${CMAKE_BINARY_DIR}/${YAP_STARTUP} ${dlls} )
install(CODE "execute_process"
COMMAND ${PYTHON_EXECUTABLE} -m pip install --force --no-index -f packages/python/swig/dist YAP4PY
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
DEPENDS YAP4PY ${CMAKE_BINARY_DIR}/${YAP_STARTUP} ${dlls} )
install(FILES ${PROLOG_SOURCES} DESTINATION ${libpl})
if (WITH_DOCS AND DOXYGEN_FOUND)
if (WITH_DOCS AND DOXYGEN_FOUND)
set(CMAKE_SWIG_FLAGS -DDOXYGEN=${DOXYGEN_FOUND})

View File

@ -1,8 +1,9 @@
# include COPYING.md
# include CONTRIBUTING.md
include README.md
recursive-include * *.*
recursive-include yap4py/prolog *.*
recursive-include html *.*
recursive-include docs *.*
# Documentation
graft docs

View File

@ -0,0 +1,6 @@
[build]
compiler=mingw32
[build_ext]
compiler=mingw32

View File

@ -84,9 +84,9 @@ extensions = [Extension('_yap', native_sources,
'-DX_API', '-I${CMAKE_SOURCE_DIR}/CXX', '-I${CMAKE_SOURCE_DIR}/include',
'-I${CMAKE_SOURCE_DIR}/H', '-I${CMAKE_SOURCE_DIR}/H/generated',
'-I${CMAKE_SOURCE_DIR}/os', '-I${CMAKE_SOURCE_DIR}/OPTYap', '-I../../..'],
library_dirs=['../../..', '../../../CXX', '..', "${dlls}", "${bindir}", '.'],
library_dirs=['../../..', '../../../CXX', '..', "${dlls}", "${bindir}", 'c:/Anaconda3'],
extra_link_args=my_extra_link_args,
libraries=['Yap','${PYTHON_LIBRARIES}','${GMP_LIBRARIES}']+win_libs+local_libs,
libraries=['Yap','YAPPython','python3','yap']+win_libs+local_libs,
include_dirs=['../../..',
'${GMP_INCLUDE_DIRS}',
'${CMAKE_SOURCE_DIR}/H',
@ -112,7 +112,7 @@ def visit(d0, pls):
package_data = {
'': visit('.', [])
'yap4py.prolog': """${PL}""".split(sep=";")
}
version_ns = {'__version__': '6.3.5', 'minor-version': '6', 'minor-version': '3', 'patch': '5'}
@ -125,6 +125,12 @@ setup_args = dict(
py_modules=['yap'],
package_data=package_data,
include_package_data=True,
requirements=[
'm2w64-gmp',
'm2-msys2-keyring',
'm2-msys2-launcher-git',
'm2-msys2-runtime',
],
description="YAP in Python",
author='YAP Development Team',
author_email='ipython-dev@scipy.org',