Repository: conda/conda-build

Issue:
Conda Skeleton goes in a loop for some packages
I was trying to create recipes from the [PyPi simple index](https://pypi.python.org/simple/) of packages and found that some packages the skeleton goes into an infinite look. Here is the output for one of such packages

```
conda skeleton pypi Arqlib
Arqlib not found, trying Arqlib
Arqlib not found, trying Arqlib
Arqlib not found, trying Arqlib
Arqlib not found, trying Arqlib
Arqlib not found, trying Arqlib
Arqlib not found, trying Arqlib
Arqlib not found, trying Arqlib
Arqlib not found, trying Arqlib
Arqlib not found, trying Arqlib
Arqlib not found, trying Arqlib
Arqlib not found, trying Arqlib
Arqlib not found, trying Arqlib
Arqlib not found, trying Arqlib
Arqlib not found, trying Arqlib
Arqlib not found, trying Arqlib
Arqlib not found, trying Arqlib
Arqlib not found, trying Arqlib
Arqlib not found, trying Arqlib
Arqlib not found, trying Arqlib
Arqlib not found, trying Arqlib
Arqlib not found, trying Arqlib
Arqlib not found, trying Arqlib
Arqlib not found, trying Arqlib
Arqlib not found, trying Arqlib
Arqlib not found, trying Arqlib
^CTraceback (most recent call last):
  File "/home/hargup/anaconda/bin/conda-skeleton", line 5, in <module>
    sys.exit(main())
  File "/home/hargup/anaconda/lib/python2.7/site-packages/conda_build/main_skeleton.py", line 188, in main
    args_func(args, p)
  File "/home/hargup/anaconda/lib/python2.7/site-packages/conda_build/main_build.py", line 329, in args_func
    args.func(args, p)
  File "/home/hargup/anaconda/lib/python2.7/site-packages/conda_build/main_skeleton.py", line 202, in execute
    pypi.main(args, parser)
  File "/home/hargup/anaconda/lib/python2.7/site-packages/conda_build/pypi.py", line 298, in main
    versions = client.package_releases(package)
  File "/home/hargup/anaconda/lib/python2.7/xmlrpclib.py", line 1233, in __call__
    return self.__send(self.__name, args)
  File "/home/hargup/anaconda/lib/python2.7/xmlrpclib.py", line 1591, in __request
    verbose=self.__verbose
  File "/home/hargup/anaconda/lib/python2.7/xmlrpclib.py", line 1273, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/home/hargup/anaconda/lib/python2.7/xmlrpclib.py", line 1303, in single_request
    response = h.getresponse(buffering=True)
  File "/home/hargup/anaconda/lib/python2.7/httplib.py", line 1073, in getresponse
    response.begin()
  File "/home/hargup/anaconda/lib/python2.7/httplib.py", line 415, in begin
    version, status, reason = self._read_status()
  File "/home/hargup/anaconda/lib/python2.7/httplib.py", line 371, in _read_status
    line = self.fp.readline(_MAXLINE + 1)
  File "/home/hargup/anaconda/lib/python2.7/socket.py", line 476, in readline
    data = self._sock.recv(self._rbufsize)
  File "/home/hargup/anaconda/lib/python2.7/ssl.py", line 714, in recv
    return self.read(buflen)
  File "/home/hargup/anaconda/lib/python2.7/ssl.py", line 608, in read
    v = self._sslobj.read(len or 1024)
KeyboardInterrupt
```



Discussion:
This should be an easy bug for you to fix :) 


Resolving patch:
diff --git a/conda_build/pypi.py b/conda_build/pypi.py
--- a/conda_build/pypi.py
+++ b/conda_build/pypi.py
@@ -301,12 +301,14 @@ def main(args, parser):
                     # is apparently not (the last time I checked,
                     # len(set(all_packages_lower)) == len(set(all_packages)))
                     if package.lower() in all_packages_lower:
-                        print("%s not found, trying %s" % (package, package.capitalize()))
-                        args.packages.append(all_packages[all_packages_lower.index(package.lower())])
-                        del package_dicts[package]
-                        continue
-                    sys.exit("Error: Could not find any versions of package %s" %
-                             package)
+                        cased_package = all_packages[all_packages_lower.index(package.lower())]
+                        if cased_package != package:
+                            print("%s not found, trying %s" % (package, cased_package))
+                            print(len(args.packages))
+                            args.packages.append(cased_package)
+                            del package_dicts[package]
+                            continue
+                    sys.exit("Error: Could not find any versions of package %s" % package)
                 if len(versions) > 1:
                     print("Warning, the following versions were found for %s" %
                           package)


Test patch: