Skip to content

Handle C extensions not inside a package directory (at the root)#39

Closed
natefoo wants to merge 1 commit intomatthew-brett:masterfrom
natefoo:top-level-fix-squash
Closed

Handle C extensions not inside a package directory (at the root)#39
natefoo wants to merge 1 commit intomatthew-brett:masterfrom
natefoo:top-level-fix-squash

Conversation

@natefoo
Copy link
Copy Markdown

@natefoo natefoo commented Sep 12, 2018

@matthew-brett how's this look for an implementation? It's working for me but needs a few tests.

Root packages end up with a .dylib<pkg> directory for delocated libs, this mirrors what auditwheel does.

@natefoo natefoo force-pushed the top-level-fix-squash branch from 0dcf21e to 0667367 Compare October 8, 2018 17:33
ipmb added a commit to lincolnloop/pyuwsgi-wheels that referenced this pull request Oct 12, 2018
ipmb added a commit to lincolnloop/pyuwsgi-wheels that referenced this pull request Oct 12, 2018
Copy link
Copy Markdown
Owner

@matthew-brett matthew-brett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks - and sorry to be so slow to review, the start of term got the better of me.

Comment thread delocate/tools.py Outdated

def find_package_dirs(root_path):
""" Find python package directories in directory `root_path`
def find_packages(root_path):
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry - I'm a little sensitive about changing the API without warning.

Would you mind making and deprecating something like:

def find_package_dirs(root_path):
    return [p for p, is_dir in find_packages(root) if is_dir]

and importing into delocating?

Comment thread delocate/tools.py Outdated
package_sdirs : set
Set of strings where each is a subdirectory of `root_path`, containing
an ``__init__.py`` file. Paths prefixed by `root_path`
Set of strings where each is a subdirectory of `root_path` containing an
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually a set of (string, is_dir) tuples no?

Comment thread delocate/tools.py Outdated
if isdir(fname) and exists(pjoin(fname, '__init__.py')):
package_sdirs.add(fname)
package_sdirs.add((fname, True))
elif isfile(fname) and ((fname.endswith('.so') or fname.endswith('.dylib'))):
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use lib_filt_func here? See delocate_wheel docstring.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how to use lib_filt_func here - here we're not checking the dependencies of found objects, but only whether a member of root_path is a module. What would lib_filt_func is None mean in this context? It can't mean that every directory/file found is a package, nor should lib_filt_func == "dylibs-only" cause the function to ignore packages in subdirs.

Perhaps I should move _dylibs_only() to tools and use it here (and import it in delocating)?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sure sure I understand, I might have been too hasty but lib_filt_func is to decide what files to consider when looking for libraries. I guess it's fine print. Yes, moving to tools sounds like a reasonable thing to do.

@natefoo natefoo force-pushed the top-level-fix-squash branch from eac59ce to aa5c4ab Compare October 15, 2018 17:53
Comment thread delocate/tools.py
@asottile
Copy link
Copy Markdown
Contributor

asottile commented Jan 4, 2019

looks like this has a conflict now -- I'm very interested in using this branch

@matthew-brett
Copy link
Copy Markdown
Owner

@natefoo - OK to rebase? I promise to review quickly.

@asottile
Copy link
Copy Markdown
Contributor

asottile commented Jan 4, 2019

the conflict is pretty trivial -- it's just mad about imports -- (can compare against https://github.com/asottile/delocate/tree/top-level-fix-squash_asottile)

@natefoo natefoo force-pushed the top-level-fix-squash branch from aa5c4ab to 58106c6 Compare February 2, 2019 02:25
@natefoo
Copy link
Copy Markdown
Author

natefoo commented Feb 14, 2019

@matthew-brett ping, I rebased this (also feel free to modify directly).

@ipmb
Copy link
Copy Markdown

ipmb commented Feb 14, 2019

FWIW, I'm using this patch to build pyuwsgi wheels for Mac with success.

@natefoo
Copy link
Copy Markdown
Author

natefoo commented Apr 24, 2019

@matthew-brett Anything I help with to get this over the line?

@asottile
Copy link
Copy Markdown
Contributor

reaching for this again -- unfortunately the conflict is pretty messy now so I'm having trouble rebasing this :(

@bsolomon1124
Copy link
Copy Markdown
Contributor

bsolomon1124 commented May 24, 2020

I'm working on rebasing this on a new branch in #74, but 9f042a8, which consisted of a refactor with libsana.py, is what's making that tedious.

@McSinyx
Copy link
Copy Markdown

McSinyx commented May 25, 2020

@bsolomon1124, thank you for continue working on this. BTW recently per pypa/auditwheel#90, auditwheel has just adopted the new naming scheme for dynamic libraries ({wheelname}.libs).

@natefoo
Copy link
Copy Markdown
Author

natefoo commented Sep 21, 2021

Superseded by #123.

@natefoo natefoo closed this Sep 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants