Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add recipe for black #418

Merged
merged 3 commits into from Apr 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions py2app/recipes/__init__.py
@@ -1,6 +1,7 @@
from . import PIL # noqa: F401
from . import automissing # noqa: F401
from . import autopackages # noqa: F401
from . import black # noqa: F401
from . import ctypes # noqa: F401
from . import detect_dunder_file # noqa: F401
from . import ftplib # noqa: F401
Expand Down
26 changes: 26 additions & 0 deletions py2app/recipes/black.py
@@ -0,0 +1,26 @@
import os
from pkg_resources import get_distribution


def check(cmd, mf):
m = mf.findNode("black")
if m is None or m.filename is None:
return None

egg = get_distribution('black').egg_info
top = os.path.join(egg, 'top_level.txt')

# These cannot be in zip
packages = ["black", "blib2to3"]
mrclary marked this conversation as resolved.
Show resolved Hide resolved

# black may include optimized platform specific C extension which has
# unusual name, e.g. 610faff656c4cfcbb4a3__mypyc; best to determine it from
# the egg-info/top_level.txt
with open(top, 'r') as f:
includes = set(f.read().strip().split('\n'))
includes = list(includes.difference(packages))

# Missed dependency
includes.append('pathspec')
mrclary marked this conversation as resolved.
Show resolved Hide resolved

return {"includes": includes, "packages": packages}