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 #292 from jayvdb/setuppy-sort-extras
Browse files Browse the repository at this point in the history
setuppy: Emit sorted dictionaries
  • Loading branch information
orsinium committed Nov 13, 2019
2 parents 904b15e + cfc3f66 commit da99b39
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
10 changes: 7 additions & 3 deletions dephell/converters/setuppy.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from collections import defaultdict
from distutils.core import run_setup
from io import BytesIO, StringIO
from json import dumps as json_dumps
from logging import getLogger
from pathlib import Path
from typing import Optional
Expand Down Expand Up @@ -204,7 +205,7 @@ def dumps(self, reqs, project: RootDependency, content=None) -> str:
entrypoints = defaultdict(list)
for entrypoint in project.entrypoints:
entrypoints[entrypoint.group].append(str(entrypoint))
content.append(('entry_points', dict(entrypoints)))
content.append(('entry_points', entrypoints))

# packages, package_data
content.append(('packages', sorted(str(p) for p in project.package.packages)))
Expand Down Expand Up @@ -236,14 +237,17 @@ def dumps(self, reqs, project: RootDependency, content=None) -> str:
for env in req.main_envs:
extras[env].append(formatted)
if extras:
content.append(('extras_require', dict(extras)))
content.append(('extras_require', extras))

if project.readme is not None:
readme = project.readme.to_rst().as_code()
else:
readme = "readme = ''"

content = ',\n '.join('{}={!r}'.format(name, value) for name, value in content)
content = ',\n '.join(
'{}={!s}'.format(name, json_dumps(value, sort_keys=True))
if isinstance(value, dict) else '{}={!r}'.format(name, value)
for name, value in content)
content = TEMPLATE.format(kwargs=content, readme=readme)

# beautify
Expand Down
15 changes: 7 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
description='Dependency resolution for Python',
python_requires='>=3.5',
project_urls={
'documentation': 'https://dephell.org/docs/',
'homepage': 'https://dephell.org/',
'repository': 'https://github.com/dephell/dephell',
'documentation': 'https://dephell.org/docs/'
'repository': 'https://github.com/dephell/dephell'
},
author='Gram',
author_email='master_fess@mail.ru',
Expand All @@ -50,7 +50,7 @@
],
package_data={'dephell': ['templates/*.j2', 'templates/*.sh']},
install_requires=[
'aiohttp', 'appdirs', 'attrs>=19.1.0',
'aiohttp', 'appdirs', 'attrs>=19.2.0',
'bowler; python_version >= "3.6"',
'bowler-py35>=0.9.1; python_version < "3.6"', 'cerberus>=1.3',
'dephell-archive>=0.1.5', 'dephell-discover>=0.2.6',
Expand All @@ -64,15 +64,14 @@
'setuptools', 'tabulate', 'tomlkit', 'yaspin'
],
extras_require={
'full': ['aiofiles', 'autopep8', 'colorama', 'graphviz', 'yapf'],
'tests': ['aioresponses', 'pytest', 'requests-mock'],
'dev': [
'aioresponses', 'alabaster', 'flake8-isort', 'isort[pyproject]',
'pygments-github-lexers', 'pytest', 'recommonmark', 'requests-mock',
'sphinx'
],
'docs': [
'alabaster', 'pygments-github-lexers', 'recommonmark', 'sphinx'
]
'docs':
['alabaster', 'pygments-github-lexers', 'recommonmark', 'sphinx'],
'full': ['aiofiles', 'autopep8', 'colorama', 'graphviz', 'yapf'],
'tests': ['aioresponses', 'pytest', 'requests-mock']
},
)

0 comments on commit da99b39

Please sign in to comment.