Skip to content

Commit

Permalink
Update pkginfo library to support newer python packages
Browse files Browse the repository at this point in the history
closes #689
  • Loading branch information
dralley committed Jun 28, 2024
1 parent 781b976 commit 2c7bd88
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES/689.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Support Python package metadata version 2.3
19 changes: 19 additions & 0 deletions pulp_python/app/migrations/0014_pythonpackagecontent_dynamic.py
Original file line number Diff line number Diff line change
@@ -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,
),
]
5 changes: 5 additions & 0 deletions pulp_python/app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down
2 changes: 2 additions & 0 deletions pulp_python/app/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def parse_project_metadata(project):
package['classifiers'] = json.dumps(project.get('classifiers', []))
package['project_urls'] = json.dumps(project.get('project_urls', {}))
package['description_content_type'] = project.get('description_content_type') or ""
package['dynamic'] = project.get('dynamic') or ""

return package

Expand Down Expand Up @@ -220,6 +221,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},
Expand Down

0 comments on commit 2c7bd88

Please sign in to comment.