# 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_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',
                                                                u'specs': []}],
                                                  u'name': u'python_version=="2.6"'}],
                               u'extras': [{u'depends': [{u'name': u'reportlab',
                                                          u'specs': [(u'>=', u'1.2')]},
                                                         {u'name': u'rxp',
                                                          u'specs': []},
                                                         ],
                                            u'name': u'PDF'},
                                           {u'depends': [{u'name': u'docutils',
                                                          u'specs': [(u'>=', u'0.3')]}],
                                            u'name': u'reST'}],
                               u'has_dep_errors': False}

expected_egg_file_data = {'attrs': {'packagetype': 'bdist_egg', 'python_version': 'source'},
                          'basename': 'test_package34-0.3.1-py2.7.egg',
                          'dependencies': expected_dependencies,
                          'platform': None}

class Test(unittest.TestCase):

    maxDiff = None
    def test_sdist(self):

# 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_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',
                                                                u'specs': []}],
                                                  u'name': u'python_version=="2.6"'}],
                               u'extras': [{u'depends': [{u'name': u'reportlab',
                                                          u'specs': [(u'>=', u'1.2')]},
                                                         {u'name': u'rxp',
                                                          u'specs': []},
                                                         ],
                                            u'name': u'PDF'},
                                           {u'depends': [{u'name': u'docutils',
                                                          u'specs': [(u'>=', u'0.3')]}],
                                            u'name': u'reST'}],
                               u'has_dep_errors': False}

expected_egg_file_data = {'attrs': {'packagetype': 'bdist_egg', 'python_version': 'source'},
                          'basename': 'test_package34-0.3.1-py2.7.egg',
                          'dependencies': expected_dependencies,
                          'platform': None}

class Test(unittest.TestCase):

    maxDiff = None
    def test_sdist(self):

        filename = data_dir('test_package34-0.3.1.tar.gz')