Skip to content

Commit

Permalink
Merge pull request #140 from Taka-Kazu/use-cmake-install-prefix-to-sp…
Browse files Browse the repository at this point in the history
…ecify-where-to-install-python-interface

Use CMAKE_INSTALL_PREFIX to specify where to install the python interface
  • Loading branch information
Gonzalo-Mier committed May 12, 2024
2 parents ac53c74 + f2977e7 commit 047c853
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Expand Up @@ -130,7 +130,7 @@ jobs:

- name: Test Python
working-directory: ${{github.workspace}}
run: pytest-3 tests/python/
run: PYTHONPATH=${PYTHONPATH}:instdir/lib/python$(python3 -c 'import sys; print("%i.%i" % (sys.version_info.major, sys.version_info.minor))')/site-packages pytest-3 tests/python/



Expand Down
4 changes: 2 additions & 2 deletions swig/python/CMakeLists.txt
Expand Up @@ -101,9 +101,9 @@ file(
if(Python_VERSION VERSION_GREATER_EQUAL 3)
add_custom_target(install-python
DEPENDS _fields2cover_python
COMMAND python3 ${SETUP_PY_OUT} install
COMMAND python3 ${SETUP_PY_OUT} install --prefix=${CMAKE_INSTALL_PREFIX}
)
install(CODE "execute_process(COMMAND python3 ${SETUP_PY_OUT} install)")
install(CODE "execute_process(COMMAND python3 ${SETUP_PY_OUT} install --prefix=${CMAKE_INSTALL_PREFIX})")
elseif(Python_VERSION VERSION_GREATER_EQUAL 2)
add_custom_target(
install-python
Expand Down
4 changes: 3 additions & 1 deletion swig/python/setup.py.in
Expand Up @@ -20,7 +20,9 @@ class CompiledLibInstall(setuptools.command.install.install):
filenames = '${PYTHON_INSTALL_FILES}'.split(';')

# Directory to install to
install_dir = get_python_lib()
install_dir = get_python_lib(prefix=self.prefix)
if not os.path.isdir(install_dir):
os.makedirs(install_dir)

# Install files
[shutil.copy(filename, install_dir) for filename in filenames]
Expand Down

0 comments on commit 047c853

Please sign in to comment.