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

Commit

Permalink
Merge branch 'python-convertion'
Browse files Browse the repository at this point in the history
  • Loading branch information
orsinium committed Apr 21, 2019
2 parents baa291f + 5cbc01b commit cb9fe20
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 29 deletions.
2 changes: 1 addition & 1 deletion dephell/__version__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

__version__ = '0.5.0'
__version__ = '0.5.1'
__author__ = 'Gram (@orsinium)'
__license__ = 'MIT'
4 changes: 2 additions & 2 deletions dephell/commands/jail_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
# app
from ..actions import get_entrypoints, get_python, get_resolver
from ..config import builders
from ..constants import IS_WINDOWS
from ..controllers import analize_conflict
from ..models import Requirement
from ..package_manager import PackageManager
from ..utils import is_windows
from .base import BaseCommand


Expand Down Expand Up @@ -95,7 +95,7 @@ def __call__(self) -> bool:
def _publish_script(src: Path, dst: Path):
if dst.exists() or dst.is_symlink():
dst.unlink()
if is_windows():
if IS_WINDOWS:
shutil.copy(str(src), str(dst))
else:
# Python 3.5 cannot resove non-existing paths.
Expand Down
13 changes: 3 additions & 10 deletions dephell/constants.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# built-in
import os
import platform
from collections import OrderedDict
from datetime import date
from enum import Enum, unique
Expand All @@ -13,11 +15,7 @@ class ReturnCodes(Enum):
UNKNOWN_EXCEPTION = 3


@unique
class JoinTypes(Enum):
AND = 1
OR = 2

IS_WINDOWS = (os.name == 'nt') or (platform.system() == 'Windows')

FORMATS = (
'egginfo',
Expand Down Expand Up @@ -56,11 +54,6 @@ class JoinTypes(Enum):
LOG_LEVELS = ('DEBUG', 'INFO', 'WARNING', 'ERROR', 'EXCEPTION')
LOG_FORMATTERS = ('short', 'full')

PYTHONS_DEPRECATED = ('2.6', '2.7', '3.0', '3.1', '3.2', '3.3', '3.4')
PYTHONS_POPULAR = ('3.5', '3.6', '3.7')
PYTHONS_UNRELEASED = ('3.8', '4.0')
PYTHONS = PYTHONS_POPULAR + PYTHONS_DEPRECATED + PYTHONS_UNRELEASED

# https://github.com/github/markup
EXTENSIONS = MappingProxyType(OrderedDict([
('rst', 'rst'),
Expand Down
2 changes: 1 addition & 1 deletion dephell/converters/egginfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def make_info(self, reqs, project: RootDependency, with_requires: bool) -> str:
if project.license:
content.append(('License', project.license))
if project.python:
content.append(('Requires-Python', str(project.python)))
content.append(('Requires-Python', str(project.python.peppify())))
if project.keywords:
content.append(('Keywords', ','.join(project.keywords)))
for classifier in project.classifiers:
Expand Down
26 changes: 26 additions & 0 deletions dephell/converters/installed.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from pathlib import Path
from typing import Union, Iterable

from dephell_discover import Root as PackageRoot
from packaging.utils import canonicalize_name

# app
Expand Down Expand Up @@ -39,6 +40,31 @@ def load(self, path: Union[Path, str] = None, paths: Iterable[Union[Path, str]]
for path in paths:
if isinstance(path, str):
path = Path(path)

if path.suffix == '.egg':
name = path.with_suffix('').name.split('-')[0]
if names is not None and name not in names:
continue

# read *.egg dir
egg_path = path / 'EGG-INFO'
if not egg_path.exists():
continue
subroot = EggInfoConverter().load_dir(egg_path)
subroot.package = PackageRoot(path=path, name=root.name)
if not subroot.package.packages: # we cannot read single *.py file yet
continue
deps = DependencyMaker.from_root(dep=subroot, root=root)
for dep in deps:
if dep.name in self._blacklist:
continue
if dep.name in all_deps:
all_deps[dep.name] |= dep
else:
all_deps[dep.name] = dep
continue

# read site-packages / dist-packages
for converter, pattern in parsers:
for info_path in path.glob(pattern):
name = info_path.with_suffix('').name.split('-')[0]
Expand Down
2 changes: 1 addition & 1 deletion dephell/converters/setuppy.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def dumps(self, reqs, project: RootDependency, content=None) -> str:
if project.description:
content.append(('description', project.description))
if project.python:
content.append(('python_requires', str(project.python)))
content.append(('python_requires', str(project.python.peppify())))

# links
fields = (
Expand Down
10 changes: 0 additions & 10 deletions dephell/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# built-in
import os
import platform
from itertools import product


Expand All @@ -27,14 +25,6 @@ def lazy_product(*all_groups):
break


def is_windows() -> bool:
if os.name == 'nt':
return True
if platform.system() == 'Windows':
return True
return False


# https://github.com/bottlepy/bottle/commit/fa7733e075da0d790d809aa3d2f53071897e6f76
# https://github.com/pydanny/cached-property/blob/master/cached_property.py
class cached_property(object): # noqa: N801
Expand Down
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ command = "sphinx-build -M html docs docs/build"

[tool.poetry]
name = "dephell"
version = "0.5.0"
version = "0.5.1"
authors = ["Gram <master_fess@mail.ru>"]
description = "Dependency resolution for Python"
readme = "README.md"
Expand Down Expand Up @@ -118,7 +118,7 @@ dephell-links = "*"
dephell-markers = "*"
dephell-pythons = "*"
dephell-shells = "*"
dephell-specifier = "*"
dephell-specifier = ">=0.1.4"
dephell-venvs = "*"

[tool.poetry.dev-dependencies]
Expand All @@ -129,6 +129,6 @@ sphinx-rtd-theme = "*"
pygments-github-lexers = "*"

[tool.poetry.extras]
full = ["yapf", "aiofiles", "colorama", "graphviz", "autopep8"]
full = ["aiofiles", "autopep8", "colorama", "graphviz", "yapf"]
tests = ["pytest"]
docs = ["sphinx", "recommonmark", "pygments-github-lexers", "sphinx-rtd-theme"]
docs = ["sphinx", "recommonmark", "sphinx-rtd-theme", "pygments-github-lexers"]

0 comments on commit cb9fe20

Please sign in to comment.