1 |
commit: ee2d2c671a98dfd61e61b1525975b1cfce94f160 |
2 |
Author: Alexis Ballier <aballier <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Aug 5 14:54:11 2020 +0000 |
4 |
Commit: Alexis Ballier <aballier <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Aug 5 15:30:09 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ee2d2c67 |
7 |
|
8 |
dev-ros/calibration_estimation: fix py3 compat |
9 |
|
10 |
Closes: https://bugs.gentoo.org/734710 |
11 |
Package-Manager: Portage-3.0.1, Repoman-2.3.23 |
12 |
Signed-off-by: Alexis Ballier <aballier <AT> gentoo.org> |
13 |
|
14 |
.../calibration_estimation-0.10.14.ebuild | 7 ++ |
15 |
.../calibration_estimation-9999.ebuild | 7 ++ |
16 |
dev-ros/calibration_estimation/files/py3.patch | 78 ++++++++++++++++++++++ |
17 |
3 files changed, 92 insertions(+) |
18 |
|
19 |
diff --git a/dev-ros/calibration_estimation/calibration_estimation-0.10.14.ebuild b/dev-ros/calibration_estimation/calibration_estimation-0.10.14.ebuild |
20 |
index 804aef9eae2..c83819a9fef 100644 |
21 |
--- a/dev-ros/calibration_estimation/calibration_estimation-0.10.14.ebuild |
22 |
+++ b/dev-ros/calibration_estimation/calibration_estimation-0.10.14.ebuild |
23 |
@@ -30,3 +30,10 @@ DEPEND="${RDEPEND} |
24 |
dev-ros/rostest[${PYTHON_SINGLE_USEDEP}] |
25 |
$(python_gen_cond_dep "dev-python/nose[\${PYTHON_USEDEP}]") |
26 |
)" |
27 |
+PATCHES=( "${FILESDIR}/py3.patch" ) |
28 |
+ |
29 |
+src_prepare() { |
30 |
+ ros-catkin_src_prepare |
31 |
+ sed -e 's/yaml.load/yaml.safe_load/g' -i src/*/*.py -i test/*.py || die |
32 |
+ 2to3 -w src/*/*.py src/*/*/*.py test/*.py || die |
33 |
+} |
34 |
|
35 |
diff --git a/dev-ros/calibration_estimation/calibration_estimation-9999.ebuild b/dev-ros/calibration_estimation/calibration_estimation-9999.ebuild |
36 |
index 804aef9eae2..c83819a9fef 100644 |
37 |
--- a/dev-ros/calibration_estimation/calibration_estimation-9999.ebuild |
38 |
+++ b/dev-ros/calibration_estimation/calibration_estimation-9999.ebuild |
39 |
@@ -30,3 +30,10 @@ DEPEND="${RDEPEND} |
40 |
dev-ros/rostest[${PYTHON_SINGLE_USEDEP}] |
41 |
$(python_gen_cond_dep "dev-python/nose[\${PYTHON_USEDEP}]") |
42 |
)" |
43 |
+PATCHES=( "${FILESDIR}/py3.patch" ) |
44 |
+ |
45 |
+src_prepare() { |
46 |
+ ros-catkin_src_prepare |
47 |
+ sed -e 's/yaml.load/yaml.safe_load/g' -i src/*/*.py -i test/*.py || die |
48 |
+ 2to3 -w src/*/*.py src/*/*/*.py test/*.py || die |
49 |
+} |
50 |
|
51 |
diff --git a/dev-ros/calibration_estimation/files/py3.patch b/dev-ros/calibration_estimation/files/py3.patch |
52 |
new file mode 100644 |
53 |
index 00000000000..ad680c7a7c6 |
54 |
--- /dev/null |
55 |
+++ b/dev-ros/calibration_estimation/files/py3.patch |
56 |
@@ -0,0 +1,78 @@ |
57 |
+Index: calibration_estimation/src/calibration_estimation/sensors/chain_sensor.py |
58 |
+=================================================================== |
59 |
+--- calibration_estimation.orig/src/calibration_estimation/sensors/chain_sensor.py |
60 |
++++ calibration_estimation/src/calibration_estimation/sensors/chain_sensor.py |
61 |
+@@ -135,7 +135,7 @@ class ChainSensor: |
62 |
+ cov_angles = [x*x for x in self._full_chain.calc_block._chain._cov_dict['joint_angles']] |
63 |
+ cov = matrix(Jt).T * matrix(diag(cov_angles)) * matrix(Jt) |
64 |
+ |
65 |
+- if ( self._full_chain.calc_block._chain._cov_dict.has_key('translation') ): |
66 |
++ if ( 'translation' in self._full_chain.calc_block._chain._cov_dict ): |
67 |
+ translation_var = self._full_chain.calc_block._chain._cov_dict['translation']; |
68 |
+ translation_cov = numpy.diag(translation_var*(self.get_residual_length()/3)) |
69 |
+ cov = cov + translation_cov |
70 |
+Index: calibration_estimation/src/calibration_estimation/sensors/tilting_laser_sensor.py |
71 |
+=================================================================== |
72 |
+--- calibration_estimation.orig/src/calibration_estimation/sensors/tilting_laser_sensor.py |
73 |
++++ calibration_estimation/src/calibration_estimation/sensors/tilting_laser_sensor.py |
74 |
+@@ -99,7 +99,7 @@ class TiltingLaserSensor: |
75 |
+ gamma = matrix(zeros(cov.shape)) |
76 |
+ num_pts = self.get_residual_length()/3 |
77 |
+ |
78 |
+- for k in range(num_pts): |
79 |
++ for k in range(int(num_pts)): |
80 |
+ first = 3*k |
81 |
+ last = 3*k+3 |
82 |
+ sub_cov = matrix(cov[first:last, first:last]) |
83 |
+Index: calibration_estimation/test/chain_sensor_unittest.py |
84 |
+=================================================================== |
85 |
+--- calibration_estimation.orig/test/chain_sensor_unittest.py |
86 |
++++ calibration_estimation/test/chain_sensor_unittest.py |
87 |
+@@ -59,7 +59,7 @@ from numpy import * |
88 |
+ |
89 |
+ def loadSystem(): |
90 |
+ urdf = ''' |
91 |
+-<robot> |
92 |
++<robot name="test"> |
93 |
+ <link name="base_link"/> |
94 |
+ <joint name="j0" type="fixed"> |
95 |
+ <origin xyz="0 0 0" rpy="0 0 0"/> |
96 |
+Index: calibration_estimation/test/full_chain_unittest.py |
97 |
+=================================================================== |
98 |
+--- calibration_estimation.orig/test/full_chain_unittest.py |
99 |
++++ calibration_estimation/test/full_chain_unittest.py |
100 |
+@@ -50,7 +50,7 @@ import numpy |
101 |
+ |
102 |
+ def loadSystem1(): |
103 |
+ urdf = ''' |
104 |
+-<robot> |
105 |
++<robot name="test"> |
106 |
+ <link name="base_link"/> |
107 |
+ <joint name="j0" type="fixed"> |
108 |
+ <origin xyz="10 0 0" rpy="0 0 0"/> |
109 |
+Index: calibration_estimation/test/tilting_laser_sensor_unittest.py |
110 |
+=================================================================== |
111 |
+--- calibration_estimation.orig/test/tilting_laser_sensor_unittest.py |
112 |
++++ calibration_estimation/test/tilting_laser_sensor_unittest.py |
113 |
+@@ -74,7 +74,7 @@ class TestTiltingLaserBundler(unittest.T |
114 |
+ |
115 |
+ def loadSystem(): |
116 |
+ urdf = ''' |
117 |
+-<robot> |
118 |
++<robot name="test"> |
119 |
+ <link name="base_link"/> |
120 |
+ <joint name="j0" type="fixed"> |
121 |
+ <origin xyz="0 0 0" rpy="0 0 0"/> |
122 |
+Index: calibration_estimation/test/tilting_laser_unittest.py |
123 |
+=================================================================== |
124 |
+--- calibration_estimation.orig/test/tilting_laser_unittest.py |
125 |
++++ calibration_estimation/test/tilting_laser_unittest.py |
126 |
+@@ -47,7 +47,7 @@ from numpy import * |
127 |
+ |
128 |
+ def loadSystem1(): |
129 |
+ urdf = ''' |
130 |
+-<robot> |
131 |
++<robot name="test"> |
132 |
+ <link name="base_link"/> |
133 |
+ <joint name="j0" type="fixed"> |
134 |
+ <origin xyz="0 0 10" rpy="0 0 0"/> |