forked from pulp/pulp_python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.py
More file actions
104 lines (77 loc) · 3.08 KB
/
Copy pathmodels.py
File metadata and controls
104 lines (77 loc) · 3.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
from logging import getLogger
from django.db import models
from pulpcore.plugin.models import Content, Importer, Publisher
log = getLogger(__name__)
PACKAGE_TYPES = (("bdist_dmg", "bdist_dmg"), ("bdist_dumb", "bdist_dumb"),
("bdist_egg", "bdist_egg"), ("bdist_msi", "bdist_msi"),
("bdist_rpm", "bdist_rpm"), ("bdist_wheel", "bdist_wheel"),
("bdist_wininst", "bdist_wininst"), ("sdist", "sdist"))
class Classifier(models.Model):
"""
Custom tags for classifier
Fields:
name (models.TextField): The name of the classifier
Relations:
python_package_content (models.ForeignKey): The PythonPackageContent this classifier
is associated with.
"""
name = models.TextField()
python_package_content = models.ForeignKey("PythonPackageContent", related_name="classifiers",
related_query_name="classifier")
class PythonPackageContent(Content):
"""
A Content Type representing Python's Distribution Package as
defined in pep-0426 and pep-0345
https://www.python.org/dev/peps/pep-0491/
https://www.python.org/dev/peps/pep-0345/
"""
TYPE = 'python'
filename = models.TextField(unique=True, db_index=True, blank=False)
packagetype = models.TextField(blank=False, choices=PACKAGE_TYPES)
name = models.TextField(blank=False)
version = models.TextField(blank=False)
metadata_version = models.TextField(null=True)
summary = models.TextField(null=True)
description = models.TextField(null=True)
keywords = models.TextField(null=True)
home_page = models.TextField(null=True)
download_url = models.TextField(null=True)
author = models.TextField(null=True)
author_email = models.TextField(null=True)
maintainer = models.TextField(null=True)
maintainer_email = models.TextField(null=True)
license = models.TextField(null=True)
requires_python = models.TextField(null=True)
project_url = models.TextField(null=True)
platform = models.TextField(null=True)
supported_platform = models.TextField(null=True)
requires_dist = models.TextField(default="[]", blank=False)
provides_dist = models.TextField(default="[]", blank=False)
obsoletes_dist = models.TextField(default="[]", blank=False)
requires_external = models.TextField(default="[]", blank=False)
class Meta:
unique_together = (
'filename',
)
class PythonPublisher(Publisher):
"""
A Publisher for PythonContent.
Define any additional fields for your new publisher if needed.
A ``publish`` method should be defined.
It is responsible for publishing metadata and artifacts
which belongs to a specific repository.
"""
TYPE = 'python'
def publish(self):
"""
Publish the repository.
"""
raise NotImplementedError
class PythonImporter(Importer):
"""
An Importer for Python Content.
Attributes:
projects (list): A list of python projects to sync
"""
TYPE = 'python'
projects = models.TextField(null=True)