python singlespec: iterating over all binaries

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

python singlespec: iterating over all binaries

Sebastian-2
Hi,

As I needed a singlespec-conversion of python-requests-mock I tried to
do that. But this package uses "testrepository" for the checks. This
requires the python program to use in a configuration file. This is one
line of such a .testr.conf file:

> test_command=python -m subunit.run discover requests_mock $LISTOPT
$IDOPTION

I can easily replace 'python' with e.g. 'python3' with sed:

> sed -i 's/python/python3/' .testr.conf
> testr init
> testr run --parallel

It works, but it's not a nice solution and can break in the future. So
I'd somehow need to "iterate" over all available python-binaries.
Currently with python2 and python3 I can hardcode it.
Using %python_expand does not work here because it calls the interpreter
along with a lot of other commands, I'd just need the last line of that
macro. Looking a the macro definitions - without knowledge how they work
- I couldn't find out how I could extract that. Is there a good way to
that better?

Or if not - is it ok to leave it as it is? Here is the package:
https://build.opensuse.org/package/show/home:sebix:branches:devel:languages:python/python-requests-mock

Sebastian

--
python programming - mail server - photo - video - https://sebix.at
cryptographic key at https://sebix.at/DC9B463B.asc and on public keyservers



signature.asc (871 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: python singlespec: iterating over all binaries

jan matejek-4
hello,

On 25.5.2017 17:39, Sebastian wrote:
> I can easily replace 'python' with e.g. 'python3' with sed:
>
>> sed -i 's/python/python3/' .testr.conf
>> testr init
>> testr run --parallel
>
> It works, but it's not a nice solution and can break in the future. So
> I'd somehow need to "iterate" over all available python-binaries.

this is what %python_expand is for (are you confusing it with %python_exec?)

%{python_expand # first line can't be empty
rm -r testrepository
sed -i 's/python/$python/' .testr.conf
testr init
testr run --parallel
}

hope this helps
m.


signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: python singlespec: iterating over all binaries

Sebastian-2
On 05/29/2017 04:19 PM, jan matejek wrote:

> hello,
>
> On 25.5.2017 17:39, Sebastian wrote:
>> I can easily replace 'python' with e.g. 'python3' with sed:
>>
>>> sed -i 's/python/python3/' .testr.conf
>>> testr init
>>> testr run --parallel
>> It works, but it's not a nice solution and can break in the future. So
>> I'd somehow need to "iterate" over all available python-binaries.
> this is what %python_expand is for (are you confusing it with %python_exec?)
>
> %{python_expand # first line can't be empty
> rm -r testrepository
> sed -i 's/python/$python/' .testr.conf
> testr init
> testr run --parallel
> }
Ah, I thought it only works for python_sitelib. Thanks!

--
python programming - mail server - photo - video - https://sebix.at
cryptographic key at https://sebix.at/DC9B463B.asc and on public keyservers



signature.asc (871 bytes) Download Attachment