← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~ilasc/launchpad:add-name-to-conda-pkg into launchpad:master

 

Ioana Lasc has proposed merging ~ilasc/launchpad:add-name-to-conda-pkg into launchpad:master.

Commit message:
Add the name to Conda packages

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~ilasc/launchpad/+git/launchpad/+merge/432894
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~ilasc/launchpad:add-name-to-conda-pkg into launchpad:master.
diff --git a/lib/lp/archivepublisher/artifactory.py b/lib/lp/archivepublisher/artifactory.py
index f56799e..2d32f30 100644
--- a/lib/lp/archivepublisher/artifactory.py
+++ b/lib/lp/archivepublisher/artifactory.py
@@ -67,7 +67,10 @@ def _path_for(
     elif repository_format == ArchiveRepositoryFormat.CONDA:
         subdir = release.getUserDefinedField("subdir")
         if subdir is None:
-            raise ValueError("Cannot publish a Conda package with no subdir")
+            raise ValueError("Cannot publish the Conda package '%s' "
+                             "with version '%s', missing the 'subdir' "
+                             "Conda property)"
+                             % (source_name, source_version))
         path = rootpath / subdir
     elif repository_format == ArchiveRepositoryFormat.GO_PROXY:
         module_path = release.getUserDefinedField("module-path")
diff --git a/lib/lp/archivepublisher/tests/test_artifactory.py b/lib/lp/archivepublisher/tests/test_artifactory.py
index 8cea8dd..2aefd4c 100644
--- a/lib/lp/archivepublisher/tests/test_artifactory.py
+++ b/lib/lp/archivepublisher/tests/test_artifactory.py
@@ -126,6 +126,16 @@ class TestArtifactoryPool(TestCase):
             pool.pathFor(None, "foo", "1.0", pub_file),
         )
 
+    def test_pathFor_conda_with_file_no_subir(self):
+        pool = self.makePool(ArchiveRepositoryFormat.CONDA)
+        pub_file = FakePackageReleaseFile(
+            b"foo",
+            "foo-1.0.tar.bz2",
+            user_defined_fields=[("bogus_filed", "instead_of_subdir")],
+        )
+        self.assertRaises(ValueError, pool.pathFor,
+                          None, "foo", "1.0", pub_file)
+
     def test_pathFor_go_proxy_with_file(self):
         pool = self.makePool(ArchiveRepositoryFormat.GO_PROXY)
         pub_file = FakePackageReleaseFile(