Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1420)

Side by Side Diff: Lib/packaging/pypi/dist.py

Issue 14778: logging messages about bad version numbers should include the project name
Patch Set: Created 1 year, 1 month ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Misc/ACKS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 """Classes representing releases and distributions retrieved from indexes. 1 """Classes representing releases and distributions retrieved from indexes.
2 2
3 A project (= unique name) can have several releases (= versions) and 3 A project (= unique name) can have several releases (= versions) and
4 each release can have several distributions (= sdist and bdists). 4 each release can have several distributions (= sdist and bdists).
5 5
6 Release objects contain metadata-related information (see PEP 376); 6 Release objects contain metadata-related information (see PEP 376);
7 distribution objects contain download-related information. 7 distribution objects contain download-related information.
8 """ 8 """
9 9
10 import re 10 import re
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 self.add_distribution(dist_type, **kwargs) 70 self.add_distribution(dist_type, **kwargs)
71 71
72 def set_version(self, version): 72 def set_version(self, version):
73 try: 73 try:
74 self._version = NormalizedVersion(version) 74 self._version = NormalizedVersion(version)
75 except IrrationalVersionError: 75 except IrrationalVersionError:
76 suggestion = suggest_normalized_version(version) 76 suggestion = suggest_normalized_version(version)
77 if suggestion: 77 if suggestion:
78 self.version = suggestion 78 self.version = suggestion
79 else: 79 else:
80 raise IrrationalVersionError(version) 80 raise IrrationalVersionError("%s: %s" % (self.name, version))
81 81
82 def get_version(self): 82 def get_version(self):
83 return self._version 83 return self._version
84 84
85 version = property(get_version, set_version) 85 version = property(get_version, set_version)
86 86
87 def fetch_metadata(self): 87 def fetch_metadata(self):
88 """If the metadata is not set, use the indexes to get it""" 88 """If the metadata is not set, use the indexes to get it"""
89 if not self.metadata: 89 if not self.metadata:
90 self._index.get_metadata(self.name, str(self.version)) 90 self._index.get_metadata(self.name, str(self.version))
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 name = probable_name 535 name = probable_name
536 version = archive_name.lstrip(name) 536 version = archive_name.lstrip(name)
537 else: 537 else:
538 name, version = eager_split(archive_name) 538 name, version = eager_split(archive_name)
539 539
540 version = suggest_normalized_version(version) 540 version = suggest_normalized_version(version)
541 if version is not None and name != "": 541 if version is not None and name != "":
542 return name.lower(), version 542 return name.lower(), version
543 else: 543 else:
544 raise CantParseArchiveName(archive_name) 544 raise CantParseArchiveName(archive_name)
OLDNEW
« no previous file with comments | « no previous file | Misc/ACKS » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld cbc36f91f3f7