Revert "Py3 adoption"
This reverts commit 50cd7198d6bba792c4dce86d4c9cab5a3d4430ee.
Reason for revert: Does not work
Change-Id: I03f94361b9fa38f599ee9e9fc5338b8a7e473b8b
diff --git a/requirements.txt b/requirements.txt
index 2854391..eb04d44 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -5,4 +5,3 @@
cmd2<0.9.0
pbr>=1.6
cliff>=1.4.5
-future
diff --git a/trsync/cmd/cli.py b/trsync/cmd/cli.py
index 983d5d2..d283f42 100644
--- a/trsync/cmd/cli.py
+++ b/trsync/cmd/cli.py
@@ -119,7 +119,7 @@
report[server]['success'] = True
except Exception as e:
report[server]['success'] = False
- report[server]['log'] = e
+ report[server]['log'] = e.message
exitcode = 1
for srv, msg in report.items():
@@ -200,7 +200,7 @@
report[server]['success'] = True
except Exception as e:
report[server]['success'] = False
- report[server]['log'] = e
+ report[server]['log'] = e.message
exitcode = 1
for srv, msg in report.items():
@@ -259,7 +259,7 @@
report[server]['success'] = True
except Exception as e:
report[server]['success'] = False
- report[server]['log'] = e
+ report[server]['log'] = e.message
exitcode = 1
for srv, msg in report.items():
diff --git a/trsync/cmd/trsync_push.py b/trsync/cmd/trsync_push.py
index b730983..453d207 100755
--- a/trsync/cmd/trsync_push.py
+++ b/trsync/cmd/trsync_push.py
@@ -112,7 +112,7 @@
try:
remote.push(source_dir, mirror_name, symlinks=symlinks)
except Exception as e:
- print(e)
+ print(e.message)
failed.append(server)
if failed:
diff --git a/trsync/cmd/trsync_remove.py b/trsync/cmd/trsync_remove.py
index 7c91fdf..95af858 100755
--- a/trsync/cmd/trsync_remove.py
+++ b/trsync/cmd/trsync_remove.py
@@ -66,7 +66,7 @@
print("Removing items {}".format(str(path)))
remote.rm_all(path)
except Exception as e:
- print(e)
+ print(e.message)
failed.append(server)
if failed:
diff --git a/trsync/objects/rsync_mirror.py b/trsync/objects/rsync_mirror.py
index d37bf9b..599500d 100644
--- a/trsync/objects/rsync_mirror.py
+++ b/trsync/objects/rsync_mirror.py
@@ -189,12 +189,12 @@
new_snapshots = list()
for s in snapshots:
s_date = datetime.datetime.strptime(
- s.decode('utf8'),
+ s,
'{}-{}'.format(repo_name,
self.timestamp.snapshot_stamp_format)
)
s_date = datetime.datetime.combine(s_date, datetime.time(0))
- s_path = self.url.a_file(self._snapshots_dir, s.decode('utf8'))
+ s_path = self.url.a_file(self._snapshots_dir, s)
if s_date < warn_date:
s_links = [_[0] for _ in links
if _[1] == s
diff --git a/trsync/objects/rsync_ops.py b/trsync/objects/rsync_ops.py
index 616020b..ff79eb4 100644
--- a/trsync/objects/rsync_ops.py
+++ b/trsync/objects/rsync_ops.py
@@ -90,7 +90,7 @@
pattern = re.compile(pattern)
out = [_ for _ in out.splitlines()
if (_.split()[-1] != '.') and
- (pattern.match(_.split()[-1].decode('utf8')) is not None)]
+ (pattern.match(_.split()[-1]) is not None)]
return out
def ls(self, path=None, pattern=r'.*'):
@@ -100,12 +100,12 @@
def ls_dirs(self, path=None, pattern=r'.*'):
out = self._ls(path, pattern=pattern)
- out = [_.split()[-1] for _ in out if _.startswith(b'd')]
+ out = [_.split()[-1] for _ in out if _.startswith('d')]
return out
def ls_symlinks(self, path=None, pattern=r'.*'):
out = self._ls(path, pattern=pattern, opts='-l')
- out = [_.split()[-3:] for _ in out if _.startswith(b'l')]
+ out = [_.split()[-3:] for _ in out if _.startswith('l')]
out = [[_[0], _[-1]] for _ in out]
return out
diff --git a/trsync/objects/rsync_url.py b/trsync/objects/rsync_url.py
index eb41091..5a1919a 100644
--- a/trsync/objects/rsync_url.py
+++ b/trsync/objects/rsync_url.py
@@ -18,7 +18,6 @@
import re
from trsync.utils import utils as utils
-from builtins import range as xrange
logger = utils.logger.getChild('RsyncUrl')
diff --git a/trsync/tests/functional/rsync_remotes/rsync2.py b/trsync/tests/functional/rsync_remotes/rsync2.py
index 86acb5b..d6f6082 100644
--- a/trsync/tests/functional/rsync_remotes/rsync2.py
+++ b/trsync/tests/functional/rsync_remotes/rsync2.py
@@ -25,7 +25,6 @@
from trsync.utils import shell as shell
from trsync.utils.utils import bunch as bunch
-from builtins import range as xrange
logging.basicConfig()
diff --git a/trsync/tests/functional/test_utils.py b/trsync/tests/functional/test_utils.py
index fca1b05..8ee12d6 100644
--- a/trsync/tests/functional/test_utils.py
+++ b/trsync/tests/functional/test_utils.py
@@ -17,7 +17,6 @@
import unittest
from trsync.utils import utils as utils
-from builtins import range as xrange
logger = utils.logger.getChild('TestUtils')