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
08984781
Commit
08984781
authored
Dec 31, 2020
by
Sviatoslav Sydorenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify `dist.Distribution._parse_config_files`
parent
28b54b14
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
24 deletions
+26
-24
setuptools/dist.py
setuptools/dist.py
+26
-24
No files found.
setuptools/dist.py
View file @
08984781
...
...
@@ -557,14 +557,12 @@ class Distribution(_Distribution):
from
configparser
import
ConfigParser
# Ignore install directory options if we have a venv
if
sys
.
prefix
!=
sys
.
base_prefix
:
ignore_options
=
[
'install-base'
,
'install-platbase'
,
'install-lib'
,
'install-platlib'
,
'install-purelib'
,
'install-headers'
,
'install-scripts'
,
'install-data'
,
'prefix'
,
'exec-prefix'
,
'home'
,
'user'
,
'root'
]
else
:
ignore_options
=
[]
ignore_options
=
[]
if
sys
.
prefix
==
sys
.
base_prefix
else
[
'install-base'
,
'install-platbase'
,
'install-lib'
,
'install-platlib'
,
'install-purelib'
,
'install-headers'
,
'install-scripts'
,
'install-data'
,
'prefix'
,
'exec-prefix'
,
'home'
,
'user'
,
'root'
,
]
ignore_options
=
frozenset
(
ignore_options
)
...
...
@@ -585,30 +583,34 @@ class Distribution(_Distribution):
opt_dict
=
self
.
get_option_dict
(
section
)
for
opt
in
options
:
if
opt
!=
'__name__'
and
opt
not
in
ignore_options
:
val
=
parser
.
get
(
section
,
opt
)
opt
=
opt
.
replace
(
'-'
,
'_'
)
opt_dict
[
opt
]
=
(
filename
,
val
)
if
opt
==
'__name__'
or
opt
in
ignore_options
:
continue
val
=
parser
.
get
(
section
,
opt
)
opt
=
opt
.
replace
(
'-'
,
'_'
)
opt_dict
[
opt
]
=
(
filename
,
val
)
# Make the ConfigParser forget everything (so we retain
# the original filenames that options come from)
parser
.
__init__
()
if
'global'
not
in
self
.
command_options
:
return
# If there was a "global" section in the config file, use it
# to set Distribution options.
if
'global'
in
self
.
command_options
:
for
(
opt
,
(
src
,
val
))
in
self
.
command_options
[
'global'
].
items
():
alias
=
self
.
negative_opt
.
get
(
opt
)
try
:
if
alias
:
setattr
(
self
,
alias
,
not
strtobool
(
val
))
elif
opt
in
(
'verbose'
,
'dry_run'
):
# ugh!
setattr
(
self
,
opt
,
strtobool
(
val
))
else
:
setattr
(
self
,
opt
,
val
)
except
ValueError
as
e
:
raise
DistutilsOptionError
(
e
)
from
e
for
(
opt
,
(
src
,
val
))
in
self
.
command_options
[
'global'
].
items
():
alias
=
self
.
negative_opt
.
get
(
opt
)
if
alias
:
val
=
not
strtobool
(
val
)
elif
opt
in
(
'verbose'
,
'dry_run'
):
# ugh!
val
=
strtobool
(
val
)
try
:
setattr
(
self
,
alias
or
opt
,
val
)
except
ValueError
as
e
:
raise
DistutilsOptionError
(
e
)
from
e
def
_set_command_options
(
self
,
command_obj
,
option_dict
=
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