# Path: binstar_client/inspect_package/pypi.py
# PARTIAL_PYPI_SPEC_PATTERN = re.compile(r'''
#     # Text needs to be stripped and all extra spaces replaced by single spaces
#     (?P<name>^[A-Z0-9][A-Z0-9._-]*)?
#     \s?
#     (\[(?P<extras>.*)\])?
#     \s?
#     (?P<constraints>\(? \s? ([\w\d<>=!~,\s\.\*]*) \s? \)? )?
#     \s?
# ''', re.VERBOSE | re.IGNORECASE)
# def norm_package_name(name):
# def norm_package_version(version):
# def split_spec(spec, sep):
# def parse_specification(spec):
# def get_header_description(filedata):
# def python_version_check(filedata):
# def parse_requirement(line, deps, extras, extra):
# def parse_requires_txt(requires_txt):
# def format_requirements(requires):
# def format_run_requires_metadata(run_requires):
# def format_requires_metadata(run_requires):
# def format_sdist_header_metadata(data, filename):
# def format_wheel_json_metadata(data, filename, zipfile):
# def inspect_pypi_package_whl(filename, fileobj):
# def disutils_dependencies(config_items):
# def inspect_pypi_package_sdist(filename, fileobj):
# def inspect_pypi_package_egg(filename, fileobj):
# def inspect_pypi_package_zip(filename, fileobj):
# def inspect_pypi_package_exe(filename, fileobj):
# def inspect_pypi_package_rpm(filename, fileobj):
# def inspect_pypi_package(filename, fileobj, *args, **kwargs):
# def main():
# 
# Path: binstar_client/utils/test/utils.py
# def data_dir(filename):
#     base_path = inspect.stack()[1][1]  # function caller path
#     test_data = os.path.join(os.path.dirname(base_path), 'data')
#     return os.path.join(test_data, filename)


import os
import shutil
import tempfile
import unittest
from pprint import pprint
from binstar_client.inspect_package import pypi
from binstar_client.utils.test.utils import data_dir
expected_package_data = {'name': 'test-package34',
                         'license': 'custom',
                         'summary': 'Python test package for binstar client'}

expected_version_data = {'home_page': 'http://github.com/binstar/binstar_pypi',
                         'version': '0.3.1',
                         'description':'longer description of the package'}

expected_dependencies = {'depends': [ {'name': u'python-dateutil', 'specs': []},
                                      {'name': u'pytz', 'specs': []},
                                      {'name': u'pyyaml', 'specs': []},
                                      {'name': u'requests', 'specs': [(u'>=', u'2.0'), (u'<=', u'3.0')]}, ],
                          'extras': [{'depends': [{'name': u'argparse',
                                                   'specs': []}],
                                      'name': u':python_version=="2.6"'},
                                     {'depends': [{'name': u'reportlab',
                                                   'specs': [(u'>=', u'1.2')]},
                                                  {'name': u'rxp', 'specs': []}],
                                      'name': u'PDF'},
                                     {'depends': [{'name': u'docutils',
                                                   'specs': [(u'>=', u'0.3')]}],
                                      'name': u'reST'}],
                          'has_dep_errors': False}

expected_whl_dependencies = {u'depends': [{u'name': u'python-dateutil', u'specs': []},
                                          {u'name': u'pytz', u'specs': []},
                                          {u'name': u'pyyaml', u'specs': []},
                                          {u'name': u'requests',
                                             u'specs': [(u'>=', u'2.0'),
                                                        (u'<=', u'3.0')]}],

# Path: binstar_client/inspect_package/pypi.py
# PARTIAL_PYPI_SPEC_PATTERN = re.compile(r'''
#     # Text needs to be stripped and all extra spaces replaced by single spaces
#     (?P<name>^[A-Z0-9][A-Z0-9._-]*)?
#     \s?
#     (\[(?P<extras>.*)\])?
#     \s?
#     (?P<constraints>\(? \s? ([\w\d<>=!~,\s\.\*]*) \s? \)? )?
#     \s?
# ''', re.VERBOSE | re.IGNORECASE)
# def norm_package_name(name):
# def norm_package_version(version):
# def split_spec(spec, sep):
# def parse_specification(spec):
# def get_header_description(filedata):
# def python_version_check(filedata):
# def parse_requirement(line, deps, extras, extra):
# def parse_requires_txt(requires_txt):
# def format_requirements(requires):
# def format_run_requires_metadata(run_requires):
# def format_requires_metadata(run_requires):
# def format_sdist_header_metadata(data, filename):
# def format_wheel_json_metadata(data, filename, zipfile):
# def inspect_pypi_package_whl(filename, fileobj):
# def disutils_dependencies(config_items):
# def inspect_pypi_package_sdist(filename, fileobj):
# def inspect_pypi_package_egg(filename, fileobj):
# def inspect_pypi_package_zip(filename, fileobj):
# def inspect_pypi_package_exe(filename, fileobj):
# def inspect_pypi_package_rpm(filename, fileobj):
# def inspect_pypi_package(filename, fileobj, *args, **kwargs):
# def main():
# 
# Path: binstar_client/utils/test/utils.py
# def data_dir(filename):
#     base_path = inspect.stack()[1][1]  # function caller path
#     test_data = os.path.join(os.path.dirname(base_path), 'data')
#     return os.path.join(test_data, filename)


# Path: binstar_client/inspect_package/tests/test_pypi.py
import os
import shutil
import tempfile
import unittest
from pprint import pprint
from binstar_client.inspect_package import pypi
from binstar_client.utils.test.utils import data_dir

expected_package_data = {'name': 'test-package34',
                         'license': 'custom',
                         'summary': 'Python test package for binstar client'}

expected_version_data = {'home_page': 'http://github.com/binstar/binstar_pypi',
                         'version': '0.3.1',
                         'description':'longer description of the package'}

expected_dependencies = {'depends': [ {'name': u'python-dateutil', 'specs': []},
                                      {'name': u'pytz', 'specs': []},
                                      {'name': u'pyyaml', 'specs': []},
                                      {'name': u'requests', 'specs': [(u'>=', u'2.0'), (u'<=', u'3.0')]}, ],
                          'extras': [{'depends': [{'name': u'argparse',
                                                   'specs': []}],
                                      'name': u':python_version=="2.6"'},
                                     {'depends': [{'name': u'reportlab',
                                                   'specs': [(u'>=', u'1.2')]},
                                                  {'name': u'rxp', 'specs': []}],
                                      'name': u'PDF'},
                                     {'depends': [{'name': u'docutils',
                                                   'specs': [(u'>=', u'0.3')]}],
                                      'name': u'reST'}],
                          'has_dep_errors': False}

expected_whl_dependencies = {u'depends': [{u'name': u'python-dateutil', u'specs': []},
                                          {u'name': u'pytz', u'specs': []},
                                          {u'name': u'pyyaml', u'specs': []},
                                          {u'name': u'requests',
                                             u'specs': [(u'>=', u'2.0'),
                                                        (u'<=', u'3.0')]}],

                               u'environments': [{u'depends': [{u'name': u'argparse',