Skip to content
This repository has been archived by the owner on Jan 12, 2021. It is now read-only.

Commit

Permalink
Merge pull request #249 from dephell/fix-setuptools-lists
Browse files Browse the repository at this point in the history
correct retrieving of lists for setup.py
  • Loading branch information
orsinium committed Aug 9, 2019
2 parents e755ad0 + 2096d6b commit 0c7acc1
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
11 changes: 10 additions & 1 deletion dephell/converters/setuppy.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,16 @@ def _get(msg, name: str) -> str:

@staticmethod
def _get_list(msg, name: str) -> tuple:
values = getattr(msg, name, None)
if name == 'keywords':
return ' '.join(msg.get_keywords()).split()

getter = getattr(msg, 'get_' + name, None)
if getter:
values = getter()
else:
values = getattr(msg, name, None)
if type(values) is str:
values = values.split()
if not values:
return ()
return tuple(value for value in values if value != 'UNKNOWN' and value.strip())
Expand Down
13 changes: 12 additions & 1 deletion tests/requirements/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
description='Dependency resolution for Python',
long_description=long_description,
long_description_content_type='text/markdown',
url='https://github.com/orsinium/dephell',
url='https://dephell.org/',
author='orsinium',

packages=[],
Expand All @@ -38,6 +38,17 @@
extras_require=dict(
windows=['colorama'],
),

classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'Topic :: Software Development :: Build Tools',
'License :: OSI Approved :: MIT License',
],
keywords='sample setuptools development',
project_urls={ # Optional
'Source': 'https://github.com/dephell/dephell/',
},
entry_points={
'console_scripts': ['dephell = dephell.cli:entrypoint'],
},
Expand Down
2 changes: 2 additions & 0 deletions tests/test_converters/test_setuppy.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ def test_load_metadata():
assert root.name == 'dephell'
assert root.version == '0.2.0'
assert root.authors[0].name == 'orsinium'
assert len(root.classifiers) == 4
assert len(root.keywords) == 3
assert not root.license


Expand Down

0 comments on commit 0c7acc1

Please sign in to comment.