Skip to content

Commit

Permalink
check site-packages directory names
Browse files Browse the repository at this point in the history
  • Loading branch information
yomichi committed Mar 19, 2024
1 parent f9e78bd commit c477c58
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 31 deletions.
4 changes: 0 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,9 @@ else()
list(GET result 0 Python3_VERSION_MAJOR)
list(GET result 1 Python3_VERSION_MINOR)
list(GET result 2 Python3_VERSION_MICRO)
# message(STATUS "Python version: ${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}.${Python3_VERSION_MICRO}")
set(python_version_mm "${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}")
endif()

message(STATUS "Python: ${PYTHON_EXECUTABLE}")
message(STATUS "Python version (X.Y): ${python_version_mm}")

add_subdirectory(src/dla)
if(MPI_FOUND)
add_subdirectory(src/pmwa)
Expand Down
8 changes: 2 additions & 6 deletions tool/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
set(pythonpath_build "${CMAKE_CURRENT_BINARY_DIR}/pythonmodule")
set(pythonpath_path "${CMAKE_CURRENT_BINARY_DIR}/pythonmodule/lib/python${python_version_mm}/site-packages")
set(ENV{PYTHONPATH} "${pythonpath_build}:$ENV{PYTHONPATH}")

file(COPY dsqss DESTINATION ${CMAKE_CURRENT_BINARY_DIR})

set(dla_scripts
Expand All @@ -24,7 +20,7 @@ configure_file(cmake/dsqssvars.sh.in
${CMAKE_CURRENT_BINARY_DIR}/dsqssvars-${DSQSS_VERSION}.sh @ONLY)
configure_file(cmake/install.sh.in ${CMAKE_CURRENT_BINARY_DIR}/install.sh @ONLY)

install(FILES ${CMAKE_CURRENT_BINARY_DIR}/dsqssvars-${DSQSS_VERSION}.sh
DESTINATION share/dsqss)
# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/dsqssvars-${DSQSS_VERSION}.sh
# DESTINATION share/dsqss)
install(
CODE "execute_process(COMMAND sh ${CMAKE_CURRENT_BINARY_DIR}/install.sh)")
1 change: 0 additions & 1 deletion tool/cmake/dla_alg.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import sys
sys.path.append('@CMAKE_CURRENT_BINARY_DIR@')
sys.path.append('@pythonpath_build@')
from dsqss.dla_alg import main
if __name__ == '__main__':
main()
1 change: 0 additions & 1 deletion tool/cmake/dla_hamgen.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import sys
sys.path.append('@CMAKE_CURRENT_BINARY_DIR@')
sys.path.append('@pythonpath_build@')
from dsqss.std_model import main
if __name__ == '__main__':
main()
1 change: 0 additions & 1 deletion tool/cmake/dla_latgen.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import sys
sys.path.append('@CMAKE_CURRENT_BINARY_DIR@')
sys.path.append('@pythonpath_build@')
from dsqss.std_lattice import main
if __name__ == '__main__':
main()
1 change: 0 additions & 1 deletion tool/cmake/dla_pgen.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import sys
sys.path.append('@CMAKE_CURRENT_BINARY_DIR@')
sys.path.append('@pythonpath_build@')
from dsqss.parameter import main
if __name__ == '__main__' :
main()
1 change: 0 additions & 1 deletion tool/cmake/dla_pre.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!@PYTHON_EXECUTABLE@
import sys
sys.path.append('@CMAKE_CURRENT_BINARY_DIR@')
sys.path.append('@pythonpath_build@')
from dsqss.dla_pre import main
if __name__ == '__main__' :
main()
1 change: 0 additions & 1 deletion tool/cmake/dla_wvgen.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import sys
sys.path.append('@CMAKE_CURRENT_BINARY_DIR@')
sys.path.append('@pythonpath_build@')
from dsqss.wavevector import main
if __name__ == '__main__':
main()
22 changes: 12 additions & 10 deletions tool/cmake/install.sh.in
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
PYTHONPATH_BUILD=@pythonpath_build@
export PYTHONPATH=@pythonpath_path@
PREFIX=@CMAKE_INSTALL_PREFIX@
# export PIPX_HOME=@CMAKE_INSTALL_PREFIX@/pipx
# export PIPX_BIN_DIR=@CMAKE_INSTALL_PREFIX@/bin

cd @CMAKE_CURRENT_BINARY_DIR@

find @CMAKE_INSTALL_PREFIX@/bin -name 'dla_*' | xargs rm -f
rm -f @CMAKE_INSTALL_PREFIX@/bin/pmwa_pre
# echo "-- Installing poetry to $PYTHONPATH_BUILD"
# @PYTHON_EXECUTABLE@ -m pip install --prefix=$PYTHONPATH_BUILD poetry-core poetry
echo "-- Installing dsqss tools to $PREFIX"
# echo "--- PYTHONPATH=$PYTHONPATH"
# PYTHONPATH=$PYTHONPATH @PYTHON_EXECUTABLE@ -c 'import poetry; print(poetry.__path__)'
@PYTHON_EXECUTABLE@ -m pip install --prefix=$PREFIX --no-deps @CMAKE_CURRENT_SOURCE_DIR@

echo "export PATH=${PREFIX}/bin:\$PATH" > dsqssvars.sh

# Some systems like Ubuntu 22.04 install python packages under ${PREFIX}/local instead of ${PREFIX}
if [ -d ${PREFIX}/local ]; then
echo "export PATH=${PREFIX}/local/bin:\$PATH" >> dsqssvars.sh
fi
DSQSS_PYTHONPATH=$(@PYTHON_EXECUTABLE@ @CMAKE_CURRENT_SOURCE_DIR@/cmake/get_site_packages.py $PREFIX)

echo "export PYTHONPATH=${DSQSS_PYTHONPATH}:\$PYTHONPATH" >> dsqssvars.sh
mkdir -p ${PREFIX}/share/dsqss
cp dsqssvars.sh ${PREFIX}/share/dsqss/dsqssvars-@[email protected]
1 change: 0 additions & 1 deletion tool/cmake/pmwa_pre.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import sys
sys.path.append('@CMAKE_CURRENT_BINARY_DIR@')
sys.path.append('@pythonpath_build@')
from dsqss.pmwa_pre import main
if __name__ == '__main__' :
main()
9 changes: 5 additions & 4 deletions tool/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ packages = [

[tool.poetry.dependencies]
python = "^3.6"
numpy = "^1.17"
toml = ">= 0.10.0"
scipy = "^1"
typing-extensions = "^3.7.4"
# Users should install dependencies by themselves
# numpy = "^1.17"
# toml = ">= 0.10.0"
# scipy = "^1"
# typing-extensions = "^3.7.4"

[tool.poetry.dev-dependencies]

Expand Down

0 comments on commit c477c58

Please sign in to comment.