diff --git a/Python/shapeworks/README.md b/Python/shapeworks/README.md deleted file mode 100644 index e49abe8fc3..0000000000 --- a/Python/shapeworks/README.md +++ /dev/null @@ -1,15 +0,0 @@ -### ShapeWorks Python module - -Our shapeworks module with associated libraries also needs the compiled portion -of the library, which will be in ShapeWorks/bin directory when installed or the -build/bin directory during development. Environment setup functions -automatically add it, so for development, just ensure PYTHONPATH begins with the -path to this directory and `import shapeworks` will work. - -Ensure the module is importable with the following in python: -``` ->>> import shapeworks - ->>> shapeworks.utils.postive_factors(10) -[1, 2, 5, 10] -``` diff --git a/Python/shapeworks/bld.bat b/Python/shapeworks/bld.bat deleted file mode 100644 index 20e1d25591..0000000000 --- a/Python/shapeworks/bld.bat +++ /dev/null @@ -1,2 +0,0 @@ -ECHO "copying to conda package..." -COPY bin,lib,shapeworks %PREFIX% diff --git a/Python/shapeworks/build.sh b/Python/shapeworks/build.sh deleted file mode 100644 index dfeb689b06..0000000000 --- a/Python/shapeworks/build.sh +++ /dev/null @@ -1,2 +0,0 @@ -echo "copying to conda package..." -cp -r bin lib shapeworks ${PREFIX} diff --git a/Python/shapeworks/meta.yaml b/Python/shapeworks/meta.yaml deleted file mode 100644 index 936fa91e36..0000000000 --- a/Python/shapeworks/meta.yaml +++ /dev/null @@ -1,56 +0,0 @@ -{% set name = "shapeworks" %} -{% set version = "6.0b" %} - -package: - name: "{{ name|lower }}" - version: "{{ version }}" - -source: - path: . - -build: - binary_relocation: False -# number: 0 -# script: "{{ PYTHON }} -m pip install . -vv" - -requirements: - # host: - # - appdirs - # - imageio - # - meshio >=4.0.3 - # - numpy - # - pillow - # - pip - # - python - # - scooby >=0.5.1 - # - vtk - run: - - notebook - - numpy 1.19.1 - - python 3.7.8 - - vtk - -# test: -# imports: -# - shapeworks -# - shapeworks.utils - # - pyvista.demos - # - pyvista.examples - # - pyvista.plotting - # - pyvista.utilities - -about: - home: "https://github.com/SCIInstitute/ShapeWorks" - license: GPL - license_family: GPL - license_file: - summary: "ShapeWorks" - doc_url: - dev_url: - -extra: - recipe-maintainers: - - cchriste - - archanasri - - akenmorris - - sheryjoe diff --git a/Python/shapeworks/setup.py b/Python/shapeworks/setup.py index 9ff17b2f8a..c442702e26 100644 --- a/Python/shapeworks/setup.py +++ b/Python/shapeworks/setup.py @@ -2,8 +2,9 @@ # Note: our package also needs the compiled portion of the library, which will # be in ShapeWorks/bin directory when installed, and environment setup functions -# automatically add it. For development, just ensure PYTHONPATH begins with -# `/path/to/code/ShapeWorks/Python/shapeworks` and it should all work. +# automatically add it. +# +# For development, source ../devenv.sh, passing the root source and build dirs. setuptools.setup( name='shapeworks', diff --git a/devenv.bat b/devenv.bat new file mode 100644 index 0000000000..cf036d3985 --- /dev/null +++ b/devenv.bat @@ -0,0 +1,32 @@ +rem +rem Configures developer environment such that: +rem - PATH and PYTHONPATH point to $BUILD/bin +rem - PYTHONPATH points to each module in $SOURCE/Python +rem +rem Example when build directory is inside source: +rem (shapeworks) ~/code/ShapeWorks$ source ./devenv.sh `pwd` `pwd`/build_debug +rem +rem After sourcing this, processes in the environment will use executables from +rem the given build and import modules from the developer's source (including the +rem compiled portion of the Python bindings). +rem + +set argC=0 +for %%x in (%*) do Set /A argC+=1 +echo %argC% + +if not %argC%==2 ( + echo Must call using "devenv SOURCE_DIR BUILD_DIR" + goto :eof +) + +set SOURCE=%~1 +set BUILD=%~2 +echo source: %SOURCE% +echo build: %BUILD% + +set PATH=%BUILD%\bin;%PATH% +set PYTHONPATH=%BUILD%\bin;%PYTHONPATH% + +rem add each module in ${SOURCE}/Python to the PYTHONPATH +for /d %%D in ("%SOURCE%\Python\*") DO for /d %%M in ("%%D\*") DO call set PYTHONPATH=%%M;%%PYTHONPATH%% diff --git a/devenv.sh b/devenv.sh new file mode 100644 index 0000000000..48db4842c0 --- /dev/null +++ b/devenv.sh @@ -0,0 +1,35 @@ +# +# Configures developer environment such that: +# - PATH and PYTHONPATH point to $BUILD/bin +# - PYTHONPATH points to each module in $SOURCE/Python +# +# Example when build directory is inside source: +# (shapeworks) ~/code/ShapeWorks$ source ./devenv.sh `pwd` `pwd`/build_debug +# +# After sourcing this, processes in the environment will use executables from +# the given build and import modules from the developer's source (including the +# compiled portion of the Python bindings). +# + +(return 0 2>/dev/null) && sourced=1 || sourced=0 + +if [[ "$sourced" == "0" ]]; then + echo "ERROR: must call this script using \"source ./devenv.sh \"" + exit 1 +fi + +if [[ "$#" -ne 2 ]]; then + echo "ERROR: must pass both SOURCE_DIR and BUILD_DIR" + exit 1 +fi + +SOURCE=$1 +BUILD=$2 + +export PATH=${BUILD}/bin:$PATH +export PYTHONPATH=${BUILD}/bin:$PYTHONPATH + +# add each module in ${SOURCE}/Python to the PYTHONPATH +for M in ${SOURCE}/Python/*/; do + export PYTHONPATH=${M}:$PYTHONPATH +done