Gentoo Archives: gentoo-dev

From: Alexis Ballier <aballier@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] New eclass: ros-catkin.eclass, new USE_EXPAND: ROS_MESSAGES, new categories: dev-ros and ros-meta for review.
Date: Fri, 18 Sep 2015 17:19:17
Message-Id: 20150918191851.400b66d2@gentoo.org
In Reply to: Re: [gentoo-dev] New eclass: ros-catkin.eclass, new USE_EXPAND: ROS_MESSAGES, new categories: dev-ros and ros-meta for review. by hasufell
1 On Fri, 18 Sep 2015 18:28:09 +0200
2 hasufell <hasufell@g.o> wrote:
3
4 > On 09/17/2015 06:36 PM, Alexis Ballier wrote:
5 > >
6 > > # @ECLASS-VARIABLE: PYTHON_COMPAT
7 > > # @DESCRIPTION:
8 > > # Tells the eclass the package has python code and forwards it to
9 > > python-r1.eclass. PYTHON_ECLASS=""
10 > > CATKIN_PYTHON_USEDEP=""
11 > > if [ -n "${PYTHON_COMPAT}" ] ; then
12 > > PYTHON_ECLASS="python-r1 python-utils-r1"
13 > > fi
14 >
15 > see python-r1.eclass:
16 > """
17 > # Please note that python-r1 will always inherit python-utils-r1 as
18 > # well. Thus, all the functions defined there can be used
19 > # in the packages using python-r1, and there is no need ever to
20 > inherit # both.
21 > """
22
23 I don't think that hurts and usually prefer explicit inherit rather
24 than relying on transitive ones, but i have no strong opinion and this
25 can be removed
26
27 > > # @FUNCTION: ros-catkin_src_install_with_python
28 > > # @DESCRIPTION:
29 > > # Decorator around cmake-utils_src_install to ensure python scripts
30 > > are properly handled w.r.t. python-exec2.
31 > > ros-catkin_src_install_with_python() { python_export
32 > > PYTHON_SCRIPTDIR cmake-utils_src_install
33 > > if [ ! -f "${T}/.catkin_python_symlinks_generated" -a -d
34 > > "${D}/${PYTHON_SCRIPTDIR}" ]; then dodir /usr/bin
35 > > for i in "${D}/${PYTHON_SCRIPTDIR}"/* ; do
36 > > dosym ../lib/python-exec/python-exec2
37 > > "/usr/bin/${i##*/}" || die done
38 > > touch "${T}/.catkin_python_symlinks_generated"
39 > > fi
40 > > }
41 >
42 > Maybe I don't understand the purpose, but this looks like a hack
43 > that is trying to circumvent the python eclasses.
44 >
45 > You probably should have a look at:
46 > """
47 > # @FUNCTION: python_replicate_script
48 > # @USAGE: <path>...
49 > # @DESCRIPTION:
50 > # Copy the given script to variants for all enabled Python
51 > # implementations, then replace it with a symlink to the wrapper.
52 > #
53 > # All specified files must start with a 'python' shebang. A file not
54 > # having a matching shebang will be refused.
55 > """
56
57 I don't think that'll work, above code is what I came up after
58 talking with mgorny about how to do it.
59
60 the cmake build system will already populate PYTHON_SCRIPTDIR and
61 those might differ between python versions; only thing left to do is
62 symlinking into /usr/bin; a bit like _distutils-r1_wrap_scripts, but
63 for which the leading _ suggests its not public
64
65 python_replicate_script seems useful only for files ending in /usr/bin
66
67 > >
68 > > # @FUNCTION: ros-catkin_src_compile
69 > > # @DESCRIPTION:
70 > > # Builds a catkin-based package.
71 > > ros-catkin_src_compile() {
72 > > if [ -n "${CATKIN_DO_PYTHON_MULTIBUILD}" ] ; then
73 > > python_foreach_impl cmake-utils_src_compile
74 > > else
75 > > cmake-utils_src_compile
76 > > fi
77 > > }
78 > >
79 >
80 > >
81 > > # @FUNCTION: ros-catkin_src_test
82 > > # @DESCRIPTION:
83 > > # Run the tests of a catkin-based package.
84 > > ros-catkin_src_test() {
85 > > if [ -n "${CATKIN_DO_PYTHON_MULTIBUILD}" ] ; then
86 > > python_foreach_impl ros-catkin_src_test_internal
87 > > else
88 > > ros-catkin_src_test_internal
89 > > fi
90 > > }
91 > >
92 >
93 > >
94 > > # @FUNCTION: ros-catkin_src_install
95 > > # @DESCRIPTION:
96 > > # Installs a catkin-based package.
97 > > ros-catkin_src_install() {
98 > > if [ -n "${CATKIN_DO_PYTHON_MULTIBUILD}" ] ; then
99 > > python_foreach_impl
100 > > ros-catkin_src_install_with_python else
101 > > cmake-utils_src_install
102 > > fi
103 > > }
104 > >
105 >
106 > I think these functions should pass arguments through to
107 > cmake-utils_src_* functions, so an ebuild might be able to do stuff
108 > like ros-catkin_src_compile -j1
109 > or other things if that is really needed.
110 >
111
112 yep, fixed locally, thx
113
114 you should consider fixing distutils-r1 too because that's what I was
115 inspired by iirc :p
116
117 Alexis.