Bug 1627936 - copr-frontend calls %py_byte_compile only on %{_datadir}/copr/coprs_frontend/coprs yet it ships other bytecode
Summary: copr-frontend calls %py_byte_compile only on %{_datadir}/copr/coprs_frontend/...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: copr-frontend
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miroslav Suchý
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1626685
TreeView+ depends on / blocked
 
Reported: 2018-09-11 22:16 UTC by Miro Hrončok
Modified: 2019-04-15 05:25 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-04-15 05:25:57 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Miro Hrončok 2018-09-11 22:16:18 UTC
When I was reviewing packages for https://fedoraproject.org/wiki/Changes/No_more_automagic_Python_bytecompilation_phase_2 I've realized that copr-frontend has the following line in spec:

%py_byte_compile %{__python3} %{buildroot}%{_datadir}/copr/coprs_frontend/coprs

Yet it ships various other bytecode in:

/usr/share/copr/coprs_frontend/__pycache__
/usr/share/copr/coprs_frontend/alembic/fedora/__pycache__
/usr/share/copr/coprs_frontend/alembic/fedora/versions/__pycache__
/usr/share/copr/coprs_frontend/alembic/schema/__pycache__
/usr/share/copr/coprs_frontend/alembic/schema/versions/__pycache__
/usr/share/copr/coprs_frontend/run/__pycache__
/usr/share/copr/coprs_frontend/tests/__pycache__
/usr/share/copr/coprs_frontend/tests/test_api/__pycache__
/usr/share/copr/coprs_frontend/tests/test_logic/__pycache__
/usr/share/copr/coprs_frontend/tests/test_views/test_admin/__pycache__
/usr/share/copr/coprs_frontend/tests/test_views/test_api_ns/__pycache__
/usr/share/copr/coprs_frontend/tests/test_views/test_backend_ns/__pycache__
/usr/share/copr/coprs_frontend/tests/test_views/test_coprs_ns/__pycache__
/usr/share/copr/coprs_frontend/tests/test_views/test_groups_ns/__pycache__

If shipping in there is desired, please call:

%py_byte_compile %{__python3} %{buildroot}%{_datadir}/copr/coprs_frontend

I **will not** add explicit `%global _python_bytecompile_extra 1` to copr-frontend.spec, consider this the head up of that. If that's fine, close this as NOTABUG.

Comment 1 Pavel Raiskup 2018-09-12 05:27:44 UTC
(In reply to Miro Hrončok from comment #0)
> copr-frontend has the following line in spec:
> %py_byte_compile %{__python3}
> %{buildroot}%{_datadir}/copr/coprs_frontend/coprs

That's correct.

> Yet it ships various other bytecode in:
> 
> /usr/share/copr/coprs_frontend/__pycache__
> /usr/share/copr/coprs_frontend/alembic/fedora/__pycache__
> /usr/share/copr/coprs_frontend/alembic/fedora/versions/__pycache__
> /usr/share/copr/coprs_frontend/alembic/schema/__pycache__
> /usr/share/copr/coprs_frontend/alembic/schema/versions/__pycache__

Alembic should be byte compiled.

> /usr/share/copr/coprs_frontend/run/__pycache__

NOTABUG, though I'm not sure why the __init__.py is there.

> /usr/share/copr/coprs_frontend/tests/__pycache__
> /usr/share/copr/coprs_frontend/tests/test_api/__pycache__
> /usr/share/copr/coprs_frontend/tests/test_logic/__pycache__
> /usr/share/copr/coprs_frontend/tests/test_views/test_admin/__pycache__
> /usr/share/copr/coprs_frontend/tests/test_views/test_api_ns/__pycache__
> /usr/share/copr/coprs_frontend/tests/test_views/test_backend_ns/__pycache__
> /usr/share/copr/coprs_frontend/tests/test_views/test_coprs_ns/__pycache__
> /usr/share/copr/coprs_frontend/tests/test_views/test_groups_ns/__pycache__

This IMO should be byte compiled, but I filled additional bug for this:
https://pagure.io/copr/copr/issue/388

Btw., ./run_tests* use `python -B` (I don't really understand why), but
users could happen to run the testsuite without `-B` which means that we
should treat test cases as any other python importable files.

> If shipping in there is desired, please call:
> 
> %py_byte_compile %{__python3} %{buildroot}%{_datadir}/copr/coprs_frontend

This seems to be wise, but we are not able to blacklist the 'run' subdirectory.
Could we please add blacklisting support into %py_byte_compile?

> I **will not** add explicit `%global _python_bytecompile_extra 1` to
> copr-frontend.spec, consider this the head up of that. If that's fine, close
> this as NOTABUG.

Thanks for the headsup.

Comment 2 Pavel Raiskup 2018-09-12 05:30:11 UTC
https://pagure.io/copr/copr/pull-request/389

Comment 3 Miro Hrončok 2018-09-12 09:05:53 UTC
Blacklisting support would make the macro very complex. Repeat the call for various dirs for now please.

Comment 4 Pavel Raiskup 2019-04-15 05:25:57 UTC
I believe all issues have been addressed.  Thanks for the report!


Note You need to log in before you can comment on or make changes to this bug.