Пример #1
0
def _parse_requirements(file_path):
    pip_ver = pkg_resources.get_distribution('pip').version
    pip_version = list(map(int, pip_ver.split('.')[:2]))
    if pip_version >= [6, 0]:
        raw = parse_requirements(file_path, session=download.PipSession())
    else:
        raw = parse_requirements(file_path)
    return [str(i.req) for i in raw]
Пример #2
0
def __gather_dependencies(require_file):
    requirements = parse_requirements(require_file, session=download.PipSession())
    _reqs, _links = [], []
    for item in requirements:
        has_link = False
        if getattr(item, 'url', None):
            _links.append(str(item.url))
            has_link = True
        if getattr(item, 'link', None):
            _links.append(str(item.link))
            has_link = True
        if item.req:
            req = str(item.req)
            _reqs.append(__normalize(req) if has_link else req)
    return _reqs, _links
def check_dependencies(requirement_file_name):
    """
    Checks to see if the python dependencies are fullfilled.
    If check passes return 0. Otherwise print error and return 1
    """
    check_result = {}
    dependencies = []
    session = download.PipSession()
    for req in parse_requirements(requirement_file_name, session=session):
        if req.markers is not None:
            extras_requested = ('', )
            if not any(
                    req.markers.evaluate({'extra': extra})
                    for extra in extras_requested):
                continue
        if req.req is not None:
            dependencies.append(str(req.req))
        else:
            pass
    try:
        pkg_resources.working_set.require(dependencies)
    except VersionConflict as e:
        try:
            check_result['result'] = False
            check_result[
                'error'] = "{} was found on your system, but {} is required.".format(
                    e.dist, e.req)
            return check_result
        except AttributeError:
            check_result['result'] = False
            check_result['error'] = str(e)
            return check_result
    except DistributionNotFound as e:
        check_result['result'] = False
        check_result['error'] = str(e)
        return check_result
    check_result['result'] = True
    return check_result
Пример #4
0
"""
from setuptools import setup
from distutils.version import LooseVersion

# noinspection PyPackageRequirements
import pip

import bzt

# thanks to pip there are two :incompatible ways to parse requirements.txt
if hasattr(pip, '__version__') and LooseVersion(str(
        pip.__version__)) >= LooseVersion('10.0.0'):
    # new versions of pip require a session
    from pip._internal import req, download
    requirements = req.parse_requirements('requirements.txt',
                                          session=download.PipSession())
elif hasattr(pip, '__version__') and LooseVersion(str(
        pip.__version__)) >= LooseVersion('7.0'):
    # new versions of pip require a session
    requirements = pip.req.parse_requirements(
        'requirements.txt', session=pip.download.PipSession())
else:
    # old versions do not
    requirements = pip.req.parse_requirements('requirements.txt')

requires = [str(item.req) for item in requirements]

setup(
    name="bzt",
    version=bzt.VERSION,
    description='Taurus Tool for Continuous Testing',
Пример #5
0
links = []  # for repo urls (dependency_links)
requires = []  # for package names

try: # for pip >= 10
    from pip._internal.req import parse_requirements
except ImportError: # for pip <= 9.0.3
    from pip.req import parse_requirements

try: # for pip >= 10
    from pip._internal import download
except ImportError: # for pip <= 9.0.3
    from pip import download

# new versions of pip requires a session
requirements = parse_requirements(
    'requirements.txt', session=download.PipSession()
)

for item in requirements:
    link = None
    if getattr(item, 'url', None):  # older pip has url
        link = str(item.url)
    if getattr(item, 'link', None):  # newer pip has link
        link = str(item.link)
    if link:
        link = link.lstrip('git+')
        links.append(link)
    if item.req:
        item_req = str(item.req)
        if item_req == 'pattern':
            continue
Пример #6
0
try:
    from pip._internal import download, req
except ImportError:
    # for pip < 10.0.0
    from pip import req, download
from setuptools import setup, find_packages

with open('README.rst') as readme_file:
    readme = readme_file.read()

with open('HISTORY.rst') as history_file:
    history = history_file.read()

parsed_requirements = req.parse_requirements('requirements.txt',
                                             session=download.PipSession())

parsed_test_requirements = req.parse_requirements(
    'requirements_dev.txt', session=download.PipSession())

requirements = [str(ir.req) for ir in parsed_requirements]
setup_requirements = [
    'setuptools_scm',
    # TODO(fcorone2): put setup requirements
    # (distutils extensions, etc.) here
]
test_requirements = [str(tr.req) for tr in parsed_test_requirements]

setup(
    name='treerunner_lib',
    use_scm_version=True,
Пример #7
0
import pip
try: # for pip >= 10
   from pip._internal.req import parse_requirements
except ImportError: # for pip <= 9.0.3
   from pip.req import parse_requirements
try: # for pip >= 10
  from pip._internal import download
except ImportError: # for pip <= 9.0.3
  from pip import download
from setuptools import setup, find_packages


links = []  # for repo urls (dependency_links)
requires = []  # for package names

requirements = parse_requirements('requirements.txt', session=download.PipSession())

for item in requirements:
    if getattr(item, 'url', None):  # older pip has url
        links.append(str(item.url))
    if getattr(item, 'link', None):  # newer pip has link
        links.append(str(item.link))
    if item.req:
        requires.append(str(item.req))  # always the package name

setup(name='wasprng',
      version='0.1',
      description='Wasp release note generator',
      url='https://gitlab.com/AgileFactory/Agile.Wasp2',
      author='Andrea Fonti',
      author_email='*****@*****.**',
Пример #8
0
# limitations under the License.

import os
try:
    from pip._internal.req import parse_requirements
    from pip._internal import download
except ImportError:
    from pip.req import parse_requirements
    from pip import download
    
from setuptools import setup, find_packages

def read(fname):
    return open(os.path.join(os.path.dirname(__file__), fname)).read()

requirements = [str(requirement.req) for requirement in parse_requirements('requirements.txt', session=download.PipSession())]

setup(
    name='project_generator',
    version='0.9.10',
    description='Project generators for various embedded tools (IDE). IAR, uVision, Makefile and many more in the roadmap!',
    author='Martin Kojtal',
    author_email='*****@*****.**',
    keywords="c cpp project generator embedded",
    url="https://github.com/project-generator/project_generator",
    classifiers= [
        "Development Status :: 3 - Alpha",
        "Environment :: Console",
        "License :: OSI Approved :: Apache Software License",
        "Operating System :: OS Independent",
        "Programming Language :: Python",