Skip to content
Myr

version detection works with python -m package

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Lord · committed by David Lord · parent 81ff0ae · Browse files · 1 file+12 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Co-authored-by: Claudio Jolowicz <claudio.jolowicz@cyren.com>

Diff stats

1 file+12 added−2 removed

  • other:+12 added−2 removed

1 file+12 added−2 removed

modified:src/click/decorators.py+12 added-2 removed
287 unmodified lines
288 Use :mod:`importlib.metadata` instead of ``pkg_resources``.289 """290 if version is None and package_name is None:291 frame = inspect.currentframe()292 f_globals = frame.f_back.f_globals if frame is not None else None293 # break reference cycle294 # https://docs.python.org/3/library/inspect.html#the-interpreter-stack295 del frame296293 if frame is not None:294 package_name = frame.f_back.f_globals.get("__name__").partition(".")[0]297 if f_globals is not None:298 package_name = f_globals.get("__name__")299300 if package_name == "__main__":301 package_name = f_globals.get("__package__")302303 if package_name:304 package_name = package_name.partition(".")[0]305306 def callback(ctx, param, value):307 if not value or ctx.resilient_parsing:308 return309
76 unmodified lines