Skip to content

Commit 59dd4e7

Browse files
committed
cmake edits to adjust for gaffer 0.59, python3
fixing python code to run with Python 3 Adding cmake option to specify python version with PYTHON_VERSION arg Adding cmake option to specify python version with PYTHON_VERSION arg Readme Python 3 note Removing nasty build folder + build.sh cmake using python version directly readme update
1 parent cf3057f commit 59dd4e7

File tree

9 files changed

+20
-14
lines changed

9 files changed

+20
-14
lines changed

Diff for: .gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
.idea
22
.build
33
cmake-build-*
4+
build/
5+
build.sh

Diff for: CMakeLists.txt

+7-3
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,14 @@ set_target_properties( DemoGafferExtensionModule PROPERTIES PREFIX "" OUTPUT_NAM
2424
target_compile_definitions( DemoGafferExtensionModule PRIVATE BOOST_SIGNALS_NO_DEPRECATION_WARNING=1 -D_GLIBCXX_USE_CXX11_ABI=0 )
2525
target_link_libraries( DemoGafferExtensionModule DemoGafferExtension )
2626

27+
string(REPLACE "." "" PYTHON_VERSION_STRIPPED ${PYTHON_VERSION})
28+
string(REPLACE "3.7" "3.7m" PYTHON_FOLDER ${PYTHON_VERSION})
2729
if(APPLE)
28-
target_include_directories( DemoGafferExtensionModule PRIVATE include ${GAFFER_ROOT}/include ${GAFFER_ROOT}/lib/Python.framework/Versions/2.7/include/python2.7 )
30+
target_include_directories( DemoGafferExtensionModule PRIVATE include ${GAFFER_ROOT}/include ${GAFFER_ROOT}/lib/Python.framework/Versions/${PYTHON_VERSION}/include/python${PYTHON_VERSION} )
2931
target_link_libraries( DemoGafferExtensionModule GafferBindings IECorePython boost_python Python)
3032
else()
31-
target_include_directories( DemoGafferExtensionModule PRIVATE include ${GAFFER_ROOT}/include ${GAFFER_ROOT}/include/python2.7 )
32-
target_link_libraries( DemoGafferExtensionModule GafferBindings IECorePython boost_python27 python2.7)
33+
target_include_directories( DemoGafferExtensionModule PRIVATE include ${GAFFER_ROOT}/include ${GAFFER_ROOT}/include/python${PYTHON_FOLDER})
34+
target_link_libraries( DemoGafferExtensionModule GafferBindings IECorePython boost_python${PYTHON_VERSION_STRIPPED} python${PYTHON_FOLDER})
3335
endif(APPLE)
3436

3537
install( TARGETS DemoGafferExtensionModule DESTINATION python/DemoGafferExtension )
@@ -49,3 +51,5 @@ install( DIRECTORY startup DESTINATION . FILES_MATCHING PATTERN "*.py" )
4951

5052
# build the extra resources
5153
install( DIRECTORY resources DESTINATION . FILES_MATCHING PATTERN "*.gfr" PERMISSIONS OWNER_READ GROUP_READ WORLD_READ )
54+
55+

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ setenv DEMO_INSTALL_PREFIX <your extension install path>
2323
2424
mkdir gafferExtensionDemo/cmake-build-default
2525
cd gafferExtensionDemo/cmake-build-default
26-
cmake -DGAFFER_ROOT=$GAFFER_ROOT -DCMAKE_INSTALL_PREFIX=$DEMO_INSTALL_PREFIX ..
26+
cmake -DGAFFER_ROOT=$GAFFER_ROOT -DCMAKE_INSTALL_PREFIX=$DEMO_INSTALL_PREFIX -DPYTHON_VERSION=2.7 ..
2727
make install -j <num cores>
2828
```
2929

Diff for: python/DemoGafferExtension/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
__import__( "Gaffer" )
22
__import__( "GafferScene" )
33

4-
from _DemoGafferExtension import *
4+
from ._DemoGafferExtension import *
55

66
__import__( "IECore" ).loadConfig( "GAFFER_STARTUP_PATHS", subdirectory = "DemoGafferExtension" )

Diff for: python/DemoGafferExtensionTest/DemoSceneProcessorTest.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ def testAffects( self ) :
4747

4848
node["b"].setValue( "test" )
4949
self.assertEqual( len( s ), 5 )
50-
self.failUnless( s[0][0].isSame( node["b"] ) )
51-
self.failUnless( s[1][0].isSame( node["out"]["childBounds"] ) )
52-
self.failUnless( s[2][0].isSame( node["out"]["bound"] ) )
53-
self.failUnless( s[3][0].isSame( node["out"]["object"] ) )
54-
self.failUnless( s[4][0].isSame( node["out"] ) )
50+
self.assertTrue( s[0][0].isSame( node["b"] ) )
51+
self.assertTrue( s[1][0].isSame( node["out"]["childBounds"] ) )
52+
self.assertTrue( s[2][0].isSame( node["out"]["bound"] ) )
53+
self.assertTrue( s[3][0].isSame( node["out"]["object"] ) )
54+
self.assertTrue( s[4][0].isSame( node["out"] ) )
5555

5656
if __name__ == "__main__":
5757
unittest.main()

Diff for: python/DemoGafferExtensionTest/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from DemoSceneProcessorTest import DemoSceneProcessorTest
1+
from . DemoSceneProcessorTest import DemoSceneProcessorTest
22

33
if __name__ == "__main__":
44
import unittest

Diff for: python/DemoGafferExtensionUI/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
__import__( "GafferScene" )
44
__import__( "GafferSceneUI" )
55

6-
import DemoSceneProcessorUI
6+
from . import DemoSceneProcessorUI

Diff for: python/DemoGafferExtensionUITest/DocumentationTest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
class DocumentationTest( GafferUITest.TestCase ) :
1414

15-
def test( self ) :
15+
def test( self ) :
1616

1717
self.maxDiff = None
1818
self.assertNodesAreDocumented(

Diff for: python/DemoGafferExtensionUITest/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from DocumentationTest import DocumentationTest
1+
from . DocumentationTest import DocumentationTest
22

33
if __name__ == "__main__":
44
import unittest

0 commit comments

Comments
 (0)