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

Commit

Permalink
Merge branch 'multiroot'
Browse files Browse the repository at this point in the history
  • Loading branch information
orsinium committed Apr 8, 2019
2 parents 185dc96 + 38bd8e1 commit 200b248
Show file tree
Hide file tree
Showing 11 changed files with 73 additions and 10 deletions.
5 changes: 3 additions & 2 deletions dephell/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# app
from .controllers import * # noQA
from .converters import * # noQA
from .models import * # noQA
from .converters import * # noQA
from .models import * # noQA
from .__version__ import * # noQA
4 changes: 4 additions & 0 deletions dephell/__version__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

__version__ = '0.3.1'
__author__ = 'Gram (@orsinium)'
__license__ = 'MIT'
3 changes: 3 additions & 0 deletions dephell/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from .generate_license import GenerateLicenseCommand
from .inspect_config import InspectConfigCommand
from .inspect_gadget import InspectGadgetCommand
from .inspect_self import InspectSelfCommand
from .inspect_venv import InspectVenvCommand
from .jail_install import JailInstallCommand
from .jail_list import JailListCommand
Expand Down Expand Up @@ -42,6 +43,7 @@
'GenerateLicenseCommand',
'InspectConfigCommand',
'InspectGadgetCommand',
'InspectSelfCommand',
'InspectVenvCommand',
'JailInstallCommand',
'JailListCommand',
Expand Down Expand Up @@ -73,6 +75,7 @@
'generate editorconfig': GenerateEditorconfigCommand,
'generate license': GenerateLicenseCommand,
'inspect config': InspectConfigCommand,
'inspect self': InspectSelfCommand,
'inspect venv': InspectVenvCommand,
'inspect gadget': InspectGadgetCommand,
'jail install': JailInstallCommand,
Expand Down
36 changes: 36 additions & 0 deletions dephell/commands/inspect_self.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# built-in
import sys
from argparse import ArgumentParser
from pathlib import Path

# app
from ..actions import make_json
from ..config import builders
from ..__version__ import __version__
from .base import BaseCommand


class InspectSelfCommand(BaseCommand):
"""Show information about DepHell installation.
https://dephell.readthedocs.io/en/latest/cmd-inspect-self.html
"""
@classmethod
def get_parser(cls):
parser = ArgumentParser(
prog='dephell inspect self',
description=cls.__doc__,
)
builders.build_config(parser)
builders.build_output(parser)
builders.build_other(parser)
return parser

def __call__(self):
data = dict(
path=str(Path(__file__).parent.parent),
python=sys.executable,
version=__version__,
)
print(make_json(data=data, key=self.config.get('filter')))
return True
8 changes: 3 additions & 5 deletions dephell/controllers/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,11 @@ def __repr__(self):


class Graph:
def __init__(self, root=None):
if root is not None:
def __init__(self, *roots):
for root in roots:
if not root.dependencies:
logger.warning('empty root passed')
self._roots = [root]
else:
self._roots = []
self._roots = list(roots)
self._layers = []
self.reset()

Expand Down
2 changes: 1 addition & 1 deletion dephell/converters/egginfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def dump(self, reqs, path: Path, project: RootDependency) -> None:
return

if path.suffix != '.egg-info':
path /= project.name + '.egg-info'
path /= project.name.replace('-', '_') + '.egg-info'
path.mkdir(exist_ok=True, parents=True)

(path / 'dependency_links.txt').touch()
Expand Down
2 changes: 1 addition & 1 deletion dephell/converters/sdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def dump(self, reqs, path: Path, project: RootDependency) -> None:
# write metafiles
self._write_content(tar=tar, path='PKG-INFO', content=info)
for fname, getter in getters.items():
fpath = '{}.egg-info/{}'.format(project.name, fname)
fpath = '{}.egg-info/{}'.format(project.name.replace('-', '_'), fname)
self._write_content(tar=tar, path=fpath, content=getter())

# write packages
Expand Down
3 changes: 3 additions & 0 deletions dephell/models/root.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ def merge(self, dep):
def unapply(self, name: str):
raise NotImplementedError

def copy(self):
return type(self)(**attr.asdict(self, recurse=False))

@classmethod
def get_metainfo(cls, other, *others):
"""Merge metainfo, but not dependencies
Expand Down
17 changes: 17 additions & 0 deletions docs/cmd-inspect-self.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# dephell inspect self

Shows information about DepHell installation.

```bash
$ dephell inspect self
{
"path": "/home/gram/Documents/dephell/dephell",
"python": "/usr/local/bin/python3.7",
"version": "0.3.1"
}
```

## See also

1. [dephell autocomplete](cmd-venv-create) to enable params autocomplete for commands in your shell.
1. [dephell inspect config](cmd-inspect-config) to get information about config parameters.
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
:caption: Inspect
cmd-inspect-config
cmd-inspect-self
cmd-inspect-venv
.. toctree::
Expand Down
2 changes: 1 addition & 1 deletion tests/test_commands/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ def test_build_command(temp_path: Path):
result = command()
assert result is True
assert (temp_path / 'setup.py').exists()
assert (temp_path / 'my-package.egg-info' / 'PKG-INFO').exists()
assert (temp_path / 'my_package.egg-info' / 'PKG-INFO').exists()
assert (temp_path / 'dist' / 'my-package-0.1.0.tar.gz').exists()
assert (temp_path / 'dist' / 'my_package-0.1.0-py3-none-any.whl').exists()

0 comments on commit 200b248

Please sign in to comment.