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
4e4efa77
Commit
4e4efa77
authored
Oct 28, 2018
by
Deniz Taneli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
`check_license` no longer needs to parse `setup.cfg`
parent
74245728
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
17 deletions
+13
-17
setuptools/command/sdist.py
setuptools/command/sdist.py
+13
-17
No files found.
setuptools/command/sdist.py
View file @
4e4efa77
...
...
@@ -201,25 +201,21 @@ class sdist(sdist_add_defaults, orig.sdist):
manifest
.
close
()
def
check_license
(
self
):
"""Read the setup configuration file ('setup.cfg') and use it to find
if a license is defined with the 'license_file' attribute.
If the license is declared and exists, it will be added to
'self.filelist'.
"""Checks if license_file' is configured and adds it to
'self.filelist' if the value contains a valid path.
"""
cfg_file
=
'setup.cfg'
log
.
debug
(
"Reading configuration from %s"
,
cfg_file
)
parser
=
configparser
.
RawConfigParser
()
parser
.
read
(
cfg_file
)
opts
=
self
.
distribution
.
get_option_dict
(
'metadata'
)
try
:
license_file
=
parser
.
get
(
'metadata'
,
'license_file'
)
if
not
os
.
path
.
exists
(
license_file
):
log
.
warn
(
"warning: Failed to find license file '%s' in setup.cfg"
,
license_file
)
return
# ignore the source of the value
_
,
license_file
=
opts
.
get
(
'license_file'
)
except
TypeError
:
log
.
debug
(
"'license_file' attribute is not defined"
)
return
self
.
filelist
.
append
(
license_file
)
except
configparser
.
Error
:
log
.
debug
(
"license_file attribute is not defined in setup.cfg"
)
if
not
os
.
path
.
exists
(
license_file
):
log
.
warn
(
"warning: Failed to find the configured license file '%s'"
,
license_file
)
return
self
.
filelist
.
append
(
license_file
)
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