[diffoscope] 04/05: diffoscope/comparators: Move format_device into device.py
Chris Lamb
chris at chris-lamb.co.uk
Tue Dec 27 18:16:32 CET 2016
This is an automated email from the git hooks/post-receive script.
lamby pushed a commit to branch master
in repository diffoscope.
commit 945c5616777e2b298dfad0ca6ff521fa1a942290
Author: Chris Lamb <lamby at debian.org>
Date: Tue Dec 27 17:07:24 2016 +0000
diffoscope/comparators: Move format_device into device.py
---
diffoscope/comparators/device.py | 11 ++++++++++-
diffoscope/comparators/utils/__init__.py | 10 ----------
2 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/diffoscope/comparators/device.py b/diffoscope/comparators/device.py
index e94ee2a..601402e 100644
--- a/diffoscope/comparators/device.py
+++ b/diffoscope/comparators/device.py
@@ -18,11 +18,11 @@
# along with diffoscope. If not, see <https://www.gnu.org/licenses/>.
import os
+import stat
from diffoscope import get_named_temporary_file
from diffoscope.difference import Difference
-from .utils import format_device
from .binary import File, FilesystemFile
@@ -61,3 +61,12 @@ class Device(File):
with open(self.path) as my_content, \
open(other.path) as other_content:
return Difference.from_text_readers(my_content, other_content, self.name, other.name, source=source, comment="device")
+
+def format_device(mode, major, minor):
+ if stat.S_ISCHR(mode):
+ kind = 'character'
+ elif stat.S_ISBLK(mode):
+ kind = 'block'
+ else:
+ kind = 'weird'
+ return 'device:%s\nmajor: %d\nminor: %d\n' % (kind, major, minor)
diff --git a/diffoscope/comparators/utils/__init__.py b/diffoscope/comparators/utils/__init__.py
index 052fb28..565f9e1 100644
--- a/diffoscope/comparators/utils/__init__.py
+++ b/diffoscope/comparators/utils/__init__.py
@@ -21,7 +21,6 @@ import abc
import os
import re
import io
-import stat
import threading
import itertools
import subprocess
@@ -129,15 +128,6 @@ def format_symlink(destination):
return 'destination: %s\n' % destination
-def format_device(mode, major, minor):
- if stat.S_ISCHR(mode):
- kind = 'character'
- elif stat.S_ISBLK(mode):
- kind = 'block'
- else:
- kind = 'weird'
- return 'device:%s\nmajor: %d\nminor: %d\n' % (kind, major, minor)
-
def get_compressed_content_name(path, expected_extension):
basename = os.path.basename(path)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git
More information about the diffoscope
mailing list