mirror of
https://github.com/python/cpython.git
synced 2025-08-02 16:13:13 +00:00
[Patch #658094] PEP 301 implementation
Add 'classifiers' keyword to DistributionMetadata
This commit is contained in:
parent
9a3129c148
commit
282e2c36ba
1 changed files with 12 additions and 1 deletions
|
@ -93,6 +93,8 @@ class Distribution:
|
||||||
"print the long package description"),
|
"print the long package description"),
|
||||||
('platforms', None,
|
('platforms', None,
|
||||||
"print the list of platforms"),
|
"print the list of platforms"),
|
||||||
|
('classifiers', None,
|
||||||
|
"print the list of classifiers"),
|
||||||
('keywords', None,
|
('keywords', None,
|
||||||
"print the list of keywords"),
|
"print the list of keywords"),
|
||||||
]
|
]
|
||||||
|
@ -634,6 +636,8 @@ class Distribution:
|
||||||
value = getattr(self.metadata, "get_"+opt)()
|
value = getattr(self.metadata, "get_"+opt)()
|
||||||
if opt in ['keywords', 'platforms']:
|
if opt in ['keywords', 'platforms']:
|
||||||
print string.join(value, ',')
|
print string.join(value, ',')
|
||||||
|
elif opt == 'classifiers':
|
||||||
|
print string.join(value, '\n')
|
||||||
else:
|
else:
|
||||||
print value
|
print value
|
||||||
any_display_options = 1
|
any_display_options = 1
|
||||||
|
@ -962,7 +966,7 @@ class DistributionMetadata:
|
||||||
"maintainer", "maintainer_email", "url",
|
"maintainer", "maintainer_email", "url",
|
||||||
"license", "description", "long_description",
|
"license", "description", "long_description",
|
||||||
"keywords", "platforms", "fullname", "contact",
|
"keywords", "platforms", "fullname", "contact",
|
||||||
"contact_email", "licence")
|
"contact_email", "licence", "classifiers")
|
||||||
|
|
||||||
def __init__ (self):
|
def __init__ (self):
|
||||||
self.name = None
|
self.name = None
|
||||||
|
@ -977,6 +981,7 @@ class DistributionMetadata:
|
||||||
self.long_description = None
|
self.long_description = None
|
||||||
self.keywords = None
|
self.keywords = None
|
||||||
self.platforms = None
|
self.platforms = None
|
||||||
|
self.classifiers = None
|
||||||
|
|
||||||
def write_pkg_info (self, base_dir):
|
def write_pkg_info (self, base_dir):
|
||||||
"""Write the PKG-INFO file into the release tree.
|
"""Write the PKG-INFO file into the release tree.
|
||||||
|
@ -1003,6 +1008,9 @@ class DistributionMetadata:
|
||||||
for platform in self.get_platforms():
|
for platform in self.get_platforms():
|
||||||
pkg_info.write('Platform: %s\n' % platform )
|
pkg_info.write('Platform: %s\n' % platform )
|
||||||
|
|
||||||
|
for classifier in self.get_classifiers():
|
||||||
|
pkg_info.write('Classifier: %s\n' % classifier )
|
||||||
|
|
||||||
pkg_info.close()
|
pkg_info.close()
|
||||||
|
|
||||||
# write_pkg_info ()
|
# write_pkg_info ()
|
||||||
|
@ -1059,6 +1067,9 @@ class DistributionMetadata:
|
||||||
def get_platforms(self):
|
def get_platforms(self):
|
||||||
return self.platforms or ["UNKNOWN"]
|
return self.platforms or ["UNKNOWN"]
|
||||||
|
|
||||||
|
def get_classifiers(self):
|
||||||
|
return self.classifiers or []
|
||||||
|
|
||||||
# class DistributionMetadata
|
# class DistributionMetadata
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue