# Path: models.py
# PHP_PEAR_PKG      =  500
# 
# PHP_PEAR2_PKG     =  501


import string
from django.contrib import messages
from models import PHP_PEAR_PKG, PHP_PEAR2_PKG
        Parse the output of `composer.phar show --installed`.

        @request - HttpRequest object - used for showing error messages
        @package_text - string - the output of the command

        @return - dict - { 'errors' : int, 'packages' : [{ 'n' : 'v' }]}
    """
    result = {'packages' : []}
    errors = 0
    for line in package_text.split("\n"):
        name = None
        version = None

        pkg_ver = line.strip()

        # skip empty lines
        if not pkg_ver:
            continue

        # skip lines w/o / - names are :vendor/:package
        if pkg_ver.find('/') == -1:
            continue

        try:
            splt = pkg_ver.split(' ')
            name = splt[0]

            # handle external PEAR repos
            if name.startswith('pear-pear.php.net'):
                name = name.split('/')[1]

# Path: models.py
# PHP_PEAR_PKG      =  500
# 
# PHP_PEAR2_PKG     =  501


# Path: pkg_parsers.py
import string
from django.contrib import messages
from models import PHP_PEAR_PKG, PHP_PEAR2_PKG

        Parse the output of `composer.phar show --installed`.

        @request - HttpRequest object - used for showing error messages
        @package_text - string - the output of the command

        @return - dict - { 'errors' : int, 'packages' : [{ 'n' : 'v' }]}
    """
    result = {'packages' : []}
    errors = 0
    for line in package_text.split("\n"):
        name = None
        version = None

        pkg_ver = line.strip()

        # skip empty lines
        if not pkg_ver:
            continue

        # skip lines w/o / - names are :vendor/:package
        if pkg_ver.find('/') == -1:
            continue

        try:
            splt = pkg_ver.split(' ')
            name = splt[0]

            # handle external PEAR repos
            if name.startswith('pear-pear.php.net'):
                name = name.split('/')[1]

                type = PHP_PEAR_PKG