Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use versioned python module name #1143

Merged
merged 3 commits into from
Sep 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ function(configure_build_install_location _library_name)
)
endfunction()

pybind11_add_module(sdformat MODULE
# sdformatX target already exists, use pysdformatX + OUTPUT_NAME to get
# sdformatX file name generated and map BINDINGS_MODULE_NAME to sdformatX
set(BINDINGS_MODULE_NAME "pysdformat${PROJECT_VERSION_MAJOR}")
pybind11_add_module(${BINDINGS_MODULE_NAME} MODULE
src/sdf/_gz_sdformat_pybind11.cc
src/sdf/pyAirPressure.cc
src/sdf/pyAltimeter.cc
Expand Down Expand Up @@ -84,11 +87,19 @@ pybind11_add_module(sdformat MODULE
src/sdf/pybind11_helpers.cc
)

target_link_libraries(sdformat PRIVATE
target_link_libraries(${BINDINGS_MODULE_NAME} PRIVATE
${PROJECT_LIBRARY_TARGET_NAME}
)

configure_build_install_location(sdformat)
# different from the target name since the target name was not able to use
# sdformatX since it conflicts with the project name
target_compile_definitions(${BINDINGS_MODULE_NAME} PRIVATE
BINDINGS_MODULE_NAME=sdformat${PROJECT_VERSION_MAJOR})

set_target_properties(${BINDINGS_MODULE_NAME} PROPERTIES
OUTPUT_NAME "sdformat${PROJECT_VERSION_MAJOR}")

configure_build_install_location(${BINDINGS_MODULE_NAME})

if (BUILD_TESTING)
pybind11_add_module(sdformattest SHARED
Expand Down
2 changes: 1 addition & 1 deletion python/src/sdf/_gz_sdformat_pybind11.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
#include "pyVisual.hh"
#include "pyWorld.hh"

PYBIND11_MODULE(sdformat, m) {
PYBIND11_MODULE(BINDINGS_MODULE_NAME, m) {
m.doc() = "sdformat Python Library.";

sdf::python::defineAirPressure(m);
Expand Down
4 changes: 2 additions & 2 deletions python/test/pyAirPressure_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
# limitations under the License.

from gz.math7 import Vector3d
from sdformat import AirPressure, Noise
import sdformat as sdf
from sdformat13 import AirPressure, Noise
import sdformat13 as sdf
import unittest

class AtmosphereTEST(unittest.TestCase):
Expand Down
4 changes: 2 additions & 2 deletions python/test/pyAltimeter_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
# limitations under the License.

from gz.math7 import Vector3d
from sdformat import Altimeter, Noise
import sdformat as sdf
from sdformat13 import Altimeter, Noise
import sdformat13 as sdf
import unittest


Expand Down
4 changes: 2 additions & 2 deletions python/test/pyAtmosphere_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
# limitations under the License.

from gz.math7 import Pose3d, Temperature
from sdformat import Atmosphere
import sdformat as sdf
from sdformat13 import Atmosphere
import sdformat13 as sdf
import unittest

class AtmosphereTEST(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion python/test/pyBox_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

from gz.math7 import Vector3d
from sdformat import Box
from sdformat13 import Box
import unittest

class BoxTEST(unittest.TestCase):
Expand Down
4 changes: 2 additions & 2 deletions python/test/pyCamera_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
import copy
from gz.math7 import Angle, Pose3d, Vector2d
import math
from sdformat import Camera
import sdformat as sdf
from sdformat13 import Camera
import sdformat13 as sdf
import unittest

class CameraTEST(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion python/test/pyCapsule_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import math

from sdformat import Capsule
from sdformat13 import Capsule

import unittest

Expand Down
4 changes: 2 additions & 2 deletions python/test/pyCollision_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

import copy
from gz.math7 import Pose3d
from sdformat import (Box, Collision, Contact, Cylinder, Error, Geometry,
from sdformat13 import (Box, Collision, Contact, Cylinder, Error, Geometry,
Plane, Surface, Sphere, SDFErrorsException)
import sdformat as sdf
import sdformat13 as sdf
import unittest
import math

Expand Down
2 changes: 1 addition & 1 deletion python/test/pyCylinder_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import math

from sdformat import Cylinder
from sdformat13 import Cylinder

import unittest

Expand Down
2 changes: 1 addition & 1 deletion python/test/pyEllipsoid_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import copy
from gz.math7 import Vector3d, Ellipsoidd
import math
from sdformat import Ellipsoid
from sdformat13 import Ellipsoid
import unittest


Expand Down
4 changes: 2 additions & 2 deletions python/test/pyError_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
# limitations under the License.

import copy
from sdformat import Error
import sdformat as sdf
from sdformat13 import Error
import sdformat13 as sdf
import unittest

class ErrorColor(unittest.TestCase):
Expand Down
4 changes: 2 additions & 2 deletions python/test/pyForceTorque_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
# limitations under the License.

import copy
from sdformat import ForceTorque, Noise
import sdformat as sdf
from sdformat13 import ForceTorque, Noise
import sdformat13 as sdf
import unittest

class ForceTorqueTEST(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion python/test/pyFrame_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import copy
from gz.math7 import Pose3d
from sdformat import Frame, Error, SDFErrorsException, ErrorCode
from sdformat13 import Frame, Error, SDFErrorsException, ErrorCode
import unittest
import math

Expand Down
4 changes: 2 additions & 2 deletions python/test/pyGeometry_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
# limitations under the License.

import copy
from sdformat import Geometry, Box, Capsule, Cylinder, Ellipsoid, Mesh, Plane, Sphere
from sdformat13 import Geometry, Box, Capsule, Cylinder, Ellipsoid, Mesh, Plane, Sphere
from gz.math7 import Vector3d, Vector2d
import sdformat as sdf
import sdformat13 as sdf
import unittest


Expand Down
2 changes: 1 addition & 1 deletion python/test/pyGui_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

import copy
from sdformat import Gui, Plugin
from sdformat13 import Gui, Plugin
import unittest


Expand Down
2 changes: 1 addition & 1 deletion python/test/pyHeightmap_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import copy
from gz.math7 import Vector3d
from sdformat import Heightmap, HeightmapBlend, HeightmapTexture
from sdformat13 import Heightmap, HeightmapBlend, HeightmapTexture
import unittest


Expand Down
4 changes: 2 additions & 2 deletions python/test/pyIMU_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

import copy
from gz.math7 import Vector3d
from sdformat import IMU, Noise
import sdformat as sdf
from sdformat13 import IMU, Noise
import sdformat13 as sdf
import unittest

class IMUTest(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion python/test/pyJointAxis_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import copy
from gz.math7 import Pose3d, Vector3d
from sdformat import JointAxis, Error, SDFErrorsException
from sdformat13 import JointAxis, Error, SDFErrorsException
import math
import unittest

Expand Down
4 changes: 2 additions & 2 deletions python/test/pyJoint_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

import copy
from gz.math7 import Pose3d, Vector3d
from sdformat import (Joint, JointAxis, Error, SemanticPose, Sensor,
from sdformat13 import (Joint, JointAxis, Error, SemanticPose, Sensor,
SDFErrorsException)
import sdformat as sdf
import sdformat13 as sdf
import math
import unittest

Expand Down
2 changes: 1 addition & 1 deletion python/test/pyLidar_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import copy
from gz.math7 import Angle, Pose3d, Vector3d, Helpers
from sdformat import Lidar, Error, Noise
from sdformat13 import Lidar, Error, Noise
import math
import unittest

Expand Down
4 changes: 2 additions & 2 deletions python/test/pyLight_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

import copy
from gz.math7 import Angle, Color, Pose3d, Vector3d
from sdformat import Light, SDFErrorsException
import sdformat as sdf
from sdformat13 import Light, SDFErrorsException
import sdformat13 as sdf
import math
import unittest

Expand Down
2 changes: 1 addition & 1 deletion python/test/pyLink_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import copy
from gz.math7 import Pose3d, Inertiald, MassMatrix3d, Vector3d
from sdformat import (Collision, Light, Link, Sensor, Visual,
from sdformat13 import (Collision, Light, Link, Sensor, Visual,
SDFErrorsException)
import unittest
import math
Expand Down
4 changes: 2 additions & 2 deletions python/test/pyMagnetometer_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

import copy
from gz.math7 import Pose3d
from sdformat import Magnetometer, Noise
import sdformat as sdf
from sdformat13 import Magnetometer, Noise
import sdformat13 as sdf
import unittest


Expand Down
4 changes: 2 additions & 2 deletions python/test/pyMaterial_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
# limitations under the License.

import copy
from sdformat import Material, Pbr, PbrWorkflow
from sdformat13 import Material, Pbr, PbrWorkflow
from gz.math7 import Color
import sdformat as sdf
import sdformat13 as sdf
import unittest


Expand Down
2 changes: 1 addition & 1 deletion python/test/pyMesh_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

import copy
from sdformat import Mesh
from sdformat13 import Mesh
from gz.math7 import Vector3d
import unittest

Expand Down
4 changes: 2 additions & 2 deletions python/test/pyModel_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

import copy
from gz.math7 import Pose3d, Vector3d
from sdformat import (Plugin, Model, Joint, Link, Error, Frame, SemanticPose,
from sdformat13 import (Plugin, Model, Joint, Link, Error, Frame, SemanticPose,
SDFErrorsException)
import sdformat as sdf
import sdformat13 as sdf
import math
import unittest

Expand Down
2 changes: 1 addition & 1 deletion python/test/pyNavSat_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

import copy
from sdformat import NavSat, Noise
from sdformat13 import NavSat, Noise
import unittest

class NavSatColor(unittest.TestCase):
Expand Down
4 changes: 2 additions & 2 deletions python/test/pyNoise_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
# limitations under the License.

import copy
from sdformat import Noise
import sdformat as sdf
from sdformat13 import Noise
import sdformat13 as sdf
import math
import unittest

Expand Down
2 changes: 1 addition & 1 deletion python/test/pyParserConfig_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

import copy
from sdformat import ParserConfig
from sdformat13 import ParserConfig
from sdformattest import source_file, test_file
import unittest

Expand Down
2 changes: 1 addition & 1 deletion python/test/pyParticleEmitter_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import copy
from gz.math7 import Color, Pose3d, Vector3d, Helpers
from sdformat import ParticleEmitter
from sdformat13 import ParticleEmitter
import unittest


Expand Down
4 changes: 2 additions & 2 deletions python/test/pyPbr_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
# limitations under the License.

import copy
from sdformat import Pbr, PbrWorkflow
import sdformat as sdf
from sdformat13 import Pbr, PbrWorkflow
import sdformat13 as sdf
import unittest


Expand Down
2 changes: 1 addition & 1 deletion python/test/pyPhysics_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

import copy
from sdformat import Physics
from sdformat13 import Physics
import unittest


Expand Down
2 changes: 1 addition & 1 deletion python/test/pyPlane_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

import copy
from sdformat import Plane
from sdformat13 import Plane
from gz.math7 import Vector3d, Vector2d, Planed
import unittest

Expand Down
2 changes: 1 addition & 1 deletion python/test/pyPlugin_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

import copy
from sdformat import Plugin
from sdformat13 import Plugin
import unittest


Expand Down
2 changes: 1 addition & 1 deletion python/test/pyPolyline_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

import copy
from sdformat import Polyline
from sdformat13 import Polyline
from gz.math7 import Vector2d
import unittest

Expand Down
4 changes: 2 additions & 2 deletions python/test/pyRoot_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

import copy
from gz.math7 import Vector3d, Pose3d
from sdformat import (Error, Model, Light, Root, SDF_VERSION,
from sdformat13 import (Error, Model, Light, Root, SDF_VERSION,
SDFErrorsException, SDF_PROTOCOL_VERSION, World)
import sdformat as sdf
import sdformat13 as sdf

import unittest

Expand Down
Loading