1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
#!/usr/bin/python3
import sys
import os
sys.path.insert(0, os.environ['PWD'])
from importlib.metadata import distribution
def load_entry_point(spec, group, name):
dist_name, _, _ = spec.partition('==')
matches = (
entry_point
for entry_point in distribution(dist_name).entry_points
if entry_point.group == group and entry_point.name == name
)
return next(matches).load()
if __name__ == '__main__':
sys.exit(
load_entry_point('livereload', 'console_scripts', 'livereload')()
)
|