Skip to content

Commit 5716f11

Browse files
authored
Merge pull request #402 from mgorny/wheel-build-fix
Fix build to avoid duplicate files in wheel
2 parents 3528389 + 05c02a1 commit 5716f11

File tree

4 files changed

+17
-7
lines changed

4 files changed

+17
-7
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ foreach (PKG MPC MPFR PIRANHA FLINT LLVM)
4444
set(HAVE_SYMENGINE_${PKG} False)
4545
endif()
4646
endforeach()
47+
option(SYMENGINE_INSTALL_PY_FILES "Install python files" ON)
4748

4849
message("CMAKE_SYSTEM_PROCESSOR : ${CMAKE_SYSTEM_PROCESSOR}")
4950
message("CMAKE_BUILD_TYPE : ${CMAKE_BUILD_TYPE}")

setup.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,9 @@ def cmake_build(self):
112112
os.remove("CMakeCache.txt")
113113

114114
cmake_cmd = ["cmake", source_dir,
115-
"-DCMAKE_BUILD_TYPE=" + cmake_build_type[0]]
115+
"-DCMAKE_BUILD_TYPE=" + cmake_build_type[0],
116+
"-DSYMENGINE_INSTALL_PY_FILES=OFF",
117+
]
116118
cmake_cmd.extend(process_opts(cmake_opts))
117119
if not path.exists(path.join(build_dir, "CMakeCache.txt")):
118120
cmake_cmd.extend(self.get_generator())
@@ -226,7 +228,7 @@ def finalize_options(self):
226228
url="https://github.com/symengine/symengine.py",
227229
python_requires='>=3.7,<4',
228230
zip_safe=False,
229-
packages=['symengine'],
231+
packages=['symengine', 'symengine.lib', 'symengine.tests'],
230232
cmdclass = cmdclass,
231233
classifiers=[
232234
'License :: OSI Approved :: MIT License',

symengine/CMakeLists.txt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
add_subdirectory(lib)
2-
add_subdirectory(tests)
32

4-
set(PY_PATH ${PYTHON_INSTALL_PATH}/symengine)
5-
install(FILES __init__.py utilities.py sympy_compat.py functions.py printing.py
6-
DESTINATION ${PY_PATH}
3+
if (SYMENGINE_INSTALL_PY_FILES)
4+
add_subdirectory(tests)
5+
6+
set(PY_PATH ${PYTHON_INSTALL_PATH}/symengine)
7+
install(FILES __init__.py utilities.py sympy_compat.py functions.py printing.py
8+
DESTINATION ${PY_PATH}
79
)
10+
endif ()

symengine/lib/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,18 @@ install(TARGETS symengine_wrapper
2828
ARCHIVE DESTINATION ${PY_PATH}
2929
LIBRARY DESTINATION ${PY_PATH}
3030
)
31-
install(FILES __init__.py
31+
install(FILES
3232
${CMAKE_CURRENT_BINARY_DIR}/config.pxi
3333
symengine.pxd
3434
symengine_wrapper.pxd
3535
pywrapper.h
3636
DESTINATION ${PY_PATH}
3737
)
3838

39+
if (SYMENGINE_INSTALL_PY_FILES)
40+
install(FILES __init__.py DESTINATION ${PY_PATH})
41+
endif ()
42+
3943
if (${SYMENGINE_COPY_EXTENSION})
4044
if ("${PYTHON_EXTENSION_SOABI}" MATCHES "ppc64le")
4145
string(REPLACE "ppc64le" "powerpc64le" COPY_PYTHON_EXTENSION_SOABI "${PYTHON_EXTENSION_SOABI}")

0 commit comments

Comments
 (0)