Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 282e2c3

Browse files
committed
[Patch #658094] PEP 301 implementation
Add 'classifiers' keyword to DistributionMetadata
1 parent 9a3129c commit 282e2c3

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

Lib/distutils/dist.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ class Distribution:
9393
"print the long package description"),
9494
('platforms', None,
9595
"print the list of platforms"),
96+
('classifiers', None,
97+
"print the list of classifiers"),
9698
('keywords', None,
9799
"print the list of keywords"),
98100
]
@@ -634,6 +636,8 @@ def handle_display_options (self, option_order):
634636
value = getattr(self.metadata, "get_"+opt)()
635637
if opt in ['keywords', 'platforms']:
636638
print string.join(value, ',')
639+
elif opt == 'classifiers':
640+
print string.join(value, '\n')
637641
else:
638642
print value
639643
any_display_options = 1
@@ -962,7 +966,7 @@ class DistributionMetadata:
962966
"maintainer", "maintainer_email", "url",
963967
"license", "description", "long_description",
964968
"keywords", "platforms", "fullname", "contact",
965-
"contact_email", "licence")
969+
"contact_email", "licence", "classifiers")
966970

967971
def __init__ (self):
968972
self.name = None
@@ -977,6 +981,7 @@ def __init__ (self):
977981
self.long_description = None
978982
self.keywords = None
979983
self.platforms = None
984+
self.classifiers = None
980985

981986
def write_pkg_info (self, base_dir):
982987
"""Write the PKG-INFO file into the release tree.
@@ -1003,6 +1008,9 @@ def write_pkg_info (self, base_dir):
10031008
for platform in self.get_platforms():
10041009
pkg_info.write('Platform: %s\n' % platform )
10051010

1011+
for classifier in self.get_classifiers():
1012+
pkg_info.write('Classifier: %s\n' % classifier )
1013+
10061014
pkg_info.close()
10071015

10081016
# write_pkg_info ()
@@ -1059,6 +1067,9 @@ def get_keywords(self):
10591067
def get_platforms(self):
10601068
return self.platforms or ["UNKNOWN"]
10611069

1070+
def get_classifiers(self):
1071+
return self.classifiers or []
1072+
10621073
# class DistributionMetadata
10631074

10641075

0 commit comments

Comments
 (0)