Repository: conda/conda-build

Issue:
pypi url broken
If i do

> enzo$ conda skeleton pypi scs
> INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): pypi.io
> INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): pypi.org
> Error: XMLRPC Fault while parsing PyPI response.  This is likely a transient error - please try again soon.

The url to pypi is broken. I fixed this by changing

>    pypi.add_argument(
>        "--pypi-url",
>        action="store",
>        default='https://pypi.io/pypi',
>        help="URL to use for PyPI (default: %(default)s).",
>    )

into

>    pypi.add_argument(
>        "--pypi-url",
>        action="store",
>        default='https://pypi.python.org/pypi',
>        help="URL to use for PyPI (default: %(default)s).",
>    )

in main_skeleton.py



Discussion:
Thanks for this report, and especially for the fix.  There's a little more detail in #1177 - I'm closing this issue as a duplicate.  Please follow the other issue for status.


Resolving patch:
diff --git a/conda_build/main_skeleton.py b/conda_build/main_skeleton.py
--- a/conda_build/main_skeleton.py
+++ b/conda_build/main_skeleton.py
@@ -113,7 +113,7 @@ def main():
     pypi.add_argument(
         "--pypi-url",
         action="store",
-        default='https://pypi.io/pypi',
+        default='https://pypi.python.org/pypi',
         help="URL to use for PyPI (default: %(default)s).",
     )
     pypi.add_argument(
diff --git a/conda_build/pypi.py b/conda_build/pypi.py
--- a/conda_build/pypi.py
+++ b/conda_build/pypi.py
@@ -35,9 +35,9 @@
 from conda_build.metadata import MetaData
 
 if sys.version_info < (3,):
-    from xmlrpclib import ServerProxy, Transport, ProtocolError, Fault
+    from xmlrpclib import ServerProxy, Transport, ProtocolError
 else:
-    from xmlrpc.client import ServerProxy, Transport, ProtocolError, Fault
+    from xmlrpc.client import ServerProxy, Transport, ProtocolError
 
 
 PYPI_META = """\
@@ -236,14 +236,10 @@ def parse_response(self, resp):
         """
         Parse the xmlrpc response.
         """
-        try:
-            p, u = self.getparser()
-            p.feed(resp.text.encode("utf-8"))
-            p.close()
-            ret = u.close()
-        except Fault:
-            raise RuntimeError("XMLRPC Fault while parsing PyPI response.  "
-                               "This is likely a transient error - please try again soon.")
+        p, u = self.getparser()
+        p.feed(resp.text.encode("utf-8"))
+        p.close()
+        ret = u.close()
         return ret
 
     def _build_url(self, host, handler):
@@ -264,8 +260,13 @@ def main(args, parser):
     package_dicts = {}
     [output_dir] = args.output_dir
 
-    # searching is faster than listing all packages
-    all_packages = [match["name"] for match in client.search({"name": args.packages}, "or")]
+    # all_packages = client.list_packages()
+    # searching is faster than listing all packages, but we need to separate URLs from names
+    all_packages = []
+
+    urls = [package for package in args.packages if ':' in package]
+    names = [package for package in args.packages if package not in urls]
+    all_packages = urls + [match["name"] for match in client.search({"name": names}, "or")]
     all_packages_lower = [i.lower() for i in all_packages]
 
     args.created_recipes = []


Test patch:
diff --git a/tests/test-skeleton/sympy-0.7.5-url/meta.yaml b/tests/test-skeleton/sympy-0.7.5-url/meta.yaml
--- a/tests/test-skeleton/sympy-0.7.5-url/meta.yaml
+++ b/tests/test-skeleton/sympy-0.7.5-url/meta.yaml
@@ -4,7 +4,7 @@ package:
 
 source:
   fn: sympy-0.7.5.tar.gz
-  url: https://pypi.io/packages/source/s/sympy/sympy-0.7.5.tar.gz#md5=7de1adb49972a15a3dd975e879a2bea9
+  url: https://pypi.python.org/packages/8c/a5/5fa8adee81837687f7315122769fc0b0e8b042c69e2fe5809c41191c7183/sympy-0.7.5.tar.gz#md5=7de1adb49972a15a3dd975e879a2bea9
   md5: 7de1adb49972a15a3dd975e879a2bea9
 #  patches:
    # List any patch files here
diff --git a/tests/test-skeleton/sympy-0.7.5/meta.yaml b/tests/test-skeleton/sympy-0.7.5/meta.yaml
--- a/tests/test-skeleton/sympy-0.7.5/meta.yaml
+++ b/tests/test-skeleton/sympy-0.7.5/meta.yaml
@@ -4,7 +4,7 @@ package:
 
 source:
   fn: sympy-0.7.5.tar.gz
-  url: https://files.pythonhosted.org/packages/8c/a5/5fa8adee81837687f7315122769fc0b0e8b042c69e2fe5809c41191c7183/sympy-0.7.5.tar.gz
+  url: https://pypi.python.org/packages/8c/a5/5fa8adee81837687f7315122769fc0b0e8b042c69e2fe5809c41191c7183/sympy-0.7.5.tar.gz
   md5: 7de1adb49972a15a3dd975e879a2bea9
 #  patches:
    # List any patch files here
diff --git a/tests/test-skeleton/test_skeleton.py b/tests/test-skeleton/test_skeleton.py
--- a/tests/test-skeleton/test_skeleton.py
+++ b/tests/test-skeleton/test_skeleton.py
@@ -36,8 +36,7 @@ def test_name_with_version_specified(tmpdir):
 
 def test_url(tmpdir):
     cmd = "conda skeleton pypi --output-dir {} \
-https://pypi.io/packages/source/s/sympy/\
-sympy-0.7.5.tar.gz#md5=7de1adb49972a15a3dd975e879a2bea9".format(tmpdir)
+https://pypi.python.org/packages/8c/a5/5fa8adee81837687f7315122769fc0b0e8b042c69e2fe5809c41191c7183/sympy-0.7.5.tar.gz#md5=7de1adb49972a15a3dd975e879a2bea9".format(tmpdir)  # NOQA
     subprocess.check_call(cmd.split())
     with open('{}/sympy-0.7.5-url/meta.yaml'.format(thisdir)) as f:
         expected = yaml.load(f)