Manual 2to3 fixups.
[cumulus.git] / python / cumulus / config.py
index 62225bd..aeb24ae 100644 (file)
@@ -1,7 +1,6 @@
-# Cumulus: Smart Filesystem Backup to Dumb Servers
-#
-# Copyright (C) 2012  Google Inc.
-# Written by Michael Vrable <mvrable@cs.ucsd.edu>
+# Cumulus: Efficient Filesystem Backup to the Cloud
+# Copyright (C) 2012 The Cumulus Developers
+# See the AUTHORS file for a list of contributors.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -23,7 +22,12 @@ See the Cumulus documentation for a description of the configuration file
 format.
 """
 
-import ConfigParser
+from __future__ import division, print_function, unicode_literals
+
+try:
+    import configparser
+except ImportError:
+    import ConfigParser as configparser
 import datetime
 import re
 
@@ -42,7 +46,7 @@ def _build_retention_engine(spec):
     for s in spec.split():
         m = class_re.match(s)
         if not m:
-            print "Invalid retain spec:", s
+            print("Invalid retain spec:", s)
             continue
         period = datetime.timedelta()
         classname = m.group(1)
@@ -52,7 +56,6 @@ def _build_retention_engine(spec):
             seconds = int(m.group(1)) * _TIME_UNITS[m.group(2)]
             period = period + datetime.timedelta(seconds=seconds)
             intervalspec = m.group(3)
-        print classname, period
         policy.add_policy(classname, period)
     return policy
 
@@ -60,7 +63,7 @@ def _build_retention_engine(spec):
 class CumulusConfig(object):
     def __init__(self, filename):
         """Parse a Cumulus backup configuration from the specified file."""
-        self._config = ConfigParser.RawConfigParser()
+        self._config = configparser.RawConfigParser()
         self._config.readfp(open(filename))
 
     def get_global(self, key):