Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
b1a6b3c4
Commit
b1a6b3c4
authored
Dec 08, 2009
by
Tarek Ziadé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed the usage of rfc822 in favor of email.message.Message
parent
3eb783e7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
32 deletions
+31
-32
dist.py
dist.py
+31
-32
No files found.
dist.py
View file @
b1a6b3c4
...
...
@@ -7,7 +7,7 @@ being built/installed/distributed.
__revision__
=
"$Id$"
import
sys
,
os
,
re
import
rfc822
from
email
import
message_from_file
try
:
import
warnings
...
...
@@ -1007,20 +1007,6 @@ Common commands: (see '--help-commands' for more)
# to self.metadata.get_XXX. The actual code is in the
# DistributionMetadata class, below.
class
_MetadataMessage
(
rfc822
.
Message
):
def
read_field
(
self
,
name
):
value
=
self
[
name
]
if
value
==
'UNKNOWN'
:
return
None
return
value
def
getheaders
(
self
,
name
,
default
):
values
=
rfc822
.
Message
.
getheaders
(
self
,
name
)
if
values
==
[]:
return
None
return
values
class
DistributionMetadata
:
"""Dummy class to hold the distribution meta-data: name, version,
author, and so forth.
...
...
@@ -1061,38 +1047,51 @@ class DistributionMetadata:
def
read_pkg_file
(
self
,
file
):
"""Reads the metadata values from a file object."""
msg
=
_MetadataMessage
(
file
)
msg
=
message_from_file
(
file
)
def
_read_field
(
name
):
value
=
msg
[
name
]
if
value
==
'UNKNOWN'
:
return
None
return
value
def
_read_list
(
name
):
values
=
msg
.
get_all
(
name
,
None
)
if
values
==
[]:
return
None
return
values
metadata_version
=
msg
[
'metadata-version'
]
self
.
name
=
msg
.
read_field
(
'name'
)
self
.
version
=
msg
.
read_field
(
'version'
)
self
.
description
=
msg
.
read_field
(
'summary'
)
self
.
name
=
_
read_field
(
'name'
)
self
.
version
=
_
read_field
(
'version'
)
self
.
description
=
_
read_field
(
'summary'
)
# we are filling author only.
self
.
author
=
msg
.
read_field
(
'author'
)
self
.
author
=
_
read_field
(
'author'
)
self
.
maintainer
=
None
self
.
author_email
=
msg
.
read_field
(
'author-email'
)
self
.
author_email
=
_
read_field
(
'author-email'
)
self
.
maintainer_email
=
None
self
.
url
=
msg
.
read_field
(
'home-page'
)
self
.
license
=
msg
.
read_field
(
'license'
)
self
.
url
=
_
read_field
(
'home-page'
)
self
.
license
=
_
read_field
(
'license'
)
if
'download-url'
in
msg
:
self
.
download_url
=
msg
.
read_field
(
'download-url'
)
self
.
download_url
=
_
read_field
(
'download-url'
)
else
:
self
.
download_url
=
None
self
.
long_description
=
msg
.
read_field
(
'description'
)
self
.
description
=
msg
.
read_field
(
'summary'
)
self
.
long_description
=
_
read_field
(
'description'
)
self
.
description
=
_
read_field
(
'summary'
)
if
'keywords'
in
msg
:
self
.
keywords
=
msg
.
read_field
(
'keywords'
).
split
(
','
)
self
.
keywords
=
_
read_field
(
'keywords'
).
split
(
','
)
self
.
platforms
=
msg
.
getheaders
(
'platform'
,
None
)
self
.
classifiers
=
msg
.
getheaders
(
'classifier'
,
None
)
self
.
platforms
=
_read_list
(
'platform'
)
self
.
classifiers
=
_read_list
(
'classifier'
)
# PEP 314 - these fields only exist in 1.1
if
metadata_version
==
'1.1'
:
self
.
requires
=
msg
.
getheaders
(
'requires'
,
None
)
self
.
provides
=
msg
.
getheaders
(
'provides'
,
None
)
self
.
obsoletes
=
msg
.
getheaders
(
'obsoletes'
,
None
)
self
.
requires
=
_read_list
(
'requires'
)
self
.
provides
=
_read_list
(
'provides'
)
self
.
obsoletes
=
_read_list
(
'obsoletes'
)
else
:
self
.
requires
=
None
self
.
provides
=
None
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment