Repository: conda/conda-build

Issue:
Build fails for conda skeleton pypi python-Levenshtein --version 0.12.0
Different error from #608 (resolved by #527) but same library. [python-Levenshtein](https://github.com/ztane/python-Levenshtein/) does not appear to be under a lot of active development, so it's possible something is not configured properly on the pypi side.

> PS pkg:> conda skeleton pypi python-Levenshtein --version 0.12.0
> An unexpected error has occurred, please consider sending the
> following traceback to the conda GitHub issue tracker at:
> 
> ```
> https://github.com/conda/conda-build/issues
> ```
> 
> Include the output of the command 'conda info' in your report.
> 
> Traceback (most recent call last):
>   File "C:\Anaconda3\Scripts\conda-skeleton-script.py", line 4, in <module>
>     sys.exit(main())
>   File "C:\Anaconda3\lib\site-packages\conda_build\main_skeleton.py", line 300, in main
>     args_func(args, p)
>   File "C:\Anaconda3\lib\site-packages\conda_build\main_build.py", line 373, in args_func
>     args.func(args, p)
>   File "C:\Anaconda3\lib\site-packages\conda_build\main_skeleton.py", line 315, in execute
>     pypi.main(args, parser)
>   File "C:\Anaconda3\lib\site-packages\conda_build\pypi.py", line 269, in main
>     all_packages = client.list_packages()
>   File "C:\Anaconda3\lib\xmlrpc\client.py", line 1091, in **call**
>     return self.__send(self.__name, args)
>   File "C:\Anaconda3\lib\xmlrpc\client.py", line 1431, in __request
>     verbose=self.__verbose
>   File "C:\Anaconda3\lib\xmlrpc\client.py", line 1133, in request
>     return self.single_request(host, handler, request_body, verbose)
>   File "C:\Anaconda3\lib\xmlrpc\client.py", line 1166, in single_request
>     dict(resp.getheaders())
> xmlrpc.client.ProtocolError: <ProtocolError for pypi.io/pypi: 503 backend read error>

And System Info: 

> PS pkg:> conda info
> Using Anaconda Cloud api site https://api.anaconda.org
> Current conda install:
> 
> ```
>          platform : win-64
>     conda version : 4.0.7
> ```
> 
>   conda-build version : 1.20.3
>        python version : 3.5.1.final.0
>      requests version : 2.9.1
>      root environment : C:\Anaconda3  (writable)
>   default environment : C:\Anaconda3
>      envs directories : C:\Anaconda3\envs
>         package cache : C:\Anaconda3\pkgs
>          channel URLs : https://repo.continuum.io/pkgs/free/win-64/
>                         https://repo.continuum.io/pkgs/free/noarch/
>                         https://repo.continuum.io/pkgs/pro/win-64/
>                         https://repo.continuum.io/pkgs/pro/noarch/
>           config file : C:\Users[redacted].condarc
>     is foreign system : False



Discussion:

Resolving patch:
diff --git a/conda_build/pypi.py b/conda_build/pypi.py
--- a/conda_build/pypi.py
+++ b/conda_build/pypi.py
@@ -266,7 +266,8 @@ def main(args, parser):
     package_dicts = {}
     [output_dir] = args.output_dir
 
-    all_packages = client.list_packages()
+    # searching is faster than listing all packages
+    all_packages = [match["name"] for match in client.search({"name": args.packages}, "or")]
     all_packages_lower = [i.lower() for i in all_packages]
 
     args.created_recipes = []


Test patch: