Sha256: 29a49f0737ab072f05eea7da1cbd3772b3a4e98a5858ef3ddba2f9b55b85f860

Contents?: true

Size: 1.12 KB

Versions: 21

Compression:

Stored size: 1.12 KB

Contents

#!/usr/bin/env python

import json
import sys

try:
        from pip._internal.req import parse_requirements
except ImportError:
        from pip.req import parse_requirements

try:
    # since pip 19.3
    from pip._internal.network.session import PipSession
except ImportError:
    try:
        # since pip 10
        from pip._internal.download import PipSession
    except ImportError:
        from pip.download import PipSession

from pip._vendor import pkg_resources
from pip._vendor.six import print_

reqs = []
for req in parse_requirements(sys.argv[1], session=PipSession()):
    if req.req == None or (req.markers != None and not req.markers.evaluate()): continue
    reqs.append(req)

requirements = [pkg_resources.Requirement.parse(str(req.req)) for req in reqs]

transform = lambda dist: {
        'name': dist.project_name,
        'version': dist.version,
        'location': dist.location,
        'dependencies': list(map(lambda dependency: dependency.project_name, dist.requires())),
        }

packages = [transform(dist) for dist
            in pkg_resources.working_set.resolve(requirements)]

print_(json.dumps(packages))

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
license_finder-6.14.1 bin/license_finder_pip.py
license_finder-6.13.0 bin/license_finder_pip.py
license_finder-6.12.2 bin/license_finder_pip.py
license_finder-6.12.1 bin/license_finder_pip.py
license_finder-6.12.0 bin/license_finder_pip.py
license_finder-6.11.0 bin/license_finder_pip.py
license_finder-6.10.1 bin/license_finder_pip.py
license_finder-6.10.0 bin/license_finder_pip.py
license_finder-6.9.0 bin/license_finder_pip.py
license_finder-6.8.2 bin/license_finder_pip.py
license_finder-6.8.1 bin/license_finder_pip.py
license_finder-6.8.0 bin/license_finder_pip.py
license_finder-6.7.0 bin/license_finder_pip.py
license_finder-6.6.2 bin/license_finder_pip.py
license_finder-6.6.1 bin/license_finder_pip.py
license_finder-6.6.0 bin/license_finder_pip.py
license_finder-6.5.0 bin/license_finder_pip.py
license_finder-6.4.0 bin/license_finder_pip.py
license_finder-6.3.0 bin/license_finder_pip.py
license_finder-6.2.0 bin/license_finder_pip.py