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
8c7d2e1f
Commit
8c7d2e1f
authored
Feb 09, 2014
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Normalize whitespace and imports
parent
2394cfef
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
35 deletions
+16
-35
setuptools/command/setopt.py
setuptools/command/setopt.py
+16
-35
No files found.
setuptools/command/setopt.py
View file @
8c7d2e1f
import
distutils
,
os
import
os
import
distutils
from
setuptools
import
Command
from
setuptools
import
Command
from
distutils.util
import
convert_path
from
distutils.util
import
convert_path
from
distutils
import
log
from
distutils
import
log
from
distutils.errors
import
*
from
distutils.errors
import
DistutilsOptionError
__all__
=
[
'config_file'
,
'edit_config'
,
'option_base'
,
'setopt'
]
__all__
=
[
'config_file'
,
'edit_config'
,
'option_base'
,
'setopt'
]
...
@@ -25,20 +26,6 @@ def config_file(kind="local"):
...
@@ -25,20 +26,6 @@ def config_file(kind="local"):
"config_file() type must be 'local', 'global', or 'user'"
,
kind
"config_file() type must be 'local', 'global', or 'user'"
,
kind
)
)
def
edit_config
(
filename
,
settings
,
dry_run
=
False
):
def
edit_config
(
filename
,
settings
,
dry_run
=
False
):
"""Edit a configuration file to include `settings`
"""Edit a configuration file to include `settings`
...
@@ -61,7 +48,8 @@ def edit_config(filename, settings, dry_run=False):
...
@@ -61,7 +48,8 @@ def edit_config(filename, settings, dry_run=False):
opts
.
add_section
(
section
)
opts
.
add_section
(
section
)
for
option
,
value
in
options
.
items
():
for
option
,
value
in
options
.
items
():
if
value
is
None
:
if
value
is
None
:
log
.
debug
(
"Deleting %s.%s from %s"
,
log
.
debug
(
"Deleting %s.%s from %s"
,
section
,
option
,
filename
section
,
option
,
filename
)
)
opts
.
remove_option
(
section
,
option
)
opts
.
remove_option
(
section
,
option
)
...
@@ -78,7 +66,8 @@ def edit_config(filename, settings, dry_run=False):
...
@@ -78,7 +66,8 @@ def edit_config(filename, settings, dry_run=False):
log
.
info
(
"Writing %s"
,
filename
)
log
.
info
(
"Writing %s"
,
filename
)
if
not
dry_run
:
if
not
dry_run
:
f
=
open
(
filename
,
'w'
);
opts
.
write
(
f
);
f
.
close
()
with
open
(
filename
,
'w'
)
as
f
:
opts
.
write
(
f
)
class
option_base
(
Command
):
class
option_base
(
Command
):
"""Abstract base class for commands that mess with config files"""
"""Abstract base class for commands that mess with config files"""
...
@@ -119,8 +108,6 @@ class option_base(Command):
...
@@ -119,8 +108,6 @@ class option_base(Command):
self
.
filename
,
=
filenames
self
.
filename
,
=
filenames
class
setopt
(
option_base
):
class
setopt
(
option_base
):
"""Save command-line options to a file"""
"""Save command-line options to a file"""
...
@@ -156,9 +143,3 @@ class setopt(option_base):
...
@@ -156,9 +143,3 @@ class setopt(option_base):
},
},
self
.
dry_run
self
.
dry_run
)
)
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