How to tell ocs to build using python3?

Hello,
I am trying to build a package for the python-telegram-bot library. The latest version can not be build using python2 and needs python3.
However, when running ocs build it runs using python2 and fails:


    3s] + python_flavor= 
    3s] + '' -z '' ']' 
    3s] + python_flavor=tmp 
    3s] + '' tmp '!=' python2 ']' 
    3s] + '' -d build ']' 
    3s] + '' -d _build.python2 ']' 
    3s] + echo python2 
    3s] + /usr/bin/python2 setup.py build '--executable=/usr/bin/python2 -s' 
    3s]   File "setup.py", line 52 
    3s]     readme = f'README{"_RAW" if raw else ""}.rst' 
    3s]                                                 ^ 
    3s] SyntaxError: invalid syntax 
    3s] error: Bad exit status from /var/tmp/rpm-tmp.Wk1RT5 (%build) 
    3s]  
    3s]  
    3s] RPM build errors: 
    3s]     Bad exit status from /var/tmp/rpm-tmp.Wk1RT5 (%build) 
    3s]  
    3s] meteor failed "build python3-python-telegram-bot.spec" at Fri Feb 12 17:42:34 UTC 2021.


What am I doing wrong? This is my specfile:


# 
# spec file for package python3-python-telegram-bot 
# 
# Copyright (c) 2021 SUSE LLC 
# 
# All modifications and additions to the file contributed by third parties 
# remain the property of their copyright owners, unless otherwise agreed 
# upon. The license for this file, and modifications and additions to the 
# file, is the same license as for the pristine package itself (unless the 
# license for the pristine package is not an Open Source License, in which 
# case the license is the MIT License). An "Open Source License" is a 
# license that conforms to the Open Source Definition (Version 1.9) 
# published by the Open Source Initiative. 

# Please submit bugfixes or comments via https://bugs.opensuse.org/ 
# 


%{?!python_module:%define python_module() python-%{**} python3-%{**}} 
Name:           python3-python-telegram-bot 
Version:        13.2 
Release:        0 
Summary:        We have made you a wrapper you can't refuse 
License:        LGPL-3.0 
URL:            https://python-telegram-bot.org/ 
Source:         https://files.pythonhosted.org/packages/source/p/python-telegram-bot/python-telegram-bot-%{version}.tar.gz 
BuildRequires:  python3 
BuildRequires:  python3-rpm-macros 
BuildRequires:  python3-setuptools 
# SECTION test requirements 
BuildRequires:  python3-APScheduler 
BuildRequires:  python3-certifi 
BuildRequires:  python3-cryptography 
BuildRequires:  python3-pytz >= 2018.6 
BuildRequires:  python3-tornado >= 5.1 
# /SECTION 
BuildRequires:  fdupes 
Requires:       python3-APScheduler == 3.6.3 
Requires:       python3-certifi 
Requires:       python3-cryptography 
Requires:       python3-pytz >= 2018.6 
Requires:       python3-tornado >= 5.1 
Suggests:       python3-ujson 
Suggests:       python3-PySocks 
BuildArch:      noarch 
%python_subpackages 

%description 
We have made you a wrapper you can't refuse 

%prep 
%setup -q -n python-telegram-bot-%{version} 

%build 
%python_build 

%install 
%python_install 
%python_expand %fdupes %{buildroot}%{$python_sitelib} 

%files %{python_files} 
%doc README.rst README_RAW.rst 
%license LICENSE LICENSE.dual LICENSE.lesser 
%{python_sitelib}/* 

%changelog

I am stuck for 5 hours now and have no clue what’s wrong. Thanks for your help!

~Jens

Update: I know that the command is osc and not ocs, mistyped it, sorry.

Hi
Add a skip, also for BuildRequires use modules macro…

For example ref: Welcome - openSUSE Build Service


%define skip_python2 1
%{?!python_module:%define python_module() python-%{**} python3-%{**}}


BuildRequires:  %{python_module Shapely}

And just call your package python-foo

Thank you so much, this worked!
~Jens