Skip to content

Commit

Permalink
ENH: added setuptools for python
Browse files Browse the repository at this point in the history
  • Loading branch information
adler-j committed Nov 27, 2015
1 parent 5a6e002 commit a9a6388
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# Compiled Python
__pycache__/
*.py[cod]

*.cache

# Executables
*.exe
Expand Down
6 changes: 4 additions & 2 deletions src/swig/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ if(BUILD_SWIG_PYTHON OR BUILD_SWIG_OCTAVE OR BUILD_SWIG_MATLAB)
endif()

if(BUILD_SWIG_PYTHON)

FIND_PACKAGE(PythonLibs REQUIRED)
FIND_PACKAGE(Numpy REQUIRED)
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH} ${PYTHON_NUMPY_INCLUDE_DIR})
Expand All @@ -52,8 +51,11 @@ if(BUILD_SWIG_PYTHON)
set(PYTHON_DEST ${CMAKE_INSTALL_PREFIX}/python CACHE PATH "Destination for python module")
INSTALL(TARGETS ${SWIG_MODULE_stir_REAL_NAME} DESTINATION ${PYTHON_DEST})
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/stir.py DESTINATION ${PYTHON_DEST})
INSTALL(FILES stirextra.py DESTINATION ${PYTHON_DEST})
INSTALL(FILES stirextra.py DESTINATION ${PYTHON_DEST})

# Install STIR as a package
INSTALL(FILES __init__.py DESTINATION ${PYTHON_DEST})
INSTALL(CODE "EXECUTE_PROCESS(COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/setup.py install WORKING_DIRECTORY ${PYTHON_DEST})")
endif(BUILD_SWIG_PYTHON)

if (BUILD_SWIG_OCTAVE)
Expand Down
2 changes: 2 additions & 0 deletions src/swig/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from stir import *
import stirextra
9 changes: 9 additions & 0 deletions src/swig/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from distutils.core import setup

setup(name='stir',
version='3.0.0',
url='https://github.com/UCL/STIR',
description='STIR: Software for Tomographic Image Reconstruction',
packages=['stir'],
package_dir={'stir': '.'},
package_data={'stir': ['*.*']})
2 changes: 1 addition & 1 deletion src/swig/test/python/test_IO.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# See STIR/LICENSE.txt for details

from stir import *
from stirextra import *
from stir.stirextra import *
import os
# for Python2 and itertools.zip->zip (as in Python 3)
try:
Expand Down
1 change: 0 additions & 1 deletion src/swig/test/python/test_numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import py.test
from stir import *
import stirextra
# for Python2 and itertools.zip->zip (as in Python 3)
try:
import itertools.izip as zip
Expand Down

0 comments on commit a9a6388

Please sign in to comment.