From 592269afeaa4f96bddbaa8b6fbe8dddcea2445a4 Mon Sep 17 00:00:00 2001 From: PJ Eby Date: Fri, 8 Jul 2005 04:48:20 +0000 Subject: * Added "rotate" command to delete old distribution files, given a set of patterns to match and the number of files to keep. (Keeps the most recently-modified distribution files matching each pattern.) * Added "saveopts" command that saves all command-line options for the current invocation to the local, global, or per-user configuration file. Useful for setting defaults without having to hand-edit a configuration file. * Added a "setopt" command that sets a single option in a specified distutils configuration file. --HG-- branch : setuptools extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4041093 --- setuptools/command/saveopts.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 setuptools/command/saveopts.py (limited to 'setuptools/command/saveopts.py') diff --git a/setuptools/command/saveopts.py b/setuptools/command/saveopts.py new file mode 100755 index 00000000..ad3cf193 --- /dev/null +++ b/setuptools/command/saveopts.py @@ -0,0 +1,27 @@ +import distutils, os +from setuptools import Command +from setuptools.command.setopt import edit_config, option_base + +class saveopts(option_base): + """Save command-line options to a file""" + + description = "save supplied options to setup.cfg or other config file" + + user_options = option_base.user_options + [ + ] + + boolean_options = option_base.boolean_options + [ + ] + + def run(self): + dist = self.distribution + commands = dist.command_options.keys() + settings = {} + for cmd in commands: + if cmd=='saveopts': + continue + for opt,(src,val) in dist.get_option_dict(cmd).items(): + if src=="command line": + settings.setdefault(cmd,{})[opt] = val + edit_config(self.filename, settings, self.dry_run) + -- cgit v1.2.1 From 6050f5361738831a12debd373b9016a077e930df Mon Sep 17 00:00:00 2001 From: PJ Eby Date: Fri, 8 Jul 2005 05:09:23 +0000 Subject: Added support for defining command aliases in distutils configuration files, under the "[aliases]" section. To prevent recursion and to allow aliases to call the command of the same name, a given alias can be expanded only once per command-line invocation. You can define new aliases with the "alias" command, either for the local, global, or per-user configuration. --HG-- branch : setuptools extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4041094 --- setuptools/command/saveopts.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'setuptools/command/saveopts.py') diff --git a/setuptools/command/saveopts.py b/setuptools/command/saveopts.py index ad3cf193..1180a440 100755 --- a/setuptools/command/saveopts.py +++ b/setuptools/command/saveopts.py @@ -7,21 +7,19 @@ class saveopts(option_base): description = "save supplied options to setup.cfg or other config file" - user_options = option_base.user_options + [ - ] - - boolean_options = option_base.boolean_options + [ - ] - def run(self): dist = self.distribution commands = dist.command_options.keys() settings = {} + for cmd in commands: + if cmd=='saveopts': - continue + continue # don't save our own options! + for opt,(src,val) in dist.get_option_dict(cmd).items(): if src=="command line": settings.setdefault(cmd,{})[opt] = val + edit_config(self.filename, settings, self.dry_run) -- cgit v1.2.1 From 58a658b26d1c95b31d02050dcccd648d2e4ce27b Mon Sep 17 00:00:00 2001 From: Vinay Sajip Date: Mon, 20 Jun 2011 22:55:16 +0100 Subject: Changes to support 2.x and 3.x in the same codebase. --HG-- branch : distribute extra : rebase_source : 7d3608edee54a43789f0574d702fb839628b5071 --- setuptools/command/saveopts.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'setuptools/command/saveopts.py') diff --git a/setuptools/command/saveopts.py b/setuptools/command/saveopts.py index 1180a440..7209be4c 100755 --- a/setuptools/command/saveopts.py +++ b/setuptools/command/saveopts.py @@ -9,10 +9,9 @@ class saveopts(option_base): def run(self): dist = self.distribution - commands = dist.command_options.keys() settings = {} - for cmd in commands: + for cmd in dist.command_options: if cmd=='saveopts': continue # don't save our own options! -- cgit v1.2.1 From 8e3f9d3253d1d0fb820dad4249d5110d017595c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Gr=C3=B6nholm?= Date: Wed, 18 Jun 2014 20:31:05 +0300 Subject: Fixed PEP 8 compliancy of the setuptools.command package --- setuptools/command/saveopts.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'setuptools/command/saveopts.py') diff --git a/setuptools/command/saveopts.py b/setuptools/command/saveopts.py index 7209be4c..611cec55 100755 --- a/setuptools/command/saveopts.py +++ b/setuptools/command/saveopts.py @@ -1,7 +1,6 @@ -import distutils, os -from setuptools import Command from setuptools.command.setopt import edit_config, option_base + class saveopts(option_base): """Save command-line options to a file""" @@ -13,12 +12,11 @@ class saveopts(option_base): for cmd in dist.command_options: - if cmd=='saveopts': - continue # don't save our own options! + if cmd == 'saveopts': + continue # don't save our own options! - for opt,(src,val) in dist.get_option_dict(cmd).items(): - if src=="command line": - settings.setdefault(cmd,{})[opt] = val + for opt, (src, val) in dist.get_option_dict(cmd).items(): + if src == "command line": + settings.setdefault(cmd, {})[opt] = val edit_config(self.filename, settings, self.dry_run) - -- cgit v1.2.1 From 760e2e1df9c9c9d1fc072e7b6ad9df4c32bfc835 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Fri, 27 Jul 2018 14:36:34 +0200 Subject: Remove spurious executable permissions --- setuptools/command/saveopts.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 setuptools/command/saveopts.py (limited to 'setuptools/command/saveopts.py') diff --git a/setuptools/command/saveopts.py b/setuptools/command/saveopts.py old mode 100755 new mode 100644 -- cgit v1.2.1