Bug 1935266 - RFE: Add option for namespace packages to %pyproject_save_files
Summary: RFE: Add option for namespace packages to %pyproject_save_files
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: pyproject-rpm-macros
Version: rawhide
Hardware: Unspecified
OS: Unspecified
low
unspecified
Target Milestone: ---
Assignee: Miro Hrončok
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-03-04 15:14 UTC by Miro Hrončok
Modified: 2023-01-17 14:41 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Miro Hrončok 2021-03-04 15:14:49 UTC
Currently, this doesn't work:

    %pyproject_save_files jaraco.path

It errors with:

    ValueError: Attempted to use a namespaced package with dot in the glob: jaraco.path


We could do something useful here instead or at least have an API for namespace packages.


An idea I just had is:

    %pyproject_save_files -N jaraco

Which would generate something like:

    %exclude %dir %{python3_site...}/jaraco
    %exclude %dir %{python3_site...}/jaraco/__pycache__
    %pycached %exclude %{python3_site...}/jaraco/__init__.py
    %{python3_site...}/jaraco/* (actually expanded)

Comment 1 Miro Hrončok 2021-04-01 09:24:14 UTC
This is on hold now until the situation wrt the semantics of %exclude is sorted out.

Relevant thread: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/Y2W57QE7HFW5FEDAFMGUFOOL4JKE6N3F/#XOP2CNXLDNT5SRZ67DXPYRBXPLYCWUZ2 (search for my email with %exclude in it in case the anchor does nothing)

Comment 2 Miro Hrončok 2021-04-08 08:20:01 UTC
An idea how to solve the namespace packages problem. Use (or generate):

%pycached %ghost %{python3_sitelib}/jaraco/__init__.py (if present)
%dir %{python3_site...}/jaraco
%dir %{python3_site...}/jaraco/__pycache__

That way, the individual packages don't conflict (%ghosts don't conflict and directories are co-owned) and don't need to manually require a filesystem package. And we can have __init__.py during %check.

Obviously, this only works when the package works on runtime without  __init__.py which should be the case for namespace package from this decade.

Comment 4 Miro Hrončok 2021-06-18 12:43:54 UTC
(In reply to Miro Hrončok from comment #0)
> Currently, this doesn't work:
> 
>     %pyproject_save_files jaraco.path
> 
> It errors with:
> 
>     ValueError: Attempted to use a namespaced package with dot in the glob:
> jaraco.path

Not to self: `%pyproject_save_files jaraco/path` should fail with a similar message now.

Comment 5 Petr Viktorin (pviktori) 2021-06-21 09:22:21 UTC
As should `%pyproject_save_files jaraco!path`, I guess.

Comment 6 Miro Hrončok 2021-06-21 09:53:02 UTC
Does ! have any special meaning? Or do you mean any non-glob/non-identifier characters should do this?


The idea with / is that I've seen people try it with slashes instead of dots, because the actual files are structured in that way and slash is a directory separator.

Comment 7 Petr Viktorin (pviktori) 2021-06-21 11:00:08 UTC
No special meaning; I meant all non-glob/non-identifier characters.

Comment 8 Miro Hrončok 2021-09-10 12:04:47 UTC
(In reply to Miro Hrončok from comment #4)
> Not to self: `%pyproject_save_files jaraco/path` should fail with a similar
> message now.

pyproject-rpm-macros-0-47 added this.


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