Skip to content

Commit

Permalink
Remove setup_win_python38.py and use init.py from conda (#3503)
Browse files Browse the repository at this point in the history
* Remove setup_win_python38.py and use init.py from conda, update CMakeLists.txt accordingly. Could break windows python tests

* Remove deprecated -py3 option for swig

* Update continuous_integration.yml to not use special python3.8 script

* Detect  if in dev environment and if so add path on windows

* Add install_path and debugging lines to troubleshoot ci

* Update continuous_integration.yml

enable dependencies caching on windows

* redo without dirname

* Update comments and remove debugging lines

* Update CHANGELOG.md

* Update continuous_integration.yml

restore dependencies cache on linux

* Update continuous_integration.yml

Undo cache use for dependencies in ci to avoid entanglement with unrelated issues
  • Loading branch information
aymanhab authored Jun 29, 2023
1 parent 5303561 commit e50feae
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 24 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/continuous_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ jobs:
echo "PYTHONPATH= $env:USERPROFILE/opensim-core-install/bin">> $GITHUB_ENV
# Move to the installed location of the python package.
cd ~/opensim-core-install/sdk/python
python setup_win_python38.py
# Run python tests.
python -m unittest discover --start-directory opensim/tests --verbose
Expand Down Expand Up @@ -247,7 +246,6 @@ jobs:
echo "PYTHONPATH= $env:USERPROFILE/opensim-core-install/bin">> $GITHUB_ENV
# Move to the installed location of the python package.
cd ~/opensim-core-install/sdk/python
python setup_win_python38.py
# Run python tests.
python -m unittest discover --start-directory opensim/tests --verbose
Expand Down
7 changes: 1 addition & 6 deletions Bindings/Python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ macro(OpenSimAddPythonModule)
# We run swig once to get dependencies and then again to actually generate
# the wrappers. This variable holds the parts of the swig command that
# are shared between both invocations.
set(_swig_common_args -c++ -python -py3
set(_swig_common_args -c++ -python
-I${OpenSim_SOURCE_DIR}
-I${OpenSim_SOURCE_DIR}/Bindings/
-I${Simbody_INCLUDE_DIR}
Expand Down Expand Up @@ -255,11 +255,6 @@ OpenSimPutFileInPythonPackage("${CMAKE_CURRENT_SOURCE_DIR}/setup.py" ".")
OpenSimPutFileInPythonPackage("${CMAKE_CURRENT_SOURCE_DIR}/__init__.py" opensim)

OpenSimPutFileInPythonPackage("${CMAKE_CURRENT_SOURCE_DIR}/report.py" opensim)
# for Python 3.8+/Windows we use a special script
# setup_win_python38.py to set additional dll directory in __init__.py on client machine
if (WIN32)
OpenSimPutFileInPythonPackage("${CMAKE_CURRENT_SOURCE_DIR}/setup_win_python38.py" ".")
endif()

# Test files. If you require more test resource files, list them here.
foreach(test_file
Expand Down
15 changes: 10 additions & 5 deletions Bindings/Python/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import sys
import os
if (sys.version_info.major == 3 and sys.version_info.minor >= 8 and sys.platform.startswith('win')):
if (os.path.exists(os.path.join(sys.prefix, 'conda-meta'))):
os.add_dll_directory(os.path.dirname(os.path.realpath(__file__)))
else:
os.add_dll_directory(DLL_PATH)
if (sys.platform.startswith('win')):
curFolder = os.path.dirname(os.path.realpath(__file__))
os.add_dll_directory(curFolder)
# in install env, add relative path from init.py to bin, in build environment, we also add "../../../../Release"
install_path = os.path.join(curFolder, "../../../bin")
if (os.path.exists(install_path)):
os.add_dll_directory(install_path)
dev_path = os.path.join(curFolder, "../../../../Release")
if (os.path.exists(dev_path)):
os.add_dll_directory(dev_path)

from .simbody import *
from .common import *
Expand Down
11 changes: 0 additions & 11 deletions Bindings/Python/setup_win_python38.py

This file was deleted.

1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ v4.5
- Fixed issues #3083 #2575 where analog data is not pulled out from c3d files, a a new function getAnalogDataTable() has been added to the C3DFileAdapter
- Fixed segfault that can occur when building models with unusual joint topologies (it now throws an `OpenSim::Exception` instead, #3299)
- Add `calcMomentum`, `calcAngularMomentum`, `calcLinearMomentum`, and associated `Output`s to `Model` (#3474)
- Fix issue where a different __init__.py is used by conda package and dev environment, the fix allows developers to install local builds into conda. (#3502)
- Changed control points in `SegmentedQuinticBezierToolkit` to be of `SimTK::Vec6` type instead of `SimTK::Vector` (#3481).
- Added a cylinder wrapping test: `testWrapCylinder.cpp` (#3498)

Expand Down

0 comments on commit e50feae

Please sign in to comment.