Skip to content

Commit da3934e

Browse files
ishidawatarujleveque
authored andcommitted
avoid using pkg_resources for faster command execution (sonic-net#426)
Signed-off-by: Wataru Ishida <[email protected]>
1 parent 220e269 commit da3934e

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

setup.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
# https://github.com/ninjaaron/fast-entry_points
2+
# workaround for slow 'pkg_resources' import
3+
#
4+
# NOTE: this only has effect on console_scripts and no speed-up for commands
5+
# under scripts/. Consider stop using scripts and use console_scripts instead
6+
#
7+
# https://stackoverflow.com/questions/18787036/difference-between-entry-points-console-scripts-and-scripts-in-setup-py
8+
try:
9+
import fastentrypoints
10+
except ImportError:
11+
from setuptools.command import easy_install
12+
import pkg_resources
13+
easy_install.main(['fastentrypoints'])
14+
pkg_resources.require('fastentrypoints')
15+
import fastentrypoints
16+
117
import glob
218
from setuptools import setup
319
import unittest

0 commit comments

Comments
 (0)