openSUSE / python-rpm-macros

Multi-Python, Single-Spec macros generator
Other
22 stars 20 forks source link

%pyx_compile problems when only one flavour is enabled #35

Closed jayvdb closed 4 years ago

jayvdb commented 5 years ago

%py_compile and %py3_compile should disable themselves based on the have/skip rules.

Or maybe they should be used indirectly via something like %python_expand %{$python_compile} %{buildroot}%{$python_sitelib}

An example of the problem is https://build.opensuse.org/package/show/devel:languages:python:flask/python-Flask-RESTful

When running a project config with only flavour python3, the use of %py_compile fails.

I havent been able to find a syntax which works at https://build.opensuse.org/package/show/home:jayvdb:py3only/python-Flask-RESTful

If it is possible, lets document it somewhere.

jayvdb commented 5 years ago

I see urllib3 is doing

%{python_expand \
$python -m compileall -d %{$python_sitelib} %{buildroot}%{$python_sitelib}/urllib3/
$python -O -m compileall -d %{$python_sitelib} %{buildroot}%{$python_sitelib}/urllib3/
}
scarabeusiv commented 5 years ago

Neither py_compile nor py3_compile are part of the rpm macros here, they are defined by upstream rpm project. So if one wants to use them they need to use if has_python blocks. Alternatively we can introduce new conditional for them using the syntax you inline above.

bnavigator commented 4 years ago

I didn't see this, but #60 does exactly that (except that it uses sitelib/sitearch as root). Do we need to introduce a subdir argument?