sonic-buildimage/src/sonic-config-engine/setup.py
Stepan Blyshchak 5361794ffd
[sonic-cfggen] remove lazy_re workaround due to many optimizations done (#8226)
lazy_re had an issue when importing sonic-cfggen in another application that
uses re.search(). There is no much improvement of lazy_re today after many 
other good optimization work done for sonic-cfggen. It served as a quick 
temporary solution.

Some quick test for fast-reboot and warm-reboot done on top of 201911 branch:

Fast-reboot: from ASIC reset to ports in up state:
with lazy_re: 18 sec
without lazy_re: 18 sec

Warm-reboot: LAG restoration time:
with lazy_re: 73 sec
without lazy_re: 72 sec

So, there is no real optimization since the number of sonic-cfggen calls is greatly 
reduced in latest SONiC. This means it is time to revert this change.

Signed-off-by: Stepan Blyschak <stepanb@nvidia.com>
2021-07-24 05:35:09 -07:00

89 lines
2.6 KiB
Python

import glob
import sys
from setuptools import setup
# Common dependencies for Python 2 and 3
dependencies = [
'bitarray==1.5.3',
'ipaddress==1.0.23',
'lxml==4.6.3',
'netaddr==0.8.0',
'pyyaml==5.4.1',
'sonic-py-common',
]
if sys.version_info.major == 3:
# Python 3-only dependencies
dependencies += [
# pyangbind v0.8.1 pull down enum43 which causes 're' package to malfunction.
# Python3 has enum module and so pyangbind should be installed outside
# dependencies section of setuptools followed by uninstall of enum43
# 'pyangbind==0.8.1',
'Jinja2>=2.10',
'sonic-yang-mgmt>=1.0',
'sonic-yang-models>=1.0'
]
else:
# Python 2-only dependencies
dependencies += [
# Jinja2 v3.0.0+ dropped support for Python 2.7 and causes setuptools to
# malfunction on stretch slave docker.
'future',
'Jinja2<3.0.0',
'pyangbind==0.6.0',
'zipp==1.2.0', # importlib-resources needs zipp and seems to have a bug where it will try to install too new of a version for Python 2
'importlib-resources==3.3.1', # importlib-resources v4.0.0 was released 2020-12-23 and drops support for Python 2
'contextlib2==0.6.0.post1'
]
# Common modules for python2 and python3
py_modules = [
'config_samples',
'minigraph',
'openconfig_acl',
'portconfig',
'redis_bcc',
]
if sys.version_info.major == 3:
# Python 3-only modules
py_modules += [
'sonic_yang_cfg_generator'
]
setup(
name = 'sonic-config-engine',
version = '1.0',
description = 'Utilities for generating SONiC configuration files',
author = 'Taoyu Li',
author_email = 'taoyl@microsoft.com',
url = 'https://github.com/Azure/sonic-buildimage',
py_modules = py_modules,
scripts = [
'sonic-cfggen',
],
install_requires = dependencies,
data_files = [
('/usr/share/sonic/templates', glob.glob('data/*')),
],
setup_requires= [
'pytest-runner',
'wheel'
],
tests_require=[
'pytest',
],
classifiers = [
'Intended Audience :: Developers',
'Natural Language :: English',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
],
keywords = 'SONiC sonic-cfggen config-engine PYTHON python'
)