diff options
author | Zuul <zuul@review.opendev.org> | 2021-04-22 12:11:51 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2021-04-22 12:11:51 +0000 |
commit | 5c4dae09edab6e3dbc786e5086ff5e2ecb43c8af (patch) | |
tree | 9ddf58435e530d3de7ed23425daac70ed06bc6c9 | |
parent | c4ea653db4791dbab86e1dc75eefc95effead741 (diff) | |
parent | 16a8553e9f7630951b5a21b74a1d39063ccb9689 (diff) | |
download | pbr-5c4dae09edab6e3dbc786e5086ff5e2ecb43c8af.tar.gz |
Merge "Don't pass empty 'long_description'"
-rw-r--r-- | pbr/util.py | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/pbr/util.py b/pbr/util.py index d821183..44b6a6e 100644 --- a/pbr/util.py +++ b/pbr/util.py @@ -321,28 +321,26 @@ def setup_cfg_to_setup_kwargs(config, script_args=()): section, option = alias elif len(alias) == 1: - # The distutils field name is the same thant distutils2's. + # The distutils field name is the same as distutils2's. section = alias[0] option = arg in_cfg_value = has_get_option(config, section, option) + if not in_cfg_value and arg == "long_description": + in_cfg_value = has_get_option(config, section, "description_file") + if in_cfg_value: + in_cfg_value = split_multiline(in_cfg_value) + value = '' + for filename in in_cfg_value: + description_file = io.open(filename, encoding='utf-8') + try: + value += description_file.read().strip() + '\n\n' + finally: + description_file.close() + in_cfg_value = value + if not in_cfg_value: - # There is no such option in the setup.cfg - if arg == "long_description": - in_cfg_value = has_get_option(config, section, - "description_file") - if in_cfg_value: - in_cfg_value = split_multiline(in_cfg_value) - value = '' - for filename in in_cfg_value: - description_file = io.open(filename, encoding='utf-8') - try: - value += description_file.read().strip() + '\n\n' - finally: - description_file.close() - in_cfg_value = value - else: - continue + continue if arg in CSV_FIELDS: in_cfg_value = split_csv(in_cfg_value) |