From: Kefu Chai Date: Wed, 3 Jun 2020 08:47:16 +0000 (+0800) Subject: make configparser a runtime dependency X-Git-Tag: v2.1.0~17^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9c4a76e539e19b029eb949f17a9c170f09906516;p=ceph-deploy.git make configparser a runtime dependency it seems we do need to support duplicated sections, see also e2df002c22c6542746978d7f15a088a81cf82758, and ConfigParser.RawConfigParser from python2 does not offer `strict` parameter, so we have to use configparser as an alternative. otherwise, `ceph_deploy/tests/test_conf.py::test_section_repeat` always fails Signed-off-by: Kefu Chai --- diff --git a/ceph-deploy.spec b/ceph-deploy.spec index 8218266..686613d 100644 --- a/ceph-deploy.spec +++ b/ceph-deploy.spec @@ -31,6 +31,7 @@ BuildRequires: pytest %endif BuildRequires: git Requires: python-argparse +Requires: python-configparser Requires: python-remoto %if 0%{?suse_version} && 0%{?suse_version} <= 1110 %{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} diff --git a/ceph_deploy/conf/ceph.py b/ceph_deploy/conf/ceph.py index e14ad6d..5042404 100644 --- a/ceph_deploy/conf/ceph.py +++ b/ceph_deploy/conf/ceph.py @@ -1,7 +1,4 @@ -try: - import configparser -except ImportError: - import ConfigParser as configparser +import configparser import contextlib import sys @@ -21,8 +18,7 @@ class _TrimIndentFile(object): class CephConf(configparser.RawConfigParser): def __init__(self, *args, **kwargs): - if sys.version_info >= (3, 2): - kwargs.setdefault('strict', False) + kwargs.setdefault('strict', False) # super() cannot be used with an old-style class configparser.RawConfigParser.__init__(self, *args, **kwargs) diff --git a/debian/control b/debian/control index ee3c694..d55e43e 100644 --- a/debian/control +++ b/debian/control @@ -14,6 +14,7 @@ Package: ceph-deploy Architecture: all Depends: python, python-argparse, + python-configparser python-setuptools, python-remoto, ${misc:Depends}, diff --git a/setup.py b/setup.py index 141f3c4..ce03bd0 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,8 @@ install_requires = ['remoto>=1.1.4'] pyversion = sys.version_info[:2] if pyversion < (2, 7) or (3, 0) <= pyversion <= (3, 1): install_requires.append('argparse') - +if pyversion < (3, 0): + install_requires.append('configparser') setup( name='ceph-deploy',