ponymail-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject incubator-ponymail git commit: Require --clobber flag to overwrite config.lua
Date Thu, 10 Nov 2016 19:53:39 GMT
Repository: incubator-ponymail
Updated Branches:
  refs/heads/master 9677273ba -> 30bfeb7df


Require --clobber flag to overwrite config.lua

If not set, create config.lua.tmp if config.lua exists

Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/30bfeb7d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/30bfeb7d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/30bfeb7d

Branch: refs/heads/master
Commit: 30bfeb7dfb3379c6f8bcb3751798c692e660e875
Parents: 9677273
Author: Sebb <sebb@apache.org>
Authored: Thu Nov 10 19:53:22 2016 +0000
Committer: Sebb <sebb@apache.org>
Committed: Thu Nov 10 19:53:22 2016 +0000

----------------------------------------------------------------------
 tools/setup.py | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/30bfeb7d/tools/setup.py
----------------------------------------------------------------------
diff --git a/tools/setup.py b/tools/setup.py
index 31631e7..a7f2722 100755
--- a/tools/setup.py
+++ b/tools/setup.py
@@ -14,7 +14,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-import sys, os
+import sys, os, os.path
 import getpass
 import subprocess
 import argparse
@@ -55,6 +55,8 @@ parser = argparse.ArgumentParser(description='Command line options.')
 parser.add_argument('--defaults', dest='defaults', action='store_true', 
                    help='Use default settings')
 
+parser.add_argument('--clobber', dest='clobber', action='store_true',
+                   help='Allow overwrite of config.lua (default: create config.lua.tmp if
config.lua exists)')
 parser.add_argument('--dbhost', dest='dbhost', type=str, nargs=1,
                    help='ES backend hostname')
 parser.add_argument('--dbport', dest='dbport', type=str, nargs=1,
@@ -411,9 +413,14 @@ if not args.noi:
         print("Index creation failed: %s" % e)
         sys.exit(1)
 
-print("Writing importer config (ponymail.cfg)")
+config_file = 'ponymail.cfg'
+if not args.clobber and os.path.exists(config_file):
+    print("%s exists and clobber is not set" % config_file)
+    config_file = 'ponymail.cfg.tmp'
 
-with open("ponymail.cfg", "w") as f:
+print("Writing importer config (%s)" % config_file)
+
+with open(config_file, "w") as f:
     f.write("""
 ###############################################################
 # Pony Mail Configuration file                                             


Mime
View raw message