From 6a473a103ce86d4ff9d28a35e1500f330a66e8e9 Mon Sep 17 00:00:00 2001 From: Daniel Alley Date: Tue, 25 Jun 2024 10:15:55 -0400 Subject: [PATCH] Update pkginfo library to support newer python packages closes #689 --- CHANGES/689.feature | 1 + .../0014_pythonpackagecontent_dynamic.py | 19 +++++++++++++++++++ pulp_python/app/models.py | 5 +++++ pulp_python/app/utils.py | 1 + 4 files changed, 26 insertions(+) create mode 100644 CHANGES/689.feature create mode 100644 pulp_python/app/migrations/0014_pythonpackagecontent_dynamic.py diff --git a/CHANGES/689.feature b/CHANGES/689.feature new file mode 100644 index 00000000..324f8edd --- /dev/null +++ b/CHANGES/689.feature @@ -0,0 +1 @@ +Support Python package metadata version 2.3 diff --git a/pulp_python/app/migrations/0014_pythonpackagecontent_dynamic.py b/pulp_python/app/migrations/0014_pythonpackagecontent_dynamic.py new file mode 100644 index 00000000..7702c315 --- /dev/null +++ b/pulp_python/app/migrations/0014_pythonpackagecontent_dynamic.py @@ -0,0 +1,19 @@ +# Generated by Django 4.2.10 on 2024-06-28 04:12 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('python', '0013_add_rbac_permissions'), + ] + + operations = [ + migrations.AddField( + model_name='pythonpackagecontent', + name='dynamic', + field=models.TextField(default=''), + preserve_default=False, + ), + ] diff --git a/pulp_python/app/models.py b/pulp_python/app/models.py index e3e0d2c8..62ea23ab 100644 --- a/pulp_python/app/models.py +++ b/pulp_python/app/models.py @@ -145,6 +145,10 @@ class PythonPackageContent(Content): PROTECTED_FROM_RECLAIM = False + # TODO: it appears we've set the default (usually empty-string) for each of these fields + # manually in the migrations rather than setting them declaratively. That's not ideal. + # At some point we should add proper default values and probably make some fields nullable. + TYPE = "python" repo_key_fields = ("filename",) # Required metadata @@ -178,6 +182,7 @@ class PythonPackageContent(Content): classifiers = models.JSONField(default=list) project_urls = models.JSONField(default=dict) description_content_type = models.TextField() + dynamic = models.TextField() # Pulp Domains _pulp_domain = models.ForeignKey("core.Domain", default=get_domain_pk, on_delete=models.PROTECT) diff --git a/pulp_python/app/utils.py b/pulp_python/app/utils.py index f66dcbd7..66fa0ca1 100644 --- a/pulp_python/app/utils.py +++ b/pulp_python/app/utils.py @@ -220,6 +220,7 @@ def python_content_to_info(content): "keywords": content.keywords or "", "description": content.description or "", "description_content_type": content.description_content_type or "", + "dynamic": content.dynamic or None, "bugtrack_url": None, # These two are basically never used "docs_url": None, "downloads": {"last_day": -1, "last_month": -1, "last_week": -1},