Merge pull request #55 from Enlik/py3

[entropy.tools, tests] fix test and code with Python 3; add to CI
This commit is contained in:
Ettore Di Giacinto
2018-08-06 22:29:42 +02:00
committed by GitHub
3 changed files with 16 additions and 5 deletions

View File

@@ -9,7 +9,11 @@ before_install:
script:
- >
docker run -v $TRAVIS_BUILD_DIR:/entropy sabayon/base-amd64
bash -c "equo i dev-util/bsdiff; cd /entropy/lib/tests && LC_ALL=en_US.UTF-8 USERNAME=root ETP_TESTS_NONINTERACTIVE=1 ./run"
bash -c "python2 --version; python3 --version"
- >
docker run -v $TRAVIS_BUILD_DIR:/entropy sabayon/base-amd64
env LC_ALL=en_US.UTF-8 USERNAME=root ETP_TESTS_NONINTERACTIVE=1
bash -c 'equo i dev-util/bsdiff; cd /entropy/lib/tests && ret=0 && { python2 ./run || ret=$?; python3 ./run || ret=$?; }; exit $ret'
notifications:
irc: "chat.freenode.net#sabayon-infra"

View File

@@ -1098,7 +1098,7 @@ def universal_uncompress(compressed_file, dest_path, catch_empty = False):
for tarinfo in directories:
epath = os.path.join(dest_path, tarinfo.name)
try:
tar.chown(tarinfo, epath)
_tarfile_chown(tar, tarinfo, epath)
# this is mandatory on uid/gid that don't exist
# and in this strict order !!
@@ -2036,6 +2036,13 @@ def _fix_uid_gid(tarinfo, epath):
except OSError:
pass
def _tarfile_chown(tar, tarinfo, targetpath):
if const_is_python3():
return tar.chown(tarinfo, targetpath,
numeric_owner=False)
else:
return tar.chown(tarinfo, targetpath)
def apply_tarball_ownership(filepath, prefix_path):
"""
Given an already extracted tarball available at prefix_path, and the
@@ -2064,7 +2071,7 @@ def apply_tarball_ownership(filepath, prefix_path):
epath = os.path.join(encoded_path, tarinfo.name)
try:
tar.chown(tarinfo, epath)
_tarfile_chown(tar, tarinfo, epath)
_fix_uid_gid(tarinfo, epath)
if not os.path.islink(epath):
# make sure we keep the same permissions
@@ -2107,7 +2114,7 @@ def uncompress_tarball(filepath, extract_path = None, catch_empty = False):
def _setup_file_metadata(tarinfo, epath):
try:
tar.chown(tarinfo, epath)
_tarfile_chown(tar, tarinfo, epath)
_fix_uid_gid(tarinfo, epath)
# no longer touch utime using Tarinfo, behaviour seems

View File

@@ -873,7 +873,7 @@ class EntropyRepositoryTest(unittest.TestCase):
assert set(data.keys()) == set(db_data.keys())
for k, v in data.items():
if v != db_data[k]:
print k, v, "vs", db_data[k]
print(k, v, "vs", db_data[k])
self.assertEqual(data, db_data)
set_mute(True)