Skip to content

Commit

Permalink
add devenv scripts; remove unnecessary stuff from shapeworks python m…
Browse files Browse the repository at this point in the history
…odule
  • Loading branch information
cchriste committed Jun 21, 2021
1 parent 1a8a1fa commit 932c445
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 77 deletions.
15 changes: 0 additions & 15 deletions Python/shapeworks/README.md

This file was deleted.

2 changes: 0 additions & 2 deletions Python/shapeworks/bld.bat

This file was deleted.

2 changes: 0 additions & 2 deletions Python/shapeworks/build.sh

This file was deleted.

56 changes: 0 additions & 56 deletions Python/shapeworks/meta.yaml

This file was deleted.

5 changes: 3 additions & 2 deletions Python/shapeworks/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
32 changes: 32 additions & 0 deletions devenv.bat
Original file line number Diff line number Diff line change
@@ -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%%
35 changes: 35 additions & 0 deletions devenv.sh
Original file line number Diff line number Diff line change
@@ -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 <source_dir> <build_dir>\""
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

0 comments on commit 932c445

Please sign in to comment.