forked from ronaldoussoren/py2app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
black.py
25 lines (18 loc) · 739 Bytes
/
black.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from pkg_resources import get_distribution
from pathlib import Path
def check(cmd, mf):
m = mf.findNode("black")
if m is None or m.filename is None:
return None
egg = Path(get_distribution('black').egg_info)
top = egg / 'top_level.txt'
# These cannot be in zip
packages = ["black", "blib2to3"]
# 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
includes = set(top.read_text().strip().split('\n'))
includes = list(includes.difference(packages))
# Missed dependency
includes.append('pathspec')
return {"includes": includes, "packages": packages}